On 13 feb, 17:03, Christophe Grand <[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED] a écrit :
>
>
>
> > Hi all,
>
> > I am working with Rhino to try to deobfuscate some JavaScript scripts.
> > I pass them to the interpreter and it executes them. I would like to
> > print to screen the string passed to the top level function eval each
> > time it is called.
>
> > I tried working with aspects, but unfortunately the libraries I tried
> > needed an object associated to the method to add the aspects on so to
> > use them, and eval function is not associated to any object.
> > Therefore, I couldn't use aspects to do it.
>
> > My solution now is using regular expressions for changing eval for
> > print before executing the scripts so to automate the process.
> > However, this is not a totally proper solution for me since some
> > obfuscation techniques use user defined deobfuscating functions that
> > use the length of JavaScript code, so if I change it it doesn't work.
>
> > Does anybody know how could I add aspects to eval, or how to overwrite
> > it?
>
> Your question isn't specific to Rhino, it's plain Javascript:
>
> eval = (function(eval) {
> return function(s) {
> print(s);
> return eval(s)
> }
>
> })(eval);
>
> redefines eval to print before evuating.
>
> Christophe
Thanks for your reply!
However, I tried the solution in Rhino shell and when calling eval it
prints the code, but does not evaluate it. Is there any other way so
to print the code and evaluate it?
_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino