Skip to content

Examples

himanshu edited this page Aug 27, 2023 · 19 revisions

Getting Started

Below is the workflow to get started on using a module and the respective sub-modules.

To invoke a module from the primary menu, use the index numbers denoted next to the module name.

$ sudo python3 byteosaurus_hex.py

==================================================
Scapy based packet generator
==================================================

1 -- ICMP
2 -- ARP
3 -- IGMP
4 -- Multicast
5 -- VXLAN
6 -- Load PCAP File
7 -- Exit

Enter your choice (1-7):

For example to invoke the VXLAN module

  • Press 5 then hit Enter
  • Provide the number of flows you want to build, minimum 1 flow is required.
    • For each flow you will have the option to select the:
      • Number / count of packets to send
      • Egress / Outgoing interface from which the packets will be sent.
  • Select the sub-module from the menu option.
$ sudo python3 byteosaurus_hex.py

==================================================
Scapy based packet generator
==================================================

1 -- ICMP
2 -- ARP
3 -- IGMP
4 -- Multicast
5 -- VXLAN
6 -- Load PCAP File
7 -- Exit

Enter your choice (1-7): 5
Enter the number of flows > 2

Building flow number [ 1 ]:

Packet Type:

1 -- Vxlan - Inner ICMP
2 -- Vxlan - Inner UDP
3 -- Vxlan - Inner TCP
4 -- Vxlan - Inner ARP

Enter your choice (1-3) > 1
Generate random Vxlan ICMP Packet? (y/n) >

For detailed examples per module, please refer to the module specific documentation.

Module Examples

ICMP

The ICMP module allows users to generate following ICMP packets:

  • ICMP Echo Request
  • ICMP Echo Response

This module supports:

  • Multiple flows
  • Packet count & Outgoing interface per flow
  • Random automated packet generation
  • Full manual packet generation
  • Adding VLAN tags

ICMP Echo Request

Random packet generation

Reveal Output

$ sudo python3 byteosaurus_hex.py

==================================================
Scapy based packet generator
==================================================

1 -- ICMP
2 -- ARP
3 -- IGMP
4 -- Multicast
5 -- VXLAN
6 -- Load PCAP File
7 -- Exit

Enter your choice (1-7): 1
Enter the number of flows > 1

Building flow number [ 1 ]:

Random ICMP Packet? (y/n) > y
ICMP Type (req/reply) > req
Count (c for continous) > 5
Source Interface > et48
2023-08-27 09:24:03,984: INFO: ICMP packet built
###[ Ethernet ]###
  dst       = e1:5e:04:ef:37:6f
  src       = c4:ca:2b:b1:f6:39
  type      = IPv4
###[ IP ]###
     version   = 4
     ihl       = None
     tos       = 0x0
     len       = None
     id        = 1
     flags     =
     frag      = 0
     ttl       = 162
     proto     = icmp
     chksum    = None
     src       = 172.17.229.151
     dst       = 172.29.92.217
     \options   \
###[ ICMP ]###
        type      = echo-request
        code      = 0
        chksum    = None
        id        = 0x5ff
        seq       = 0x0
        unused    = ''
###[ Raw ]###
           load      = 'Ȭ8Ԃ\\xd3~\x1dυ\\xfb\\xbfǜ\\xd7H\\x8c\\xeb\\xd8,\\x87\\x90R\\xbbfLj5k\\xe1\\xbe}\\xd6/aa\\xc7\\xfd>U7\\xeaT\\x92_\\xb5l\\x9c\\xaem\\xd9\\xeb\\xf7\\xe7lv5\\x8f\\xebؕ 2_'

2023-08-27 09:24:03,985: INFO: Sending out all flows
2023-08-27 09:24:04,030: INFO: Done sending all flows
2023-08-27 09:24:04,063: INFO: Module completed
Reveal Packet

Ethernet II, Src: AristaNe_b1:f6:39 (c4:ca:2b:b1:f6:39), Dst: e1:5e:04:ef:37:6f (e1:5e:04:ef:37:6f)
    Destination: e1:5e:04:ef:37:6f (e1:5e:04:ef:37:6f)
    Source: AristaNe_b1:f6:39 (c4:ca:2b:b1:f6:39)
    Type: IPv4 (0x0800)
Internet Protocol Version 4, Src: 172.17.229.151, Dst: 172.29.92.217
    0100 .... = Version: 4
    .... 0101 = Header Length: 20 bytes (5)
    Differentiated Services Field: 0x00 (DSCP: CS0, ECN: Not-ECT)
    Total Length: 92
    Identification: 0x0001 (1)
    000. .... = Flags: 0x0
    ...0 0000 0000 0000 = Fragment Offset: 0
    Time to Live: 162
    Protocol: ICMP (1)
    Header Checksum: 0x7e00 [validation disabled]
    [Header checksum status: Unverified]
    Source Address: 172.17.229.151
    Destination Address: 172.29.92.217
Internet Control Message Protocol
    Type: 8 (Echo (ping) request)
    Code: 0
    Checksum: 0xdecb [correct]
    [Checksum Status: Good]
    Identifier (BE): 1535 (0x05ff)
    Identifier (LE): 65285 (0xff05)
    Sequence Number (BE): 0 (0x0000)
    Sequence Number (LE): 0 (0x0000)
    [No response seen]
    Data (64 bytes)

ICMP Echo Response

Manual packet generation with VLAN Tag

Reveal Output

==================================================
Scapy based packet generator
==================================================

1 -- ICMP
2 -- ARP
3 -- IGMP
4 -- Multicast
5 -- VXLAN
6 -- Load PCAP File
7 -- Exit

Enter your choice (1-7): 1
Enter the number of flows > 1

Building flow number [ 1 ]:

Random ICMP Packet? (y/n) > n
ICMP Type (req/reply) > reply
Source MAC (de:ad:be:ef:ca:fe) > 00:1c:58:23:64:c1
Destination MAC > 00:15:62:64:33:41
Source IP > 192.168.14.10
Destination IP > 192.168.14.20
TTL > 10
Tag (y/n) > y
VLAN Tag (x,y) > 1,20
Count (c for continous) > 5
Source Interface > et48
2023-08-27 09:49:54,678: INFO: ICMP Packet built
###[ Ethernet ]###
  dst       = 00:15:62:64:33:41
  src       = 00:1c:58:23:64:c1
  type      = n_802_1Q
###[ 802.1Q ]###
     prio      = 0
     id        = 0
     vlan      = 1
     type      = n_802_1Q
###[ 802.1Q ]###
        prio      = 0
        id        = 0
        vlan      = 20
        type      = IPv4
###[ IP ]###
           version   = 4
           ihl       = None
           tos       = 0x0
           len       = None
           id        = 1
           flags     =
           frag      = 0
           ttl       = 10
           proto     = icmp
           chksum    = None
           src       = 192.168.14.10
           dst       = 192.168.14.20
           \options   \
###[ ICMP ]###
              type      = echo-reply
              code      = 0
              chksum    = None
              id        = 0x70c
              seq       = 0x0
              unused    = ''
###[ Raw ]###
                 load      = '\\xabqT\\x8a\\x85.fF\\xf64\\xbf:e\\xdcgb\x15\\xa5-\\xfaDZz\\x83\\xfa\\xe6\\xa90\\xd9\\xe0\\xcf\n@\n\x10\\xef\'\\xf9\\xa5\\xd0L\\x80\\xdc\\xc4L"\\xf4\\xf8\x0ef+\\xfb\\xa8_\\xeaꔖ\\x94\x06%\\xe16i'

2023-08-27 09:49:54,679: INFO: Sending out all flows
2023-08-27 09:49:54,730: INFO: Done sending all flows
2023-08-27 09:49:54,762: INFO: Module completed
Reveal Packet

Ethernet II, Src: Cisco_23:64:c1 (00:1c:58:23:64:c1), Dst: Cisco_64:33:41 (00:15:62:64:33:41)
    Destination: Cisco_64:33:41 (00:15:62:64:33:41)
    Source: Cisco_23:64:c1 (00:1c:58:23:64:c1)
    Type: 802.1Q Virtual LAN (0x8100)
802.1Q Virtual LAN, PRI: 0, DEI: 0, ID: 1
    000. .... .... .... = Priority: Best Effort (default) (0)
    ...0 .... .... .... = DEI: Ineligible
    .... 0000 0000 0001 = ID: 1
    Type: 802.1Q Virtual LAN (0x8100)
802.1Q Virtual LAN, PRI: 0, DEI: 0, ID: 20
    000. .... .... .... = Priority: Best Effort (default) (0)
    ...0 .... .... .... = DEI: Ineligible
    .... 0000 0001 0100 = ID: 20
    Type: IPv4 (0x0800)
Internet Protocol Version 4, Src: 192.168.14.10, Dst: 192.168.14.20
    0100 .... = Version: 4
    .... 0101 = Header Length: 20 bytes (5)
    Differentiated Services Field: 0x00 (DSCP: CS0, ECN: Not-ECT)
    Total Length: 92
    Identification: 0x0001 (1)
    000. .... = Flags: 0x0
    ...0 0000 0000 0000 = Fragment Offset: 0
    Time to Live: 10
    Protocol: ICMP (1)
    Header Checksum: 0x1332 [validation disabled]
    [Header checksum status: Unverified]
    Source Address: 192.168.14.10
    Destination Address: 192.168.14.20
Internet Control Message Protocol
    Type: 0 (Echo (ping) reply)
    Code: 0
    Checksum: 0xdc45 [correct]
    [Checksum Status: Good]
    Identifier (BE): 1804 (0x070c)
    Identifier (LE): 3079 (0x0c07)
    Sequence Number (BE): 0 (0x0000)
    Sequence Number (LE): 0 (0x0000)
    Data (64 bytes)

ARP

The ARP module allows users to generate following ARP packets:

  • ARP Request
  • ARP Reply

This module supports:

  • Multiple flows
  • Packet count & Outgoing interface per flow
  • Random automated packet generation
  • Full manual packet generation
  • Adding VLAN tags

ARP Request

Random packet generation

Reveal Output

==================================================
Scapy based packet generator
==================================================

1 -- ICMP
2 -- ARP
3 -- IGMP
4 -- Multicast
5 -- VXLAN
6 -- Load PCAP File
7 -- Exit

Enter your choice (1-7): 2
Enter the number of flows > 1

Building flow number [ 1 ]:

Generate random ARP Packet? (y/n) > y
ARP Type (req/resp) > req
Count (c for continous) > 5
Source Interface > et48
2023-08-27 10:22:42,431: INFO: ARP packet built
###[ Ethernet ]###
  dst       = ff:ff:ff:ff:ff:ff
  src       = c4:ca:2b:b1:f6:39
  type      = ARP
###[ ARP ]###
     hwtype    = Ethernet (10Mb)
     ptype     = IPv4
     hwlen     = None
     plen      = None
     op        = who-has
     hwsrc     = c4:ca:2b:b1:f6:39
     psrc      = 172.30.244.205
     hwdst     = 00:00:00:00:00:00
     pdst      = 172.16.68.167

2023-08-27 10:22:42,432: INFO: Sending out all flows
2023-08-27 10:22:42,474: INFO: Done sending all flows
2023-08-27 10:22:42,509: INFO: Module completed
Reveal Packet

Ethernet II, Src: AristaNe_b1:f6:39 (c4:ca:2b:b1:f6:39), Dst: Broadcast (ff:ff:ff:ff:ff:ff)
    Destination: Broadcast (ff:ff:ff:ff:ff:ff)
    Source: AristaNe_b1:f6:39 (c4:ca:2b:b1:f6:39)
    Type: ARP (0x0806)
Address Resolution Protocol (request)
    Hardware type: Ethernet (1)
    Protocol type: IPv4 (0x0800)
    Hardware size: 6
    Protocol size: 4
    Opcode: request (1)
    Sender MAC address: AristaNe_b1:f6:39 (c4:ca:2b:b1:f6:39)
    Sender IP address: 172.30.244.205
    Target MAC address: 00:00:00_00:00:00 (00:00:00:00:00:00)
    Target IP address: 172.16.68.167

ARP Response

Manual packet generation with VLAN Tag

Reveal Output

==================================================
Scapy based packet generator
==================================================

1 -- ICMP
2 -- ARP
3 -- IGMP
4 -- Multicast
5 -- VXLAN
6 -- Load PCAP File
7 -- Exit

Enter your choice (1-7): 2
Enter the number of flows > 1

Building flow number [ 1 ]:

Generate random ARP Packet? (y/n) > n
ARP Type (req/resp) > resp
Source MAC (de:ad:be:ef:ca:fe) > 00:1d:09:f0:92:ab
Destination MAC > 00:1a:6b:6c:0c:cc
Sender MAC > 00:1d:09:f0:92:ab
Sender IP > 10.10.10.1
Target MAC > 00:1a:6b:6c:0c:cc
Target IP > 10.10.10.2
Tag (y/n) > y
VLAN Tag (x,y) > 20
Count (c for continous) > 5
Source Interface > et48
2023-08-27 10:27:29,750: INFO: ARP packet built
###[ Ethernet ]###
  dst       = 00:1a:6b:6c:0c:cc
  src       = 00:1d:09:f0:92:ab
  type      = n_802_1Q
###[ 802.1Q ]###
     prio      = 0
     id        = 0
     vlan      = 20
     type      = ARP
###[ ARP ]###
        hwtype    = Ethernet (10Mb)
        ptype     = IPv4
        hwlen     = None
        plen      = None
        op        = is-at
        hwsrc     = 00:1d:09:f0:92:ab
        psrc      = 10.10.10.1
        hwdst     = 00:1a:6b:6c:0c:cc
        pdst      = 10.10.10.2

2023-08-27 10:27:29,751: INFO: Sending out all flows
2023-08-27 10:27:29,802: INFO: Done sending all flows
2023-08-27 10:27:29,835: INFO: Module completed
Reveal Packet

Ethernet II, Src: Dell_f0:92:ab (00:1d:09:f0:92:ab), Dst: Universa_6c:0c:cc (00:1a:6b:6c:0c:cc)
    Destination: Universa_6c:0c:cc (00:1a:6b:6c:0c:cc)
    Source: Dell_f0:92:ab (00:1d:09:f0:92:ab)
    Type: 802.1Q Virtual LAN (0x8100)
802.1Q Virtual LAN, PRI: 0, DEI: 0, ID: 20
    000. .... .... .... = Priority: Best Effort (default) (0)
    ...0 .... .... .... = DEI: Ineligible
    .... 0000 0001 0100 = ID: 20
    Type: ARP (0x0806)
Address Resolution Protocol (reply)
    Hardware type: Ethernet (1)
    Protocol type: IPv4 (0x0800)
    Hardware size: 6
    Protocol size: 4
    Opcode: reply (2)
    Sender MAC address: Dell_f0:92:ab (00:1d:09:f0:92:ab)
    Sender IP address: 10.10.10.1
    Target MAC address: Universa_6c:0c:cc (00:1a:6b:6c:0c:cc)
    Target IP address: 10.10.10.2