forked from alibaba/iOSSecAudit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathappbinary.py
More file actions
66 lines (45 loc) · 1.92 KB
/
appbinary.py
File metadata and controls
66 lines (45 loc) · 1.92 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
#author: june
import os
from otoolUtil import OtoolUtil
from abstracttool import Tool
########################################################################
class AppBinary(Tool):
""""""
#----------------------------------------------------------------------
def __init__(self, path):
"""Constructor"""
self.local_path = path
self.otool = OtoolUtil(self.local_path)
#----------------------------------------------------------------------
def is_encrypt(self):
""""""
if (self.otool is not None) and (self.otool.load_cmds is not None):
for (k, v) in self.otool.load_cmds.items():
if v['cmd'].strip().startswith("LC_ENCRYPTION_INFO") and v['cryptid'].strip() == str(1):
return True
return False
#----------------------------------------------------------------------
def get_cryptid(self):
""""""
if (self.otool is not None) and (self.otool.load_cmds is not None):
for (k, v) in self.otool.load_cmds.items():
if v['cmd'].strip().startswith("LC_ENCRYPTION_INFO"):
return v['cryptid'].strip()
return None
#----------------------------------------------------------------------
def is_PIE_set(self):
""""""
return self.otool.pie
#----------------------------------------------------------------------
def is_ARC_set(self):
""""""
return self.otool.arc
#----------------------------------------------------------------------
def is_stack_canaries_set(self):
""""""
return self.otool.stack_canaries
#----------------------------------------------------------------------
def all_strings(self):
""""""
cmd = "strings {}".format(self.local_path)
return self.exec_shell(cmd)