gpt4 book ai didi

javascript - 在 C# 中执行 JavaScript

转载 作者:行者123 更新时间:2023-11-28 18:38:30 26 4
gpt4 key购买 nike

我尝试通过使用 C# 代码重新创建逻辑来在后端执行以下 JavaScript。我正在尝试获取“sucuri_cloudproxy_js”cookie 以访问 web 内容,但为了获取此 cookie,您必须执行此 JavaScript。在 C# 中执行 javascript 最有效的方法是什么?谢谢!

var s = {},
u, c, U, r, i, l = 0,
a, e = eval,
w = String.fromCharCode,
sucuri_cloudproxy_js = '',
S = 'dj0nd0U3Jy5jaGFyQXQoMikrU3RyaW5nLmZyb21DaGFyQ29kZSg5OSkgKyAiIiArIjZzdSIuc2xpY2UoMCwxKSArICI5c3UiLnNsaWNlKDAsMSkgKyAnNScgKyAgIjUiICsgImZzZWMiLnN1YnN0cigwLDEpICsgIjNzdWN1ciIuY2hhckF0KDApKyAnJyArIAoiMyIgKyAiIiArImQiLnNsaWNlKDAsMSkgKyAgJycgKyIwc3UiLnNsaWNlKDAsMSkgKyAgJycgKydlJyArICAiYyIgKyAiIiArImJzdWN1ciIuY2hhckF0KDApK1N0cmluZy5mcm9tQ2hhckNvZGUoMHgzMikgKyAgJycgKycnKydlJyArICAiOCIuc2xpY2UoMCwxKSArICAnJyArJ2ZLNycuY2hhckF0KDIpKydANCcuc2xpY2UoMSwyKSsiIiArImQiICsgICcnICsgCiJiIiArICI5IiArICAnJyArJycrU3RyaW5nLmZyb21DaGFyQ29kZSg1NCkgKyAiYiIgKyAgJycgKyAKIjYiICsgJzAnICsgICIiICsiNyIgKyAnb01kJy5jaGFyQXQoMikrImFzZWMiLnN1YnN0cigwLDEpICsgU3RyaW5nLmZyb21DaGFyQ29kZSg0OSkgKyAgJycgKycnKyc4JyArICAiZHNlYyIuc3Vic3RyKDAsMSkgKyAnJztkb2N1bWVudC5jb29raWU9J3NzdWMnLmNoYXJBdCgwKSsgJ3VzdWMnLmNoYXJBdCgwKSsgJ2MnKyd1JysncicrJ2knKydfJysnYycuY2hhckF0KDApKydsc3UnLmNoYXJBdCgwKSArJ3N1Y3VybycuY2hhckF0KDUpICsgJ3UnKydzdWN1cmQnLmNoYXJBdCg1KSArICdwc3VjdXInLmNoYXJBdCgwKSsgJ3InKydvJysneHN1Y3VyJy5jaGFyQXQoMCkrICd5Jy5jaGFyQXQoMCkrJ18nKycnKyd1c3VjdXInLmNoYXJBdCgwKSsgJ3N1Jy5jaGFyQXQoMSkrJ2knKycnKydkJysnX3MnLmNoYXJBdCgwKSsnM3N1Y3UnLmNoYXJBdCgwKSAgKycwJysnZCcrJzEnLmNoYXJBdCgwKSsnOXN1Y3UnLmNoYXJBdCgwKSAgKydzdTknLmNoYXJBdCgyKSsnc3VjdXIzJy5jaGFyQXQoNSkgKyAnYXN1Y3VyaScuY2hhckF0KDApICsgJ2YnKyI9IiArIHY7IGxvY2F0aW9uLnJlbG9hZCgpOw==';
L = S.length;
U = 0;
r = '';
var A = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
for (u = 0; u < 64; u++) {
s[A.charAt(u)] = u;
}
for (i = 0; i < L; i++) {
c = s[S.charAt(i)];
U = (U << 6) + c;
l += 6;
while (l >= 8) {
((a = (U >>> (l -= 8)) & 0xff) || (i < (L - 2))) && (r += w(a));
}
}
e(r);

最佳答案

这看起来像是某种 Base 64 解码算法。 C# 中有内置的 base64 解码器,你可以尝试一下。或者,如果“S”永远不会改变,您可以在 javascript 中执行此操作并将结果放入您的 C# 程序中。

在 JavaScript 控制台中执行此操作:

var s = {},
u, c, U, r, i, l = 0,
a, e = eval,
w = String.fromCharCode,
sucuri_cloudproxy_js = '',
S = 'dj0nd0U3Jy5jaGFyQXQoMikrU3RyaW5nLmZyb21DaGFyQ29kZSg5OSkgKyAiIiArIjZzdSIuc2xpY2UoMCwxKSArICI5c3UiLnNsaWNlKDAsMSkgKyAnNScgKyAgIjUiICsgImZzZWMiLnN1YnN0cigwLDEpICsgIjNzdWN1ciIuY2hhckF0KDApKyAnJyArI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= S.length;
U = 0;
r = '';
var A = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
for (u = 0; u < 64; u++) {
s[A.charAt(u)] = u;
}
for (i = 0; i < L; i++) {
c = s[S.charAt(i)];
U = (U << 6) + c;
l += 6;
while (l >= 8) {
((a = (U >>> (l -= 8)) & 0xff) || (i < (L - 2))) && (r += w(a));
}
}
r;

给出了这个:

v='wE7'.charAt(2)+String.fromCharCode(99) + "" +"6su".slice(0,1) + "9su".slice(0,1) + '5' +  "5" + "fsec".substr(0,1) + "3sucur".charAt(0)+ '' + 
"3" + "" +"d".slice(0,1) + '' +"0su".slice(0,1) + '' +'e' + "c" + "" +"bsucur".charAt(0)+String.fromCharCode(0x32) + '' +''+'e' + "8".slice(0,1) + '' +'fK7'.charAt(2)+'@4'.slice(1,2)+"" +"d" + '' +
"b" + "9" + '' +''+String.fromCharCode(54) + "b" + '' +
"6" + '0' + "" +"7" + 'oMd'.charAt(2)+"asec".substr(0,1) + String.fromCharCode(49) + '' +''+'8' + "dsec".substr(0,1) + '';document.cookie='ssuc'.charAt(0)+ 'usuc'.charAt(0)+ 'c'+'u'+'r'+'i'+'_'+'c'.charAt(0)+'lsu'.charAt(0) +'sucuro'.charAt(5) + 'u'+'sucurd'.charAt(5) + 'psucur'.charAt(0)+ 'r'+'o'+'xsucur'.charAt(0)+ 'y'.charAt(0)+'_'+''+'usucur'.charAt(0)+ 'su'.charAt(1)+'i'+''+'d'+'_s'.charAt(0)+'3sucu'.charAt(0) +'0'+'d'+'1'.charAt(0)+'9sucu'.charAt(0) +'su9'.charAt(2)+'sucur3'.charAt(5) + 'asucuri'.charAt(0) + 'f'+"=" + v; location.reload();

去掉 location.reload 并执行它,它会产生一个字符串:

"sucuri_cloudproxy_uuid_30d1993af=7c6955f33d0ecb2e874db96b607da18d"

所有这些最初都是通过 eval 函数传递的,所以最后,我猜你想要 7c...18d,或者可能与 uuid 变量有关。

如果 S 发生变化,那么您需要对整个事情进行逆向工程,或者找到一种利用服务器端工具来执行 JavaScript 的方法。也许你可以使用 phantomjs 之类的东西。

关于javascript - 在 C# 中执行 JavaScript,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36554368/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com