-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsettings.py
426 lines (381 loc) · 12.5 KB
/
settings.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
# noqa: E800
"""
Django settings for MobSF project.
MobSF and Django settings
"""
import imp
import logging
import os
from MobSF.utils import (find_java_binary, first_run,
get_mobsf_home)
logger = logging.getLogger(__name__)
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# MOBSF CONFIGURATIONS
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
MOBSF_VER = 'v2.0.2 Beta'
BANNER = """
__ __ _ ____ _____ ____ ___
| \/ | ___ | |__/ ___|| ___| __ _|___ \ / _ \
| |\/| |/ _ \| '_ \___ \| |_ \ \ / / __) || | | |
| | | | (_) | |_) |__) | _| \ V / / __/ | |_| |
|_| |_|\___/|_.__/____/|_| \_/ |_____(_)___/
""" # noqa: W291
# ASCII Standard
# ==============================================
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# ==========MobSF Home Directory=================
USE_HOME = False
# True : All Uploads/Downloads will be stored in user's home directory
# False : All Uploads/Downloads will be stored in MobSF root directory
# If you need multiple users to share the scan results set this to False
# ===============================================
MobSF_HOME = get_mobsf_home(USE_HOME)
# Logs Directory
LOG_DIR = os.path.join(MobSF_HOME, 'logs/')
# Download Directory
DWD_DIR = os.path.join(MobSF_HOME, 'downloads/')
# Screenshot Directory
SCREEN_DIR = os.path.join(MobSF_HOME, 'downloads/screen/')
# Upload Directory
UPLD_DIR = os.path.join(MobSF_HOME, 'uploads/')
# Database Directory
DB_DIR = os.path.join(MobSF_HOME, 'db.sqlite3')
# Tools Directory
TOOLS_DIR = os.path.join(BASE_DIR, 'DynamicAnalyzer/tools/')
# Secret File
SECRET_FILE = os.path.join(MobSF_HOME, 'secret')
# Database
# https://docs.djangoproject.com/en/dev/ref/settings/#databases
# Sqlite3 suport
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': DB_DIR,
},
}
# End Sqlite3 support
# Postgres DB - Install psycopg2
"""
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'mobsf',
'USER': 'postgres',
'PASSWORD': '',
'HOST': 'localhost',
'PORT': '',
}
}
# End Postgres support
"""
# ===============================================
# ==========LOAD CONFIG FROM MobSF HOME==========
try:
# Update Config from MobSF Home Directory
if USE_HOME:
USER_CONFIG = os.path.join(MobSF_HOME, 'config.py')
sett = imp.load_source('user_settings', USER_CONFIG)
locals().update(
{k: v for k, v in list(sett.__dict__.items())
if not k.startswith('__')})
CONFIG_HOME = True
else:
CONFIG_HOME = False
except Exception:
logger.exception('Reading Config')
CONFIG_HOME = False
# ===============================================
# ===MOBSF SECRET GENERATION AND DB MIGRATION====
SECRET_KEY = first_run(SECRET_FILE, BASE_DIR, MobSF_HOME)
# =============================================
# =============ALLOWED EXTENSIONS================
ALLOWED_EXTENSIONS = {
'.txt': 'text/plain',
'.png': 'image/png',
'.zip': 'application/zip',
'.tar': 'application/x-tar',
}
# ===============================================
# =============ALLOWED MIMETYPES=================
APK_MIME = [
'application/octet-stream',
'application/vnd.android.package-archive',
'application/x-zip-compressed',
'binary/octet-stream',
]
IPA_MIME = [
'application/iphone',
'application/octet-stream',
'application/x-itunes-ipa',
'application/x-zip-compressed',
'binary/octet-stream',
]
ZIP_MIME = [
'application/zip',
'application/octet-stream',
'application/x-zip-compressed',
'binary/octet-stream',
]
APPX_MIME = [
'application/octet-stream',
'application/vns.ms-appx',
'application/x-zip-compressed',
]
# ===============================================
# ============DJANGO SETTINGS =================
DEBUG = True
DJANGO_LOG_LEVEL = DEBUG
ALLOWED_HOSTS = ['127.0.0.1', 'mobsf', '*']
# Application definition
INSTALLED_APPS = (
# 'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'StaticAnalyzer',
'DynamicAnalyzer',
'MobSF',
'MalwareAnalyzer',
)
MIDDLEWARE_CLASSES = (
'django.middleware.security.SecurityMiddleware',
'whitenoise.middleware.WhiteNoiseMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
)
MIDDLEWARE = (
'MobSF.views.api.rest_api_middleware.RestApiAuthMiddleware',
)
ROOT_URLCONF = 'MobSF.urls'
WSGI_APPLICATION = 'MobSF.wsgi.application'
LANGUAGE_CODE = 'en-us'
TIME_ZONE = os.getenv('TIME_ZONE', 'UTC')
USE_I18N = True
USE_L10N = True
USE_TZ = True
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'APP_DIRS': True,
'DIRS':
[
os.path.join(BASE_DIR, 'templates'),
],
'OPTIONS':
{
'debug': True,
},
},
]
MEDIA_ROOT = os.path.join(BASE_DIR, 'uploads')
MEDIA_URL = '/uploads/'
STATICFILES_DIRS = [os.path.join(BASE_DIR, 'static')]
STATIC_URL = '/static/'
STATIC_ROOT = '/static/'
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
# 256MB
DATA_UPLOAD_MAX_MEMORY_SIZE = 268435456
# ===================
# USER CONFIGURATION
# ===================
if CONFIG_HOME:
logger.info('Loading User config from: %s', USER_CONFIG)
else:
"""
IMPORTANT
If 'USE_HOME' is set to True,
then below user configuration settings are not considered.
The user configuration will be loaded from
config.py in MobSF Home directory.
"""
# ^CONFIG-START^: Do not edit this line
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# MOBSF USER CONFIGURATIONS
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# -------------------------
# STATIC ANALYZER SETTINGS
# -------------------------
# ==========ANDROID SKIP CLASSES==========================
# Common third party classes that will be skipped during static analysis
SKIP_CLASSES = [
r'com[\\\/]{1}google[\\\/]{1}',
r'com[\\\/]{1}android[\\\/]{1}',
r'android[\\\/]{1}content[\\\/]{1}',
r'android[\\\/]{1}support[\\\/]{1}',
r'android[\\\/]{1}arch[\\\/]{1}',
r'kotlin[\\\/]{1}',
r'okhttp2[\\\/]{1}', r'okhttp3[\\\/]{1}',
r'com[\\\/]{1}squareup[\\\/]{1}okhttp[\\\/]{1}',
r'com[\\\/]{1}twitter[\\\/]{1}',
r'twitter4j[\\\/]{1}',
r'org[\\\/]{1}apache[\\\/]{1}',
r'oauth[\\\/]{1}signpost[\\\/]{1}',
r'org[\\\/]{1}chromium[\\\/]{1}',
r'com[\\\/]{1}facebook[\\\/]{1}',
r'org[\\\/]{1}spongycastle[\\\/]{1}',
]
# ==============================================
# ======WINDOWS STATIC ANALYSIS SETTINGS ===========
# Private key
WINDOWS_VM_SECRET = 'MobSF/windows_vm_priv_key.asc'
# IP and Port of the MobSF Windows VM
# example: WINDOWS_VM_IP = '127.0.0.1' ;noqa E800
WINDOWS_VM_IP = None
WINDOWS_VM_PORT = '8000'
# ==================================================
# ==============3rd Party Tools=================
"""
If you want to use a different version of 3rd party tools used by MobSF.
You can do that by specifying the path here. If specified, MobSF will run
the tool from this location.
"""
# Android 3P Tools
JADX_BINARY = ''
BACKSMALI_BINARY = ''
APKTOOL_BINARY = ''
ADB_BINARY = ''
# iOS 3P Tools
OTOOL_BINARY = ''
JTOOL_BINARY = ''
CLASSDUMPZ_BINARY = ''
CLASSDUMP_SWIFT_BINARY = ''
# COMMON
JAVA_DIRECTORY = ''
VBOXMANAGE_BINARY = ''
PYTHON3_PATH = ''
"""
Examples:
JAVA_DIRECTORY = 'C:/Program Files/Java/jdk1.7.0_17/bin/'
JAVA_DIRECTORY = '/usr/bin/'
VBOXMANAGE_BINARY = '/usr/bin/VBoxManage'
PYTHON3_PATH = 'C:/Users/Ajin/AppData/Local/Programs/Python/Python35-32/'
JADX_BINARY = 'C:/Users/Ajin/AppData/Local/Programs/jadx/bin/jadx.bat'
JADX_BINARY = '/Users/ajin/jadx/bin/jadx'
"""
# ==========================================================
# -------------------------
# DYNAMIC ANALYZER SETTINGS
# -------------------------
# =======ANDROID DYNAMIC ANALYSIS SETTINGS===========
ANALYZER_IDENTIFIER = ''
FRIDA_TIMEOUT = 4
# ==============================================
# ================HTTPS PROXY ===============
PROXY_PORT = 1337 # Proxy Port
ROOT_CA = '0025aabb.0'
# ===================================================
# ========UPSTREAM PROXY SETTINGS ==============
# If you are behind a Proxy
UPSTREAM_PROXY_ENABLED = False
UPSTREAM_PROXY_SSL_VERIFY = True
UPSTREAM_PROXY_TYPE = 'http'
UPSTREAM_PROXY_IP = '127.0.0.1'
UPSTREAM_PROXY_PORT = 3128
UPSTREAM_PROXY_USERNAME = ''
UPSTREAM_PROXY_PASSWORD = ''
# ==============================================
# --------------------------
# MALWARE ANALYZER SETTINGS
# --------------------------
DOMAIN_MALWARE_SCAN = True
APKID_ENABLED = False
# ==============================================
# -----External URLS--------------------------
MALWARE_DB_URL = 'http://www.malwaredomainlist.com/mdlcsv.php'
VIRUS_TOTAL_BASE_URL = 'https://www.virustotal.com/vtapi/v2/file/'
TRACKERS_URL = 'https://reports.exodus-privacy.eu.org'
TRACKERS_DB_URL = '{}/api/trackers'.format(TRACKERS_URL)
# ========DISABLED COMPONENTS===================
# ----------VirusTotal--------------------------
VT_ENABLED = False
VT_API_KEY = 'XXXXXXXXXXXXXX'
VT_UPLOAD = False
# Before setting VT_ENABLED to True,
# Make sure VT_API_KEY is set to your VirusTotal API key
# register at: https://www.virustotal.com/#/join-us
# You can get your API KEY from:
# https://www.virustotal.com/en/user/<username>/apikey/
# Files will be uploaded to VirusTotal
# if VT_UPLOAD is set to True.
# ==============================================
# ^CONFIG-END^: Do not edit this line
# ============JAVA SETTINGS======================
JAVA_BINARY = find_java_binary()
# ===============================================
# Better logging
LOGGING = {
'version': 1,
'disable_existing_loggers': True,
'formatters': {
'standard': {
'format': '[%(levelname)s] %(asctime)-15s - %(message)s',
'datefmt': '%d/%b/%Y %H:%M:%S',
},
'color': {
'()': 'colorlog.ColoredFormatter',
'format':
'%(log_color)s[%(levelname)s] %(asctime)-15s - %(message)s',
'datefmt': '%d/%b/%Y %H:%M:%S',
'log_colors': {
'DEBUG': 'cyan',
'INFO': 'green',
'WARNING': 'yellow',
'ERROR': 'red',
'CRITICAL': 'red,bg_white',
},
},
},
'handlers': {
'logfile': {
'level': 'DEBUG',
'class': 'logging.FileHandler',
'filename': os.path.join(MobSF_HOME, 'logs', 'debug.log'),
'formatter': 'standard',
},
'console': {
'level': 'DEBUG',
'class': 'logging.StreamHandler',
'formatter': 'color',
},
},
'loggers': {
'django': {
'handlers': ['console', 'logfile'],
'level': 'DEBUG',
'propagate': True,
},
'django.db.backends': {
'handlers': ['console', 'logfile'],
# DEBUG will log all queries, so change it to WARNING.
'level': 'INFO',
'propagate': False, # Don't propagate to other handlers
},
'MobSF': {
'handlers': ['console', 'logfile'],
'level': 'DEBUG',
'propagate': False,
},
'StaticAnalyzer': {
'handlers': ['console', 'logfile'],
'level': 'DEBUG',
'propagate': False,
},
'MalwareAnalyzer': {
'handlers': ['console', 'logfile'],
'level': 'DEBUG',
'propagate': False,
},
'DynamicAnalyzer': {
'handlers': ['console', 'logfile'],
'level': 'DEBUG',
'propagate': False,
},
},
}