2009-12-24 6 views
0

Je suis télécharger la page web et parser code javascript, qui ont en hachage de code et la fonction de décodage java ... s'il vous plaît, je veux appeler javascript méthode de décodage du programme C# ...Utiliser des méthodes JavaScripts sur C#

dans la page web que j'ai:

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'); 

Et je dois envoyer hash de décodage sur le serveur ... hachage() - Dinamic

Comment rendre plus facile? Je l'ai trouvé Rhino et IKVM, mais n'ont pas encore compris ...

Donnez-moi des conseils Pls ...

Désolé pour mon anglais;)

Répondre

0

Vous pouvez inclure dans votre projet Microsoft.JScript les références.

Découvrez un exemple de Rick Strahl's sur la façon dont vous pouvez utiliser Eval pour obtenir vos résultats.

Voici une implémentation que j'ai réussi à mettre au point après quelques déboguages ​​et modifications. Il renvoie le même résultat que votre exemple. Un problème est que .Net ne semble pas fonctionner avec la fonction "arguments" variable. J'ai donc ajouté 5 variables à cette fonction pour le faire fonctionner. Semble le plus qui est passé est 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);     
     } 
    } 
} 
Questions connexes