-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.py
592 lines (590 loc) · 35.4 KB
/
config.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
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
from modules import apk_analyzer, apk_install, app_logs, backup, battery, connectivity, file_transfer, merge_apks, mirroring, mobsf, proxy, signature, useful_stuff, utility
OPTIONS = {
'main': {
"description":['',],
'children':{
"apk_analysis": {
'description': [
'Analysis of the APKs related to the application:',
' > signature schema verifier',
' > apk decompiled with apktool',
' > search for common Root Detection strings in smali files',
' > search for common Certificate Pinning strings or SHA1-SHA256 hash string in smali files'
],
'children': {
"from_apk_on_pc" : {
'description': ["Write the following two strings (separated by space):",
" > the path of the apk on your PC (or the folder with all the APKs related to the app)",
" > the path of the folder where the apk will be decompiled"
],
'children': {
"back" : dict(),
},
'function' : apk_analyzer.apk_analysis_from_file
},
"from_mobile_device" : {
'description': ["Write the following two strings (separated by space):",
" > the app id or a part of the app name to be extracted and analysed"
" > the path of the folder where the apk will be decompiled"
],
'children': {
"back" : dict(),
},
'function': apk_analyzer.apk_analysis_from_device
},
'back' : dict()
}
},
"apk_compiling": {
'description': ['Compile an apk file from the folder with decompiled and modified code',],
'children': {
"compile": {
'description': ['Compile an apk file from the folder with decompiled and modified code',],
'children': {
'back' : dict(),
},
'function' : apk_analyzer.apk_compile_from_folder
},
"compile_and_sign": {
'description': ['Compile and sign an apk file from the folder with decompiled and modified code',],
'children': {
'back' : dict(),
},
'function' : apk_analyzer.apk_compile_and_sign_from_folder
},
'back' : dict(),
},
},
"apk_decompiling": {
'description': ['Decompile an apk file',],
'children': {
"from_apk_on_pc" : {
'description': ["Decompile the apk file into smali code. Write the following two strings (separated by space):",
" > the path of the apk on your PC (or the folder with all the APKs related to the app)",
" > the path of the folder where the apk will be decompiled"],
'children': {
"back" : dict(),
},
'function' : apk_analyzer.apk_decompiler_from_file
},
"from_mobile_device" : {
'description': ["Write the following two strings (separated by space):",
" > the app id or a part of the app name to be extracted and analysed"
" > the path of the folder where the apk will be decompiled"],
'children': {
"back" : dict(),
},
'function': apk_analyzer.apk_decompiler_from_device
},
'back' : dict()
}
},
"apk_to_jar": {
'description': ['Convert the apk to a jar file',],
'children': {
"from_apk_on_pc" : {
'description': ["Convert an apk file on the PC to a jar file"],
'children': {
"create_jar_file":{
'description': ["Convert the apk to a jar file. Write the following two strings (separated by space):",
" > the path of the apk on your PC (or the folder with all the APKs related to the app)",
" > the path of the folder where the JAR file will be stored"],
'children':{
"back":dict(),
},
'function': apk_analyzer.jar_from_file
},
"jadx_create_and_open_file":{
'description': ["Open the reversed apk in JADX-GUI. Write the path of the apk on your PC (or the folder with all the APKs related to the app)",],
'children':{
"back":dict(),
},
'function': apk_analyzer.jadx_from_file
},
"back" : dict(),
},
},
"from_mobile_device" : {
'description': ["Convert am apk from the mobile device to a jar file"],
'children': {
"create_jar_file":{
'description': ["Convert the apk to a jar file. Write the following two strings (separated by space):",
" > the app id or a part of the app name to be extracted and analysed",
" > the path of the folder where the apk will be decompiled"],
'children':{
"back":dict(),
},
'function': apk_analyzer.jar_from_device
},
"jadx_create_and_open_file":{
'description': ["Open the reversed apk in JADX-GUI. Write the app id or a part of the app name to be extracted and analysed",],
'children':{
"back":dict(),
},
'function': apk_analyzer.jadx_from_device
},
"back" : dict(),
},
},
'back' : dict()
}
},
"backup_and_data" : {
'description': ['Backup the mobile device or an application',],
'children': {
"backup_device" : {
'description': ["Backup the mobile device"],
'children': {
"back" : dict(),
},
'function' : backup.device_backup
},
"backup_specific_app" : {
'description': ["Backup a specific app, writing its app id or a keyword to identify it"],
'children': {
"back" : dict(),
},
'function': backup.app_backup
},
"backup_restore" : {
'description': ["Specify the backup file path on your system to be restored on the mobile device"],
'children': {
"back" : dict(),
},
'function': backup.restore_backup
},
"backup_to_folder" : {
'description': ["Specify the backup file path on your system to be extracted"],
'children': {
"back" : dict(),
},
'function': backup.tar_extract
},
"reset_app_data" : {
'description': ["Reset App data"],
'children': {
"back" : dict(),
},
'function': backup.app_data_reset
},
'back' : dict()
}
},
"download_from_mobile" : {
'description': ["Write the following two strings (separated by space):",
" > the path of the file/folder on the mobile device",
" > the PC folder (where the file will be downloaded)"],
'children': {
"back" : dict(),
},
'function': file_transfer.download_from_user_input
},
"force_app_stop" : {
'description': ["Write the app id of the mobile app or some keywords to identify it"],
'children': {
"back" : dict(),
},
'function': useful_stuff.force_app_stop
},
"install_uninstall" : {
'description': ['Install an app on the mobile device.',],
'children': {
"install_from_apk" : {
'description' : ["Write the path of the apk on your PC to be installed",],
'children': {
"back" : dict(),
},
'function': apk_install.install_from_apk
},
"install_from_playstore" : {
'description' : ["Write the app id of the app to be installed (the command prompt will be open)",],
'children': {
"back" : dict(),
},
'function': apk_install.install_from_playstore
},
"uninstall" : {
'description' : ["Write the app id of the app to be uninstalled",],
'children': {
"back" : dict(),
},
'function': apk_install.uninstall_app
},
"back" : dict()
}
},
"merge_apks": {
'description': ['Merge several APKs'],
'children': {
"from_directory" : {
'description' : ["Write the path of the directory with APKs to be merged",],
'children': {
"back" : dict(),
},
'function': merge_apks.merge_from_dir
},
"from_list" : {
'description' : ["Write the list of APKs paths to be merged (separated by spaces):",],
'children': {
"back" : dict(),
},
'function': merge_apks.merge_from_list
},
"back" : dict(),
},
},
"mobsf" : {
'description': ["Static Analysis of the APK using MobSF"],
'children': {
"from_apk_on_pc" : {
'description': ["Write the path of the apk on your PC to be analysed (or the folder with all the APKs related to the app)"],
'children': {
"back" : dict(),
},
'function' : mobsf.mobsf_from_file
},
"from_mobile_device" : {
'description': ["Write the app id or a part of the app name to be analysed",],
'children': {
"back" : dict(),
},
'function': mobsf.mobsf_from_device
},
"back" : dict(),
},
'function': file_transfer.download
},
"mirroring" : {
'description': ['Launch scrcpy for mobile device mirroring (Press any key to continue)',],
'children': {
"back" : dict(),
},
'function': mirroring.mirroring
},
"proxy" : {
'description': ['Set global proxy on the mobile device:',
' > using the current PC IP',
' > using another IP'],
'children': {
"get_current_proxy" : {
'description' : ["Press ENTER to see current proxy settings"],
'children': {
"back" : dict(),
},
'function': proxy.get_current_proxy_settings
},
"set_proxy_with_current_ip" : {
'description' : ["Write the port number for the proxy on the current PC",],
'children': {
"back" : dict(),
},
'function': proxy.set_current_pc_proxy
},
"set_proxy_with_other_ip" : {
'description' : ["Write the following values:",
" > IP address of the proxy",
" > port number of the proxy"],
'children': {
"back" : dict(),
},
'function': proxy.set_generic_proxy
},
"del_proxy" : {
'description' : ["Press ENTER to reset proxy configuration"],
'children': {
"back" : dict(),
},
'function': proxy.del_proxy
},
"back" : dict(),
},
'function': mirroring.mirroring
},
"sign_apk":{
'description': ['Sign an apk on your PC. Write the path of the apk you want to test'],
'children': {
"back" : dict()
},
'function': signature.sign_apk
},
"track_logs" : {
'description': ['Process for logs gathering:',
' > automated mode: the application will be opened by the script',
' > manual mode: the application needs to be launched by the user'],
'children': {
"all_logs" : {
'description' : ["Write the app id or a part of the app name to be launched",],
'children': {
"back" : dict(),
},
'function': app_logs.all_logs
},
"all_crash_logs" : {
'description' : ["Write the app id or a part of the app name to be launched",],
'children': {
"back" : dict(),
},
'function': app_logs.all_crash_logs
},
"app_logs" : {
'description' : ["Write the app id or a part of the app name to be launched",],
'children': {
"back" : dict(),
},
'function': app_logs.app_logs
},
"app_crash_logs" : {
'description' : ["Write the app id or a part of the app name to be launched",],
'children': {
"back" : dict(),
},
'function': app_logs.app_crash_logs
},
"back" : dict()
}
},
"upload_to_mobile" : {
'description': ["Write the following two strings (separated by space):",
" > the path of the file/folder on the PC",
" > the mobile device folder (where the file will be uploaded)"],
'children': {
"back" : dict(),
},
'function': file_transfer.upload
},
"useful_stuffs" : {
'description': ['Process for logs gathering:',
' > automated mode: the application will be opened by the script',
' > manual mode: the application needs to be launched by the user'],
'children': {
"device_info": {
'description' : ["Get mobile device information",],
'children': {
"apps_list": {
'description' : ["Get list of all the installed apps",],
'children': {
"3rd_party_apps": {
'description' : ["Get list of all the installed 3rd-party apps",],
'children': {
"back" : dict(),
},
'function': useful_stuff.third_party_apps
},
"system_apps": {
'description' : ["Get list of all the installed system apps",],
'children': {
"back" : dict(),
},
'function': useful_stuff.system_apps
},
"back" : dict(),
},
},
"cpu_info": {
'description' : ["Get CPU information",],
'children': {
"back" : dict(),
},
'function': useful_stuff.cpu_info
},
"general_info": {
'description' : ["Get mobile device general information",],
'children': {
"back" : dict(),
},
'function': useful_stuff.general_info
},
"network_info": {
'description' : ["Get Network information",],
'children': {
"back" : dict(),
},
'function': useful_stuff.network_info
},
"ram_info": {
'description' : ["Get RAM information",],
'children': {
"back" : dict(),
},
'function': useful_stuff.ram_info
},
"storage_info": {
'description' : ["Get Storage information",],
'children': {
"back" : dict(),
},
'function': useful_stuff.storage_info
},
"back" : dict(),
},
},
"battery_saver" : {
'description' : ["Battery Saver mode",],
'children': {
"off" : {
'description' : ["Turn off battery saver mode",],
'children': {
"back" : dict(),
},
'function': battery.battery_saver_off
},
"on" : {
'description' : ["Turn on battery saver mode",],
'children': {
"back" : dict(),
},
'function': battery.battery_saver_on
},
"back" : dict(),
}
},
"battery_status" : {
'description' : ["Battery Status",],
'children': {
"back" : dict(),
},
'function': battery.check_battery_status
},
"do_not_disturb_mode" : {
'description' : ["Do Not Disturb mode",],
'children': {
"off" : {
'description' : ["Turn off Do Not Disturb mode",],
'children': {
"back" : dict(),
},
'function': connectivity.donotdisturb_disabled
},
"alarms_only" : {
'description' : ["Turn on Do Not Disturb mode with alarms only",],
'children': {
"back" : dict(),
},
'function': connectivity.donotdisturb_alarms_only
},
"priority_only" : {
'description' : ["Turn on Do Not Disturb mode with priority only",],
'children': {
"back" : dict(),
},
'function': connectivity.donotdisturb_priority_only
},
"total_silence" : {
'description' : ["Turn on Do Not Disturb mode with total silence",],
'children': {
"back" : dict(),
},
'function': connectivity.donotdisturb_total_silence
},
"back" : dict(),
}
},
"connectivity" : {
'description' : ["Connectivity options management (Wifi, airplane mode)",],
'children': {
"wifi_off" : {
'description' : ["Turn off Wifi option",],
'children': {
"back" : dict(),
},
'function': connectivity.disable_wifi
},
"wifi_on" : {
'description' : ["Turn on Wifi option",],
'children': {
"back" : dict(),
},
'function': connectivity.enable_wifi
},
"airplane_off" : {
'description' : ["Turn off Airplane mode",],
'children': {
"back" : dict(),
},
'function': connectivity.disable_airplane_mode
},
"airplane_on" : {
'description' : ["Turn on Airplane mode",],
'children': {
"back" : dict(),
},
'function': connectivity.enable_airplane_mode
},
"back" : dict(),
}
},
"screenshot_video" : {
'description' : ["Screenshot/Video on the mobile device",],
'children': {
"screenshot" : {
'description' : ["Screenshot.","Press enter to continue...",],
'children': {
"back" : dict(),
},
'function': useful_stuff.screenshot
},
"video" : {
'description' : ["Video","Press enter to start recording...",],
'children': {
"back" : dict(),
},
'function': useful_stuff.record_video
},
"back" : dict(),
},
'function': app_logs.all_logs
},
"shutdown_reboot" : {
'description' : ["Reboot the device with several options",],
'children': {
"reboot" : {
'description' : ["Shutdown the mobile device.","Press enter to continue...",],
'children': {
"back" : dict(),
},
'function': useful_stuff.shutdown
},
"reboot" : {
'description' : ["Reboot the mobile device.","Press enter to continue...",],
'children': {
"back" : dict(),
},
'function': useful_stuff.reboot
},
"reboot_recovery" : {
'description' : ["Reboot the mobile device in recovery mode.","Press enter to continue...",],
'children': {
"back" : dict(),
},
'function': useful_stuff.reboot_recovery
},
"reboot_bootloader" : {
'description' : ["Reboot the mobile device in bootloader mode.","Press enter to continue...",],
'children': {
"back" : dict(),
},
'function': useful_stuff.reboot_bootloader
},
"back" : dict(),
},
},
"back" : dict()
}
},
}
}
}
STYLE = {
'section': 'bg:#ffffff bold',
'section1': 'bg:#dd0000 bold white',
'section2': 'bg:#dd5500 bold white',
'section3': 'bg:#dd8800 bold white',
'option': 'ansigreen bold',
'descr': 'ansiyellow bold',
'error':'bg:#ff0000 bold white',
'completion-menu.completion': 'bg:#008888 #ffffff',
'completion-menu.completion.current': 'bg:#00aaaa #000000',
'scrollbar.background': 'bg:#88aaaa',
'scrollbar.button': 'bg:#222222',
'space':'white'
}