Skip to content

Commit

Permalink
only print --fork-nopper objdump if verbose >= 1
Browse files Browse the repository at this point in the history
  • Loading branch information
anthraxx committed Oct 21, 2013
1 parent 886876c commit c717d3d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions shellnoob.py
Original file line number Diff line number Diff line change
Expand Up @@ -629,13 +629,13 @@ def get_file_offset_from_vm_address(self, exe_fp, vm_address):
def do_fork_nopper(self, exe_fp):
lines = os.popen('objdump -d %s' % exe_fp).read().split('\n')
for line in lines:
print(line)
if self.verbose >= 1:
print(line)
m = re.search('([0-9a-f]+):\s+[0-9a-f ]+\s+call.*fork', line)
if not m: continue
vm_address = int(m.group(1), 16)
print('FOUND A CALL TO FORK @ 0x%x' % vm_address)
file_offset = self.get_file_offset_from_vm_address(exe_fp, vm_address)
print('fileoffset @ 0x%x' % file_offset)
print('Found call to fork @ 0x%x (file offset 0x%x)' % (vm_address, file_offset))
self.do_exe_patch(exe_fp, '\x90\x90\x90\x31\xc0', file_offset)

def do_exe_patch(self, exe_fp, data, file_offset=None, vm_address=None, replace=True):
Expand Down

0 comments on commit c717d3d

Please sign in to comment.