teknoraver

sender

Jul 2nd, 2018
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.83 KB | None | 0 0
  1. #!/usr/bin/python3
  2.  
  3. import sys
  4. import random
  5. import scapy.all as scapy
  6.  
  7. ifaces = sys.argv[1:]
  8.  
  9. print(str(ifaces))
  10.  
  11. def randomMAC():
  12.     mac = [ random.randint(0x00, 0xff),
  13.         random.randint(0x00, 0xff),
  14.         random.randint(0x00, 0xff),
  15.         random.randint(0x00, 0xff),
  16.         random.randint(0x00, 0xff),
  17.         random.randint(0x00, 0xff) ];
  18.  
  19.     # unicast
  20.     mac[0] &= 0xFE
  21.     # locally assigned
  22.     mac[0] |= 2
  23.  
  24.     return "{0:02x}:{1:02x}:{2:02x}:{3:02x}:{4:02x}:{5:02x}".format(
  25.         mac[0], mac[1], mac[2], mac[3], mac[4], mac[5])
  26.  
  27. sockets = []
  28.  
  29. for iface in ifaces:
  30.     sockets.append(scapy.conf.L2socket(iface=iface))
  31.  
  32. while True:
  33.     for socket in sockets:
  34.         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))
  35.         socket.send(pkt)
Add Comment
Please, Sign In to add comment