Skip to content

Commit 44b8da8

Browse files
committed
计时方式的简要修改
1 parent 65337b7 commit 44b8da8

File tree

1 file changed

+4
-13
lines changed

1 file changed

+4
-13
lines changed

main/detect.py

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,7 @@ class Detector:
4747

4848
def __init__(self):
4949
# Init Two Time Recorder.
50-
self.time_decode = TimeRecord('Target App Decoding')
51-
self.time_load = TimeRecord('Lib Data Loading')
52-
self.time_extract = TimeRecord('Feature Extracting')
50+
self.time_load_and_extract = TimeRecord('Decoding & Data Loading')
5351
self.time_compare = TimeRecord('Library Searching')
5452

5553
# For decoding bug.
@@ -196,17 +194,14 @@ def get_smali(self, path):
196194
:param path:
197195
:return: decoded files' path
198196
"""
199-
self.time_decode.start()
197+
self.time_load_and_extract.start()
200198
cmd = self.project_path + "/" + "../tool/apktool decode %s -o " % path + self.project_path + "/" + \
201199
"../decoded/%s" % os.path.basename(path)
202200
subprocess.call(cmd, shell=True)
203-
self.time_decode.end()
204201
return self.project_path + '/../decoded/%s' % os.path.basename(path)
205202

206203
def load_data(self):
207204
# - Loading Data
208-
209-
self.time_load.start()
210205
dep_address = self.project_path + "/" + "../data/tgst5.dat"
211206
dict_address = self.project_path + "/" + "../permission/tagged_dict.txt"
212207
dep_file = open(dep_address, 'r')
@@ -249,7 +244,6 @@ def load_data(self):
249244
else:
250245
self.libs_feature.append((u['bh'], u['btn'], u['btc'], u['sp'], u['lib'], "", u['dn'], "", ""))
251246

252-
self.time_load.end()
253247

254248
def get_hash(self, apk_path):
255249
"""
@@ -258,7 +252,6 @@ def get_hash(self, apk_path):
258252
:return: The path of apk with libs removed.
259253
"""
260254

261-
self.time_extract.start()
262255

263256
# - All Over
264257
# print apk_path+'/smali'
@@ -279,7 +272,7 @@ def get_hash(self, apk_path):
279272
path_and_permission = {}
280273

281274
number_of_tagged_libs = len(self.libs_feature)
282-
self.time_extract.end()
275+
self.time_load_and_extract.end()
283276
self.time_compare.start()
284277

285278
def compare_d(a, b):
@@ -393,9 +386,7 @@ def find_features(package):
393386

394387
# To String
395388
# print "--Time-Consuming--"
396-
self.time_decode.tostring()
397-
self.time_load.tostring()
398-
self.time_extract.tostring()
389+
self.time_load_and_extract.tostring()
399390
self.time_compare.tostring()
400391

401392
# Remove Lib Files.

0 commit comments

Comments
 (0)