-
Notifications
You must be signed in to change notification settings - Fork 21
/
xxxProject.py
54 lines (43 loc) · 1.71 KB
/
xxxProject.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import define
from define import flaFunc_type_common, flaFunc_type_aliSDK
from flaFunc import FlaFunc
from iosXXXFlaRecover import IOSXXXFlaRecover
from llvmIOSThumb2SymbolicExec import LLVMIOSThumb2SymbolicExec
from project import Project
class XXXProject(Project):
def __init__(self, filename, offset):
Project.__init__(self, filename, offset)
self.flaFuncs = []
self.symbolicExec = LLVMIOSThumb2SymbolicExec()
self.flaRecover = None
#funcs:[{"addr":0x1234, "type":"common"}, {"addr":0x2346, "type":"aliSDK", "table_start":0x3346, "table_end":0x3446}]
def load_flaFuncs(self, funcs_heads):
for func_head in funcs_heads:
if func_head[define.flaFunc_param_type] == flaFunc_type_common:
flaFunc = FlaFunc()
flaFunc.load(func_head)
self.flaFuncs.append(flaFunc)
else:
continue
def load_file(self):
origin = open(self.filename, 'rb')
self.origin_data = list(origin.read())
origin.close()
def save(self, save_filename):
recovery = open(save_filename, 'wb')
recovery.write(''.join(self.origin_data))
recovery.close()
print 'Successful! The recovered file: %s' % (save_filename)
def recover_flaFuncs(self):
#symbolic exe
self.symbolicExec.load(self.filename)
self.symbolicExec.run_flaFuncs(self.flaFuncs)
#fix
self.flaRecover = IOSXXXFlaRecover(self.origin_data, self.base_offset)
self.flaRecover.fix_fla_funcs(self.flaFuncs)
def recover(self, save_filename):
self.load_file()
#do recover
#flaFuncs
self.recover_flaFuncs()
self.save(save_filename)