-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathGlobalVariables.py
60 lines (56 loc) · 1.88 KB
/
GlobalVariables.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
55
56
57
58
59
60
import threading
import requests
import os
from bs4 import BeautifulSoup
import subprocess
class GlobalVariables:
isClose=False
"""docstring for GlobalVariables"""
def __init__(self):
self.apktoolPath="./tools/apktool_2.9.2.jar"
self.dex2jarPath="./tools/dex2jar/d2j-dex2jar.sh"
self.dex2jarPathWin = ".\\tools\\dex2jar\\d2j-dex2jar.bat"
self.jdGUIPath="./tools/jd-gui-1.6.6.jar"
self.signJar="./tools/uber-apk-signer-1.3.0.jar"
self.outputDir="./apps"
self.snapshotDir="./snapshots"
self.burpCertName="burpcert.crt"
self.burpCertPath="./tools/{}".format(self.burpCertName)
self.mobSFURL="http://localhost:8000"
self.fridaServer="frida-server-16.1.11-android-x86"
self.fridaServerFileName="./tools/{}".format(self.fridaServer)
self.fridumpPath="./tools/fridump/fridump.py"
self.fridumpOutput="./dump/strings.txt"
self.fridasslunpinscript1="./tools/fridascript/UniversalSSLUnpinning.js"
self.androidtmpdir="/data/local/tmp/"
self.mobSFAPIKey=""
self.isWindowsOS=False
if os.name == 'nt':
self.isWindowsOS = True
if not os.path.exists(self.outputDir):
os.mkdir(self.outputDir)
if not os.path.exists(self.snapshotDir):
os.mkdir(self.snapshotDir)
def InitializeMobSFVariables(self):
isSuccess=False
try:
response=requests.get("{}/api_docs".format(self.mobSFURL), timeout=10)
soup = BeautifulSoup(response.text, "lxml")
self.mobSFAPIKey=soup.find("p", { "class" : "lead" }).find("strong").find("code").text
isSuccess=True
except:
print ("Failed to initiate conection with MobSF!!")
return isSuccess
def ExecuteCommand(self, cmd, isADB=True, syncCall=True):
command = ""
output = ""
if isADB:
command = "adb " + cmd
else:
command = cmd
print (cmd)
p = subprocess.Popen(command, stdout=subprocess.PIPE, shell=True)
if syncCall:
output = p.communicate()[0].decode("utf-8", errors="ignore")
p_status = p.wait()
return output