HexHive / retrowrite

RetroWrite -- Retrofitting compiler passes through binary rewriting
Other
655 stars 78 forks source link

Retrowrite can only handle Position-Independent Executables #14

Closed diagprov closed 3 years ago

diagprov commented 3 years ago

This patch adds logic to check for a position independent executable and will refuse to run if the executable does not look to be PIE.

An option --ignorepie exists to suppress this check (for example if for some reason the check is not valid on different architectures).

This may not fix retrowrite in all cases. In particular there appears to be multiple "retrowrite" commands, both librw/rw.py and retrowrite itself. There should not be as this is just a maintenance nightmare.

You can add multiple binary entrypoints in the setup.py of a python setuptools project, i.e. here is my WIP for Halucinator:

setup(name='halucinator',
      version='1.0a',
      description='Emulation and rehosting framework',
      author='Abe Clements and Eric Gustafson',
      author_email='',
      # url='https://seclab.cs.ucsb.edu',
      packages=get_packages('halucinator'),
      entry_points ={'console_scripts': [
            'halucinator-periph = halucinator.commands.peripheral:main',
            'halucinator-rehost = halucinator.commands.rehost:main',
            'ghalucinator = halucinator.commands.gui:main'
        ]},
      requires=['avatar2',
                'zeromq',
                'PyYAML',
                'IPython', ])

these will all be binaries installed to the system (or pip virtualenv) which will also avoid the link step in setup.sh.

cc @gannimo

jeanmi151 commented 3 years ago

Thanks for your contribution !