js-beautify/python/jsbeautifier/unpackers
2018-09-09 13:57:13 -07:00
..
tests AutoPep8 2018-07-26 14:11:57 -07:00
__init__.py AutoPep8 2018-07-26 14:11:57 -07:00
evalbased.py Move all references to beautifier.io 2018-09-09 13:57:13 -07:00
javascriptobfuscator.py Move all references to beautifier.io 2018-09-09 13:57:13 -07:00
myobfuscate.py Move all references to beautifier.io 2018-09-09 13:57:13 -07:00
packer.py Move all references to beautifier.io 2018-09-09 13:57:13 -07:00
README.specs.mkd Added distutils facilities to python module. 2011-09-05 15:18:05 +03:00
urlencode.py Move all references to beautifier.io 2018-09-09 13:57:13 -07:00

UNPACKERS SPECIFICATIONS

Nothing very difficult: an unpacker is a submodule placed in the directory where this file was found. Each unpacker must define three symbols:

  • PRIORITY : integer number expressing the priority in applying this unpacker. Lower number means higher priority. Makes sense only if a source file has been packed with more than one packer.
  • detect(source) : returns True if source is packed, otherwise, False.
  • unpack(source) : takes a source string and unpacks it. Must always return valid JavaScript. That is to say, your code should look like:
if detect(source):
    return do_your_fancy_things_with(source)
else:
    return source

You can safely define any other symbol in your module, as it will be ignored.

__init__ code will automatically load new unpackers, without any further step to be accomplished. Simply drop it in this directory.