{"id":25841377,"url":"https://github.com/packet-batch/program","last_synced_at":"2025-03-01T05:29:10.500Z","repository":{"id":171358126,"uuid":"433566522","full_name":"Packet-Batch/Program","owner":"Packet-Batch","description":"An application that utilizes fast AF_XDP Linux sockets to generate and send network packets. Used for penetration testing including Denial of Service (DoS) and network monitoring. Made by @gamemann!","archived":false,"fork":false,"pushed_at":"2025-02-22T23:15:31.000Z","size":24241,"stargazers_count":92,"open_issues_count":0,"forks_count":11,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-23T00:25:14.046Z","etag":null,"topics":["af-xdp","ddos","ddos-attack-tools","ddos-tool","dos","dos-attack-tool","dos-tool","hack-tool","linux","networking","packet","packet-generator","penetration","penetration-testing","penetration-testing-tools","pentest","pentest-tool","pentesting","pktgen","xdp"],"latest_commit_sha":null,"homepage":"https://deaconn.net/service/view/packet-batch","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Packet-Batch.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-11-30T19:53:32.000Z","updated_at":"2025-02-20T15:58:53.000Z","dependencies_parsed_at":null,"dependency_job_id":"5e65088e-6ef1-4e84-b9ef-514ce2aa65f0","html_url":"https://github.com/Packet-Batch/Program","commit_stats":null,"previous_names":["packet-batch/pb-af-xdp","packet-batch/program"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Packet-Batch%2FProgram","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Packet-Batch%2FProgram/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Packet-Batch%2FProgram/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Packet-Batch%2FProgram/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Packet-Batch","download_url":"https://codeload.github.com/Packet-Batch/Program/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241322687,"owners_count":19944073,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["af-xdp","ddos","ddos-attack-tools","ddos-tool","dos","dos-attack-tool","dos-tool","hack-tool","linux","networking","packet","packet-generator","penetration","penetration-testing","penetration-testing-tools","pentest","pentest-tool","pentesting","pktgen","xdp"],"created_at":"2025-03-01T05:29:09.463Z","updated_at":"2025-03-01T05:29:10.487Z","avatar_url":"https://github.com/Packet-Batch.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Packet Batch AF_XDP Build Workflow](https://github.com/Packet-Batch/PB-AF-XDP/actions/workflows/build.yml/badge.svg)](https://github.com/Packet-Batch/PB-AF-XDP/actions/workflows/build.yml) [![Packet Batch AF_XDP Run Workflow](https://github.com/Packet-Batch/PB-AF-XDP/actions/workflows/run.yml/badge.svg)](https://github.com/Packet-Batch/PB-AF-XDP/actions/workflows/run.yml)\n\n[Packet Batch](https://github.com/Packet-Batch) is a collection of high-performance applications and tools designed for generating and sending network packets. It serves two main purposes: penetration testing, which involves assessing network security by simulating various attacks like [Denial of Service](https://www.cloudflare.com/learning/ddos/glossary/denial-of-service/) (DoS); and network monitoring, which involves analyzing and inspecting network traffic.\n\n### Features\n* The ability to send multiple network packets in a chain via sequences and multiple payloads inside of a single sequence coming from the same source.\n* Support for sending from randomized source IPs within range(s) indicated by CIDR.\n* Support for randomized payload data within a specific range in length.\n* UDP, TCP, and ICMP layer 4 protocols supported.\n* Optional layer 3 and 4 checksum calculation in the event you want the NIC's hardware to calculate checksums for generated outgoing packets.\n\n#### Note Regarding Seeding/Randomness\nWhen generating randomness in a packet (e.g. random source IPs, ports, payload(s), etc.), by default, we try to use nanoseconds since boot using `timespec` as the seed when passing to [`rand_r()`](https://linux.die.net/man/3/rand_r) for example. However, I've found this isn't completely random, especially since the seed variable (`unsigned int`) and `timespec` nanoseconds variable (`long`) do not match in size.\n\nTherefore, I added the constant [`VERY_RANDOM`](https://github.com/Packet-Batch/PB-AF-XDP/blob/master/src/sequence.h#L36) that can be uncommented. When this constant is defined, the [`getrandom()`](https://man7.org/linux/man-pages/man2/getrandom.2.html) function is used to fill the seed with random bytes. This results in more randomness, but the `getrandom()` function adds a bit more overhead than retrieving the nanoseconds since system boot from my testing.\n\n### Disclaimer\nI do **NOT** support using these tools maliciously or as a part of a targeted attack. I've made these tools to perform penetration tests against my own firewalls along with occasionally debugging network issues such as packets not arriving to their destination correctly.\n\n### Showcase\nThese are just a couple of basic tests I performed between two virtual machines on my home server.\n\n![Test One](./images/test1.gif)\n\n![Test Two](./images/test2.gif)\n\n**NOTE** - Since the above demos, there was a change in Packet Batch that allows for more precise/randomized IPs/ports via seeding [here](https://github.com/Packet-Batch/PB-AF-XDP/commit/e1c872ccd10aa94120d10d120259706f31518678) (using the seed, nanoseconds since boot, instead of the UNIX timestamp which is shown above). Therefore, Packet Batch will now send from a more randomized IP/port than what is shown above!\n\n## AF_XDP\nThis is a special version of Packet Batch that utilizes `AF_XDP` [sockets](https://docs.kernel.org/networking/af_xdp.html) instead of `AF_PACKETv3` (which is what the standard version uses). I recommend using this version over the standard version due to performance improvements, but you must keep in mind the following.\n\n1. AF_XDP sockets require a **more recent** Linux kernel.\n1. The TCP `cooked` and `oneconnection` settings are **NOT** available in this version due to no cooked sockets support in AF_XDP.\n\nThe above is why we aren't utilizing AF_XDP sockets in the standard version.\n\nFrom the benchmarks I've concluded on my home server running Proxmox VMs, AF_XDP sockets send around 5 - 10% more packets per second than the standard version and the amount of packets per second it is sending is a lot more consistent (regardless of the batch size option explained below). I won't have solid benchmarks until I perform these tests on full dedicated hardware which should happen in early 2022.\n\n## Building And Installing\nBuilding and installing this project is fairly easy and just like the standard version. It includes building the Packet Batch Common repository which requires [JSON-C](https://github.com/json-c/json-c). As long as you use the `--recursive` flag with `git`, it should retrieve all of the required submodules automatically located in the `modules/` directory. Otherwise, you will need to go into the Common repository and execute the `git submodule update --init` command. We use `make` to build and install the application.\n\nThe following commands should work for Ubuntu/Debian-based systems. However, you should be able to install this on other Linux distros with a few adjustments as well.\n\n```bash\n# Update apt.\nsudo apt update\n\n# Install Git if it isn't already installed.\nsudo apt install -y git\n\n# Clone this repository along with its submodules.\ngit clone --recursive https://github.com/Packet-Batch/PB-AF-XDP.git\n\n# Install build essentials/tools and needed libaries for JSON-C.\nsudo apt install -y build-essential clang cmake pkgconf\n\n# Install LibELF for BPF.\nsudo apt install -y libelf-dev\n\n# Change the current working directory to PB-AF-XDP/.\ncd PB-AF-XDP/\n\n# Execute ./build.sh file to build and install dependencies and main project which requires sudo privileges.\n# WARNING - If you don't have sudo available on your system, please look at the ./build.sh file and execute make commands as root in order.\n# NOTE - You may also look at the .github/workflows/build.yml.\n# NOTE - The first argument represents the amount of threads to use with make. 0 uses the amount of available threads on the system and supplying no argument uses 1 thread.\n./build.sh 0\n\n# You may use the following to clean the build. You must run this as root or sudo because of the Common's cleanup.\nsudo make clean\n```\n\n![Install GIF](./images/install.gif)\n\n### Installation Video!\n[![Click here to watch!](https://i.imgur.com/pD3H1vw.jpeg)](https://www.youtube.com/watch?v=2vWJUgsbbIM)\n\n**Warning!** - The installation video is a bit outdated, but should show most of the installation process. Since the video was made, we've switched to `json-c` from `libyaml` and use a build script to build the project and its dependencies ([`./build.sh`](./build.sh)).\n\nAfter installing, the executable is copied to the `/usr/bin/` directory which should be included in your `$PATH`. Therefore, you may use the application globally (in any directory).\n\nFor example.\n\n```bash\npcktbatch -c /path/to/conf.json\n```\n\n## Command Line Usage\n### Basic\nBasic command line usage may be found below.\n\n```bash\nUsage: pcktbatch -c \u003cconfigfile\u003e [-v -h]\n\n-c --cfg =\u003e Path to the config file.\n-l --list =\u003e Print basic information about sequences.\n-v --verbose =\u003e Provide verbose output.\n-h --help =\u003e Print out help menu and exit program.\n```\n\n### First Sequence Override\nIf you wanted to quickly send packets and don't want to create a config file, you may specify command line options to override the first sequence. You must also specify the `-z` or `--cli` flag in order to do this.\n\nThe following command line options are available to override the first sequence.\n\n```bash\n-z --cli =\u003e Enables the first sequence/packet override.\n\n--interface =\u003e The interface to send out of.    --block =\u003e Whether to enable blocking mode (0/1).       --track =\u003e Track packet and byte statistics and print at the end (0/1). Will impact performance!\n--maxpckts =\u003e The maximum amount of packets to send during this sequence before exiting.\n--maxbytes =\u003e The maximum amount of bytes to send during this sequence before exiting.\n--pps =\u003e The amount of packets per second to limit this sequence to (0 = disabled).\n--bps =\u003e The amount of bytes per second to limit this sequence to (0 = disabled)\n--delay =\u003e The delay in-between sending packets on each thread.\n--threads =\u003e The amount of threads and sockets to spawn (0 = CPU count).\n--l4csum =\u003e Whether to calculate the layer-4 checksum (TCP, UDP, and ICMP) (0/1).\n\n--smac =\u003e The ethernet source MAC address to use.\n--dmac =\u003e The ethernet destination MAC address to use.\n\n--minttl =\u003e The minimum IP TTL to use.\n--maxttl =\u003e The maximum IP TTL to use.\n--minid =\u003e The minimum IP ID to use.\n--maxid =\u003e The maximum IP ID to use.\n--sip =\u003e The source IP (one range is supported in CIDR format).\n--dip =\u003e The destination IP.\n--protocol =\u003e The protocol to use (TCP, UDP, or ICMP).\n--tos =\u003e The IP TOS to use.\n--l3csum =\u003e Whether to calculate the IP header checksum or not (0/1).\n\n--usport =\u003e The UDP source port.\n--udport =\u003e The UDP destination port.\n\n--tsport =\u003e The TCP source port.\n--tdport =\u003e The TCP source port.\n--syn =\u003e Set the TCP SYN flag (0/1).\n--ack =\u003e Set the TCP ACK flag (0/1).\n--psh =\u003e Set the TCP PSH flag (0/1).\n--rst =\u003e Set the TCP RST flag (0/1).\n--fin =\u003e Set the TCP FIN flag (0/1).\n--urg =\u003e Set the TCP URG flag (0/1).\n--ece =\u003e Set the TCP ECE flag (0/1).\n--cwr =\u003e Set the TCP CWR flag (0/1).\n\n--pmin =\u003e The minimum payload data.\n--pmax =\u003e The maximum payload data.\n--pstatic =\u003e Use static payload (0/1).\n--pexact =\u003e The exact payload string.\n--pfile =\u003e Whether to parse a file as the 'pexact' string instead.\n--pstring =\u003e Parse the 'pexact' string or file as a string instead of hexadecimal.\n```\n\n### AF_XDP\nThere is additional command line usage with the AF_XDP version which may be found below.\n\n```\n--queue =\u003e If set, all AF_XDP/XSK sockets are bound to this specific queue ID.\n--nowakeup =\u003e If set, all AF_XDP/XSK sockets are bound without the wakeup flag.\n--sharedumem =\u003e If set, all AF_XDP/XSK sockets use the same UMEM area.\n--batchsize =\u003e How many packets to send at once (default 1).\n--forceskb =\u003e If set, all AF_XDP/XSK sockets are bound using the SKB flag instead of DRV mode.\n--zerocopy =\u003e If set, all AF_XDP/XSK sockets are attempted to be bound with zero copy mode.\n--copy =\u003e If set, all AF_XDP/XSK sockets are bound with copy mode.\n```\n\n**NOTE** - The **batch size** indicates how many packets to send at the same time, but this is the **same** packet data. This may or may not speed up performance, but personally I didn't see much of an impact.\n\n**NOTE** - By default, each socket is created in a separate thread specified in the config and is bound to a separate queue ID (incremented by 1). With that said, shared UMEM is not supported by default and each socket has its own UMEM area. The XDP wakeup flag is also specified by default which should improve performance.\n\n## Configuration File\nIf you want to use more than one sequence or more control, you will need to specify sequences inside of a config file using the [JSON syntax](https://www.w3schools.com/js/js_json_syntax.asp).\n\nBefore continuing, here is information on the types used below with the config.\n\n| Name | Length (Bytes) | Unsigned | Description |\n| ---- | ------ | -------- | ----------- |\n| string | N/A | N/A | A string terminated by `\\0`. |\n| byte | 1 | yes | A single byte integer. |\n| boolean | 1 | yes | A single `true` (1) or `false` (0) value. |\n| ushort | 2 | yes | An unsigned short. |\n| short | 2 | no | A short. |\n| uint | 4 | yes | An unsigned integer. |\n| int | 4 | no | An integer. |\n| ulong | 8 | yes | An unsigned long. |\n| long | 8 | no | A long. |\n\nHere is the full config file format.\n\n| Key | Type | Default | Description |\n| --- | ---- | ------- | ----------- |\n| `interface` | string | `null` | The default interface to send packets out of. |\n| `sequences` | Array `Sequence` Object | `[]` | An array of sequences to use (see below). |\n\n\u003cdetails\u003e\n    \u003csummary\u003eExamples\u003c/summary\u003e\nBasic config.\n\n```json\n{\n    \"interface\": \"devint\",\n    \"sequences\": [\n        {\n            ...\n        },\n        {\n            ...\n        }\n    ]\n}\n```\n\u003c/details\u003e\n\n### Sequence Object\nThe sequence object has the following fields.\n\n| Key | Type | Default | Description |\n| --- | ---- | ------- | ----------- |\n| `interface` | string | `null` | The interface to use when sending out of this sequence. |\n| `block` | boolean | `true` | Whether to block the main thread/other sequences until this sequence is completed. |\n| `track` | boolean | `false` | Tracks total packets/bytes including average per second for the sequence and prints before the program exits. This will impact performance! |\n| `maxpckts` | ulong | `0` | If above 0, the sequence will exit after hitting this amount of total packets sent. |\n| `maxbytes` | ulong | `0` | If above 0, the sequence will exit after hitting this amount of total bytes sent. |\n| `pps` | ulong | `0` | If above 0, will limit the sequence to this amount of packets per second. |\n| `bps` | ulong | `0` | If above 0, will limit the sequence to this amount of bytes per second. |\n| `time` | ulong | `0` | If above 0, will limit the sequence to this amount of time in seconds before exiting. |\n| `threads` | ushort | `0` | If 0, will spawn *x* amount of threads for this sequence. Otherwise, uses CPU count. |\n| `delay` | ulong | `1000000` | The delay between each iteration (sent packet) in the sequence in microseconds. |\n| `l4csum` | boolean | `true` | Whether to calculate the layer-4 checksum in the program. |\n| `eth` | Ethernet Object | `{}` | The ethernet header object (see below). |\n| `ip` | IP Object | `{}` | The IP header object (see below). |\n| `udp` | UDP Object | `{}` | The UDP header object (see below). |\n| `tcp` | TCP Object | `{}` | The TCP header object (see below). |\n| `icmp` | ICMP Object | `{}` | The ICMP header object (see below). |\n| `payloads` | Array `Payload` Object | `[]` | The payloads array (see below). |\n\n\u003cdetails\u003e\n    \u003csummary\u003eExamples\u003c/summary\u003e\n\nThe following sends packets out of the `dev` interface. It blocks the thread and only runs for 20 seconds. There is a 100000 microsecond delay in-between sending packets on the main sequence.\n\n```json\n{\n    \"interface\": \"dev\",\n    \"block\": true,\n    \"time\": 20,\n    \"delay\": 100000,\n    \"eth\": {\n        ...\n    },\n    \"ip\": {\n        ...\n    },\n    \"tcp\": {\n        ...\n    },\n    \"udp\": {\n        ...\n    },\n    \"icmp\": {\n        ...\n    },\n    \"payloads\": [\n        ...\n    ]\n}\n```\n\nThe following sends packets out of the `dev` interface. It blocks the thread and only runs until 3000 packets sent. there is no delay between sending packets, so it will send packets as fast as it can.\n\n```json\n{\n    \"interface\": \"dev\",\n    \"block\": true,\n    \"maxpckts\": 3000,\n    \"time\": 0,\n    \"delay\": 0,\n    \"eth\": {\n        ...\n    },\n    \"ip\": {\n        ...\n    },\n    \"tcp\": {\n        ...\n    },\n    \"udp\": {\n        ...\n    },\n    \"icmp\": {\n        ...\n    },\n    \"payloads\": [\n        ...\n    ]\n}\n```\n\nThe following sends packets out of the `dev` interface. It blocks the thread and runs until you hit CTRL + C or use another method to kill the process. The sequence is limited to sending 300 packets per second.\n\n```json\n{\n    \"interface\": \"dev\",\n    \"block\": true,\n    \"pps\": 300,\n    \"time\": 0,\n    \"delay\": 0,\n    \"eth\": {\n        ...\n    },\n    \"ip\": {\n        ...\n    },\n    \"tcp\": {\n        ...\n    },\n    \"udp\": {\n        ...\n    },\n    \"icmp\": {\n        ...\n    },\n    \"payloads\": [\n        ...\n    ]\n}\n```\n\u003c/details\u003e\n\n#### Ethernet Object\nThe ethernet object contains the following fields.\n\n| Key | Type | Default | Description |\n| --- | ---- | ------- | ----------- |\n| `smac` | string | `null` | The source MAC address to use. If not set, will attempt to retrieve the source MAC address automatically. |\n| `dmac` | string | `null` | The destination MAC address to use. If not set, will attempt to retrieve the destination MAC address automatically via gateway. |\n\n\u003cdetails\u003e\n    \u003csummary\u003eExamples\u003c/summary\u003e\n\nThe following sends packets from `09:EB:23:AB:2D:B1` to `08:EC:4B:23:F2:E3`.\n\n```json\n{\n    \"smac\": \"09:EB:23:AB:2D:B1\",\n    \"dmac\": \"08:EC:4B:23:F2:E3\"\n}\n```\n\u003c/details\u003e\n\n#### IP Object\nThe IP object contains the following fields.\n\n| Key | Type | Default | Description |\n| --- | ---- | ------- | ----------- |\n| `sip` | string | `null` | The source IP to send from. |\n| `dip` | string | `null` | The destination IP to send to. |\n| `protocol` | string | `null` | The layer-4 protocol. Available options include `tcp`, `udp`, and `icmp`. |\n| `tos` | byte | `0` | The Type of Server (ToS) to use. |\n| `csum` | boolean | `true` | Whether to calculate the IP header checksum. |\n| `ttl` | TTL Object | `{}` | The TTL object (see below). |\n| `id` | ID Object | `{}` | The ID object (see below). |\n| `ranges` | Array `String` | `{}` | An array of IP ranges that should be in the `\u003cip\u003e/\u003ccidr\u003e` format. |\n\n\u003cdetails\u003e\n    \u003csummary\u003eExamples\u003c/summary\u003e\n\nHere's an example that sends packets from `192.168.2.2` to `192.168.2.3`. The protocol is TCP.\n\n```json\n{\n    \"sip\": \"192.168.2.2\",\n    \"dip\": \"192.168.2.3\",\n    \"protocol\": \"tcp\",\n    \"csum\": true,\n    \"ttl\": {\n        ...\n    },\n    \"id\": {\n        ...\n    },\n    \"ranges\": [\n        ...\n    ]\n}\n```\n\nHere's another example that sends packets from random IPs within the `10.4.0.0/24` and `10.5.0.0/24` ranges to `10.3.0.2`. The protocol used is UDP.\n\n```json\n{\n    \"sip\": null,\n    \"dip\": \"10.3.0.2\",\n    \"protocol\": \"udp\",\n    \"csum\": true,\n    \"ranges\": [\n        \"10.4.0.0/24\",\n        \"10.5.0.0/24\"\n    ]\n}\n```\n\u003c/details\u003e\n\n##### TTL Object\nThe TTL object contains the following fields.\n\n| Key | Type | Default | Description |\n| --- | ---- | ------- | ----------- |\n| `min` | byte | `64` | The minimum TTL to use. |\n| `max` | byte | `64` | The maximum TTL to use. |\n\n\u003cdetails\u003e\n    \u003csummary\u003eExamples\u003c/summary\u003e\n\nHere's an example of generating a TTL between `64` and `128` every time we generate a packet.\n\n```json\n{\n    \"min\": 64,\n    \"max\": 128\n}\n```\n\u003c/details\u003e\n\n##### ID Object\nThe ID object contains the following.\n\n| Key | Type | Default | Description |\n| --- | ---- | ------- | ----------- |\n| `min` | byte | `0` | The minimum ID to use. |\n| `max` | byte | `64000` | The maximum ID to use. |\n\n\u003cdetails\u003e\n    \u003csummary\u003eExamples\u003c/summary\u003e\n\nHere's an example of generating an ID between `4000` and `9000` every time we generate a packet.\n\n```json\n{\n    \"min\": 4000,\n    \"max\": 9000\n}\n```\n\u003c/details\u003e\n\n#### TCP Object\nThe TCP object contains the following fields.\n\n| Key | Type | Default | Description |\n| --- | ---- | ------- | ----------- |\n| `sport` | ushort | `0` | The TCP source port to use. If 0, will generate a random port. |\n| `dport` | ushort | `0`| The TCP destination port to use. If 0, will generate a random port.\n| `syn` | boolean | `false` | Sets the TCP SYN flag. |\n| `psh` | boolean | `false` | Sets the TCP PSH flag. |\n| `fin` | boolean | `false` | Sets the TCP FIN flag. |\n| `ack` | boolean | `false` | Sets the TCP ACK flag. |\n| `rst` | boolean | `false` | Sets the TCP RST flag. |\n| `urg` | boolean | `false` | Sets the TCP URG flag. |\n| `ece` | boolean | `false` | Sets the TCP ECE flag. |\n| `cwr` | boolean | `false` | Sets the TCP CWR flag. |\n\n\u003cdetails\u003e\n    \u003csummary\u003eExamples\u003c/summary\u003e\n\nHere's an example of sending packets with the SYN flag set to port `80`.\n\n```json\n{\n    \"dport\": 80,\n    \"syn\": true\n}\n```\n\u003c/details\u003e\n\n#### UDP Object\nThe UDP object contains the following.\n\n| Key | Type | Default | Description |\n| --- | ---- | ------- | ----------- |\n| `sport` | ushort | `0` | The UDP source port to use. If 0, will generate a random port. |\n| `dport` | ushort | `0` | The UDP destination port to use. If 0, will generate a random port. |\n\n\u003cdetails\u003e\n    \u003csummary\u003eExamples\u003c/summary\u003e\n\nHere's an example of sending packets from UDP source port `27005` to destination port `27015`.\n\n```json\n{\n    \"sport\": 27005,\n    \"dport\": 27015\n}\n```\n\u003c/details\u003e\n\n#### ICMP Object\nThe ICMP object contains the following fields.\n\n| Key | Type | Default | Description |\n| --- | ---- | ------- | ----------- |\n| `code` | byte | `0` | The ICMP code to set. |\n| `type` | byte | `0` | The ICMP type to set. |\n\n\u003cdetails\u003e\n    \u003csummary\u003eExamples\u003c/summary\u003e\n\nHere's an example of sending an ICMP echo request (type 8 and code 0).\n\n```json\n{\n    \"code\": 0,\n    \"type\": 8\n}\n```\n\u003c/details\u003e\n\n#### Payload Object\nThe payload object contains the following fields.\n\n| Key | Type | Default | Description |\n| --- | ---- | ------- | ----------- |\n| `exact` | string | `null` | The exact payload in hexadecimal. |\n| `isstatic` | boolean | `false` | Whether the payload is static (shouldn't change). If `exact` isn't set, it will generate payload once and reuse that payload each time. |\n| `isfile` | boolean | `false` | Whether `exact` should act as the path to the file and read as is. |\n| `isstring` | boolean | `false` | Whether to parse `exact` as a string instead of hexadecimal. |\n| `length` | Length Object | `{}` | The length object (see below). |\n\n\u003cdetails\u003e\n    \u003csummary\u003eExamples\u003c/summary\u003e\n\nThis example sends packets with the payload `0x01 0xFB 0x02 0xFC` (4 bytes in payload size).\n\n```json\n{\n    \"exact\": \"01 FB 02 FC\"\n}\n```\n\nThis example sends packets with a random payload between 0 and 5 bytes.\n\n```json\n{\n    \"length\": {\n        \"min\": 0,\n        \"max\": 5\n    }\n}\n```\n\nThis example parses `./mypayload.txt` as hexadecimal and uses that as the payload.\n\n```json\n{\n    \"exact\": \"./mypayload.txt\",\n    \"isfile\": true\n}\n```\n\nThis example parses `GET / HTTP/1.0\\r\\nHost: 1.2.3.4\\r\\n\\r\\n` as a string and uses that as the payload.\n\n```json\n{\n    \"exact\": \"GET / HTTP/1.0\\r\\nHost: 1.2.3.4\\r\\n\\r\\n\",\n    \"isstring\": true\n}\n```\n\u003c/details\u003e\n\n##### Length Object\nThe length object contains the following fields.\n\n| Key | Type | Default | Description |\n| --- | ---- | ------- | ----------- |\n| `min` | ushort | `0` | The minimum length. |\n| `max` | ushort | `0` | The maximum length. |\n\nIf you are looking for full examples, please check out [this repository](https://github.com/Packet-Batch/PB-Tests).\n\n**NOTE** - The default config path is `/etc/pcktbatch/conf.json`. This may be changed via the `-c` and `--cfg` flags as explained under the Command Line Usage section below.\n\n## Credits\n* [Christian Deacon](https://github.com/gamemann)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpacket-batch%2Fprogram","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpacket-batch%2Fprogram","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpacket-batch%2Fprogram/lists"}