forked from EONRaider/violent-python3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdup.py
73 lines (61 loc) · 1.75 KB
/
dup.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
from scapy.layers.dot11 import RadioTap, Dot11
from scapy.layers.l2 import SNAP, LLC
from scapy.layers.inet import IP, UDP
def dup_radio(pkt):
r_pkt = pkt.getlayer(RadioTap)
version = r_pkt.version
pad = r_pkt.pad
present = r_pkt.present
notdecoded = r_pkt.notdecoded
n_pkt = RadioTap(version=version, pad=pad, present=present,
notdecoded=notdecoded)
return n_pkt
def dup_dot11(pkt):
d_pkt = pkt.getlayer(Dot11)
subtype = d_pkt.subtype
_type = d_pkt.type
proto = d_pkt.proto
fc_field = d_pkt.FCfield
_id = d_pkt.ID
addr1 = d_pkt.addr1
addr2 = d_pkt.addr2
addr3 = d_pkt.addr3
sc = d_pkt.SC
addr4 = d_pkt.addr4
n_pkt = Dot11(subtype=subtype, type=_type, proto=proto, FCfield=fc_field,
ID=_id, addr1=addr1, addr2=addr2, addr3=addr3, SC=sc,
addr4=addr4)
return n_pkt
def dup_snap(pkt):
s_pkt = pkt.getlayer(SNAP)
oui = s_pkt.OUI
code = s_pkt.code
n_pkt = SNAP(OUI=oui, code=code)
return n_pkt
def dup_LLC(pkt):
l_pkt = pkt.getlayer(LLC)
dsap = l_pkt.dsap
ssap = l_pkt.ssap
ctrl = l_pkt.ctrl
n_pkt = LLC(dsap=dsap, ssap=ssap, ctrl=ctrl)
return n_pkt
def dup_IL(pkt):
i_pkt = pkt.getlayer(IP)
version = i_pkt.version
tos = i_pkt.tos
_id = i_pkt.id
flags = i_pkt.flags
ttl = i_pkt.ttl
proto = i_pkt.proto
src = i_pkt.src
dst = i_pkt.dst
options = i_pkt.options
n_pkt = IP(version=version, id=_id, tos=tos, flags=flags, ttl=ttl,
proto=proto, src=src, dst=dst, options=options)
return n_pkt
def dup_UDP(pkt):
u_pkt = pkt.getlayer(UDP)
sport = u_pkt.sport
dport = u_pkt.dport
n_pkt = UDP(sport=sport, dport=dport)
return n_pkt