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

NameError: name 'gadget' is not defined #126

Closed zeroSteiner closed 4 years ago

zeroSteiner commented 4 years ago

The input executable is the Python 3.6.5 installer, SHA-1: 35835e11b5f57b39c74edfc70256b81138c24f11. I was trying to use it because I know there's a VirtaulProtect import so I could see the chain output.

[INFO] Load gadgets for section: .text
[LOAD] loading... 100%
[LOAD] removing double gadgets... 100%

[INFO] Ropchain Generator for VirtualProtect:

[INFO] eax 0x90909090
ecx old protection (writable addr)
edx 0x40 (RWE)
ebx size
esp address
ebp return address (jmp esp)
esi pointer to VirtualProtect
edi ret (rop nop)

Traceback (most recent call last):
  File "/home/smcintyre/Repositories/Ropper/ropper/console.py", line 360, in __generateChain
    chain = self.__rs.createRopChain(generator, str(self.currentFile.arch) ,options)
  File "/home/smcintyre/Repositories/Ropper/ropper/service.py", line 775, in createRopChain
    return generator.create(options)
  File "/home/smcintyre/Repositories/Ropper/ropper/ropchain/arch/ropchainx86.py", line 945, in create
    jmp_esp = self._createJmp()
  File "/home/smcintyre/Repositories/Ropper/ropper/ropchain/arch/ropchainx86.py", line 886, in _createJmp
    self._updateUsedBinaries(gadget[0])
NameError: name 'gadget' is not defined

[ERROR] Please report this error on https://github.com/sashs/ropper
[ERROR] Traceback (most recent call last):
  File "/home/smcintyre/Repositories/Ropper/ropper/console.py", line 62, in cmd
    func(self, text)
  File "/home/smcintyre/Repositories/Ropper/ropper/console.py", line 499, in __handleOptions
    self.__generateChain(options.chain)
  File "/home/smcintyre/Repositories/Ropper/ropper/console.py", line 377, in __generateChain
    raise e
  File "/home/smcintyre/Repositories/Ropper/ropper/console.py", line 360, in __generateChain
    chain = self.__rs.createRopChain(generator, str(self.currentFile.arch) ,options)
  File "/home/smcintyre/Repositories/Ropper/ropper/service.py", line 775, in createRopChain
    return generator.create(options)
  File "/home/smcintyre/Repositories/Ropper/ropper/ropchain/arch/ropchainx86.py", line 945, in create
    jmp_esp = self._createJmp()
  File "/home/smcintyre/Repositories/Ropper/ropper/ropchain/arch/ropchainx86.py", line 886, in _createJmp
    self._updateUsedBinaries(gadget[0])
NameError: name 'gadget' is not defined
sashs commented 4 years ago

Should be fixed now (master branch)