Planet PDF Forum Planet PDF Forum
  New Posts New Posts RSS Feed - Script Object and bytecode loader
  FAQ FAQ  Forum Search   Register Register  Login Login

Hi, welcome to the Foxit Planet PDF Forum. If you have PDF or Adobe Acrobat questions then the right place to ask them is here, in this forum.

Script Object and bytecode loader

 Post Reply Post Reply
Author
bulk88 View Drop Down
New Member
New Member


Joined: 23 Apr 2014
Points: 1
Post Options Post Options   Quote bulk88 Quote  Post ReplyReply Direct Link To This Post Topic: Script Object and bytecode loader
    Posted: 23 Apr 2014 at 3:54pm
Ever wondered how the JSByteCodeWin.bin binary blob bytecode file works?  Here is some undocumented code explaining how to create and load bytecode. Run it in Acrobat's JS Console. It is not in the same format as JSByteCodeWin.bin. JSByteCodeWin.bin looks like 2 bytes per character UTF16, the string returned by freeze() has normal looking words in it. Loading from disk is a separate API and is not part of Script class so you have to figure out yourself how to get it into a JS string.  The output of freeze() is probably unique to build of Acrobat, so you cant use it to obfuscate code.

    app.beginPriv();
    this.level1 = new Object();
    delete this.level1.testcomp;
    s = new Script();
    s.compile("this.level1.testcomp = function () {return \"retval\";}");
    t = new Script();
    app.alert(escape(s.freeze()));
    t.thaw(s.freeze());
    app.alert("toSource is "+t.toSource());
    try{
    app.alert("testcomp is "+this.level1.testcomp);
    }
    catch(err){
    app.alert(err);
    }
    t.exec();
    app.alert("testcomp is "+this.level1.testcomp);
    app.endPriv();

Back to Top
try67 View Drop Down
Senior Member
Senior Member


Joined: 15 Jul 2011
Points: 634
Post Options Post Options   Quote try67 Quote  Post ReplyReply Direct Link To This Post Posted: 23 Apr 2014 at 5:40pm
Interesting stuff... Thanks!
- Acrobat Expert - Contact me personally at try6767@gmail.com
Check out my custom-made scripts website: http://try67.blogspot.com
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.10
Copyright ©2001-2017 Web Wiz Ltd.

This page was generated in 0.012 seconds.