我下载网页并解析javascript代码,其中包含代码哈希和java解码功能...... 我想从C#程序中调用javascript解码方法......
在网页中我:
window.decoded_hashes = {};
window.decodehash = function(hash) {
window.dec_hash(hash);
return window.decoded_hashes[hash];
window.dec_hash = function(hash) {
(function(__){window.decoded_hashes[hash] = _(__,8,_____(__)-12)+_(__,0,5);})((function(__){____='';for(___=0;___<_____(__);++___)____+=______(__,_____(__)-___-1);return window[_______(88,11,-13)]?__:____;})((function(__){____=window[_______(103,-2)]?'':'____';for(___=0;___<_____(__);++___)____+=(function(__){return __>111?(121-__):_______(__);})(__.charCodeAt(___));return ____;})((function(__){_______=function(){var _='',__=0,___=arguments;for(var ____=0;____<___.length;++____)_+=String.fromCharCode(__+=___[____]);return _;};______=function(__,___){return __.charAt(___);};_____=function(__){return __.length;};____=(_=function(_,__,___){____='';(___=___?___:(_____(_)-__));for(;___;--___)____+=(function(_,__){return ______(_,__)})(_,__++);return ____;})(__,3,3);____+=_(__,0,2)+_(__,8);return ____;})(hash))));
}
window.wall_post_hash = decodehash('tsucuqtyqvedvvpruuqasavdpwdcxafcystrdfvsyd');
我必须在服务器上发送解码哈希...哈希在() - dinamic
如何变得更容易?我找到了Rhino和IKVM,但还没有理解......
给我建议请...
对不起我的英文;)
答案 0 :(得分:0)
您可以在项目引用中包含Microsoft.JScript。
查看Rick Strahl's中有关如何使用Eval获取结果的示例。
这是我在一些调试和更改后设法解决的一个实现。它返回与您的示例相同的结果。一个问题是.Net似乎不能使用函数“arguments”变量。所以我在该函数中添加了5个变量以使其工作。似乎通过的最多是3。
package Pack
{
class JSEval
{
public function MyEval(inputhash : String) : String
{
var ___ = 0;
var _= '';
var ____ = '';
var _______;
var ______;
var _____;
var ____ = (_ = function(_, __, ___) {
____ = '';
(___ = ___ ? ___ : (_____(_) - __));
for (; ___; --___) ____ += (function(_, __) {
return ______(_, __)
})(_, __++);
return ____;
})
var mywin = new Object();
mywin.decoded_hashes = {};
mywin.dec_hash = function(hash) {
(function(__) {
mywin.decoded_hashes[hash] = _(__, 8, _____(__) - 12) + _(__, 0, 5);
})((function(__) {
var ____ = '';
for (___ = 0; ___ < _____(__); ++___) ____ += ______(__, _____(__) - ___ - 1);
return mywin[_______(88, 11, -13)] ? __ : ____;
})((function(input) {
var res = mywin[_______(103, -2)] ? '' : '____';
for (var i = 0; i < _____(input); ++i) res += (function(input) {
return input > 111 ? (121 - input) : _______(input);
})(input.charCodeAt(i));
return res;
})((function(__) {
_______ = function(a,b,c,d,e) {
var arguments = new Array();
if( a != undefined )
arguments.push(a);
if( b != undefined )
arguments.push(b);
if( c != undefined )
arguments.push(c);
if( d != undefined )
arguments.push(d);
if( e != undefined )
arguments.push(e);
var _ = '';
var __ = 0;
for (var i = 0; i < arguments.length; ++i) _ += String.fromCharCode(__ += arguments[i]);
return _;
};
______ = function(__, ___) {
return __.charAt(___);
};
_____ = function(__) {
return __.length;
};
____ = (_ = function(_, __, ___) {
____ = '';
(___ = ___ ? ___ : (_____(_) - __));
for (; ___; --___) ____ += (function(_, __) {
return ______(_, __)
})(_, __++);
return ____;
})(__, 3, 3);
____ += _(__, 0, 2) + _(__, 8);
return ____;
})(hash))));
}
mywin.decodehash = function(hash) {
mywin.dec_hash(hash);
return mywin.decoded_hashes[hash];
}
return mywin.decodehash(inputhash);
}
}
}