Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python3
- import sys
- import random
- from threading import Thread
- import scapy.all as scapy
- ifaces = sys.argv[1:]
- print(str(ifaces))
- def randomMAC():
- mac = [ random.randint(0x00, 0xff),
- random.randint(0x00, 0xff),
- random.randint(0x00, 0xff),
- random.randint(0x00, 0xff),
- random.randint(0x00, 0xff),
- random.randint(0x00, 0xff) ];
- # unicast
- mac[0] &= 0xFE
- # locally assigned
- mac[0] |= 2
- return "{0:02x}:{1:02x}:{2:02x}:{3:02x}:{4:02x}:{5:02x}".format(
- mac[0], mac[1], mac[2], mac[3], mac[4], mac[5])
- class Sender(Thread):
- def __init__(self, iface):
- Thread.__init__(self)
- self.iface = iface
- self.socket = scapy.conf.L2socket(iface=iface)
- def run(self):
- while True:
- pkt = scapy.Ether(src=randomMAC(), dst=randomMAC())/scapy.IP(src="10.0.0.254", dst="10.0.0.105")/scapy.UDP(dport=random.randint(1, 65535), sport=random.randint(1, 65535))
- self.socket.send(pkt)
- for iface in ifaces:
- Sender(iface).start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement