Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from scapy.all import *
- import random
- def coin():
- return random.random() > 0.5
- def send_random_packets(count, iface):
- for _ in range(count):
- p = Ether(src=RandMAC(), dst=RandMAC())
- if coin():
- if coin():
- p /= IP(src=RandIP(), dst=RandIP())
- else:
- p /= IPv6(src=RandIP6(), dst=RandIP6())
- protocol = TCP if coin() else UDP
- p /= protocol(sport=RandShort(), dport=RandShort())
- else:
- p /= ARP(hwsrc=RandMAC(), psrc=RandIP(), hwdst='00:00:00:00:00:00', pdst= RandIP())
- sendp(p, iface=iface)
- send_random_packets(100, 'a-red')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement