Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python3
- import sys
- import random
- 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])
- sockets = []
- for iface in ifaces:
- sockets.append(scapy.conf.L2socket(iface=iface))
- while True:
- for socket in sockets:
- 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))
- socket.send(pkt)
Add Comment
Please, Sign In to add comment