Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from simple_ostinato import Drone
- from simple_ostinato.protocols import Mac, Ethernet, IPv4, Payload
- import time, sys
- # connect to the drone instance that runs on localhost
- drone = Drone('localhost')
- drone.fetch_ports()
- port=drone.ports[0]
- stream = port.add_stream()
- # configure the stream
- stream.name = 'a_stream'
- stream.unit = 'PACKETS'
- stream.mode = 'FIXED'
- stream.next = 'STOP'
- stream.num_packets = 1
- stream.packets_per_sec = 100
- stream.is_enabled = True
- macs = open('macaddresses2.list','r')
- for mac_i, mac in enumerate(macs):
- mac = mac.replace('.','')
- mac = ":".join([mac[i:i+2] for i in range(0, len(mac), 2)])[:-2]
- print mac
- stream.layers = [
- Mac(source=mac, destination='00:01:02:03:04:05'),
- Ethernet(ether_type=0x800),
- IPv4(source='1.1.1.1', destination='2.2.2.2'),
- Payload()]
- stream.save()
- port.start_send()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement