Python>key = fwrapper() Python>len(key.buffer) 256 Python>data = fwrapper() Python>len(data.buffer) 12340 Python>hex(len(data.buffer)) 0x3033
Now we just need to mimic the assembly in python
A quick print to verify the data and now we can patch the IDB.
Python>temp iexplore.exe;outlook.exe;firefox.exe;opera.exe;skype.exe;msnmsgr.exe;yahoomessenger.exe;msmsgs.exe;wscntfy.exe;wuauclt.exe Python>data.buffer = temp Python>data.patch()
The new version can be found on BitBucket
# Name: # fwrapper.py # Version: # 0.2 # removed static instance name # Description: # This script can be used to carve out data and work with data in IDA. # Author # alexander<dot>hanel<at>gmail<dot>com import sys import idaapi class fwrapper(): def __init__(self): self.start = SelStart() self.end = SelEnd() self.buffer = '' self.ogLen = None self.status = True self.run() def checkBounds(self): if self.start is BADADDR or self.end is BADADDR: self.status = False def getData(self): self.ogLen = self.end - self.start try: for byte in GetManyBytes(self.start, self.ogLen): self.buffer = self.buffer + byte except: self.status = False return def run(self): self.checkBounds() if self.status == False: sys.stdout.write('ERROR: Please select valid data') return self.getData() def patch(self): 'patch idb with data in fwrapper.buffer' for index, byte in enumerate(self.buffer): PatchByte(self.start+index, ord(byte)) def importb(self): 'import file to save to buffer' fileName = AskFile(0, "*.*", 'Import File') try: self.buffer = open(fileName, 'r').read() except: sys.stdout.write('ERROR: Cannot access file') def export(self): 'save the selected buffer to a file' exportFile = AskFile(1, "*.*", 'Export Buffer') f = open(exportFile, 'wb') f.write(self.buffer) f.close()
No comments:
Post a Comment