sashs / Ropper

Display information about files in different file formats and find gadgets to build rop chains for different architectures (x86/x86_64, ARM/ARM64, MIPS, PowerPC, SPARC64). For disassembly ropper uses the awesome Capstone Framework.
https://scoding.de/ropper
BSD 3-Clause "New" or "Revised" License
1.88k stars 206 forks source link

console bug: local variable 'f' referenced before assignment #110

Closed evilpan closed 5 years ago

evilpan commented 5 years ago
$ ropper --asm "pop eax" whatever
[ERROR] Please report this error on https://github.com/sashs/ropper
[ERROR] Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/ropper/console.py", line 62, in cmd
    func(self, text)
  File "/usr/local/lib/python3.5/dist-packages/ropper/console.py", line 454, in __handleOptions
    self.__asm(code, arch, format)
  File "/usr/local/lib/python3.5/dist-packages/ropper/console.py", line 266, in __asm
    raise RopperError('wrong format: %s' % f)
UnboundLocalError: local variable 'f' referenced before assignment

source: https://github.com/sashs/Ropper/blob/781adfa0859637d653a5c0f6b17a7eff2560787f/ropper/console.py#L266

fix suggestion:

  1. change f -> format, or
  2. handle --asm [<asm> [H|S|R] [<asm> [H|S|R] ...]] option beforehand.
sashs commented 5 years ago

Hi,

thanks for reporting. Yes, it should be format not f. Fixed! https://github.com/sashs/Ropper/blob/d0c9c43176cdaae53f2d3c69d6a3b4b9d512400d/ropper/console.py#L266