Interactive Console
Quick access to PacketGen methods
pg> pkt = gen('Eth', src: '00:00:00:00:00:01', dst: '00:00:00:00:00:02')
=> -- PacketGen::Packet -------------------------------------------------
---- PacketGen::Header::Eth ------------------------------------------
MacAddr dst: 00:00:00:00:00:02
MacAddr src: 00:00:00:00:00:01
Int16 ethertype: 0 (0x0000)
pg>
pg> parse(pkt.to_s, first_header: 'Eth')
=> -- PacketGen::Packet -------------------------------------------------
---- PacketGen::Header::Eth ------------------------------------------
MacAddr dst: 00:00:00:00:00:02
MacAddr src: 00:00:00:00:00:01
Int16 ethertype: 0 (0x0000)
pg> write 'packet.pcapng', [pkt]
pg> pkts = read('packet.pcapng')
=> [-- PacketGen::Packet -------------------------------------------------
---- PacketGen::Header::Eth ------------------------------------------
MacAddr dst: 00:00:00:00:00:02
MacAddr src: 00:00:00:00:00:01
Int16 ethertype: 0 (0x0000)
]
pg>
pg> capture { |pkt| p pkt }local configuration
Utils
Last updated