-
Notifications
You must be signed in to change notification settings - Fork 47
Expand file tree
/
Copy pathutils.py
More file actions
39 lines (33 loc) · 1.18 KB
/
utils.py
File metadata and controls
39 lines (33 loc) · 1.18 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
import sys
import string
import logging
import os
import re
# Progress bar function
def printProgress(times, total, prefix='', suffix='', decimals=2, bar=100):
filled = int(round(bar * times / float(total)))
percents = round(100.00 * (times / float(total)), decimals)
bar = '#' * filled + '-' * (bar - filled)
sys.stdout.write('%s [%s] %s%s %s\r' %
(prefix, bar, percents, '%', suffix)),
sys.stdout.flush()
if times == total:
print("\n")
# A very basic implementations of Strings
def strings(filename, directory, min=4):
strings_file = os.path.join(directory, "strings.txt")
path = os.path.join(directory, filename)
with open(path, encoding='Latin-1') as infile:
str_list = re.findall("[A-Za-z0-9/\-:;.,_$%'!()[\]<> \#]+", infile.read())
with open(strings_file, "a") as st:
for string in str_list:
if len(string) > min:
logging.debug(string)
st.write(string + "\n")
# Normalize thw namo of application works better on frida
def normalize_app_name(appName=str):
try:
appName = int(appName)
except ValueError:
pass
return appName