Skip to main content

Randomly edit packet fields in a PCAP file.

Project description

pcap-fuzzer

PyPI package page

This program randomly edits packets from a PCAP file, one field per edited packet.

The edited field will be chosen at random, starting from the highest layer, and going down until it finds a supported protocol layer.

Example: a DNS packet will have one of its DNS fields edited, and not one of the UDP or IP fields.

Installation

pip install pcap-fuzzer

Usage

Import statement:

import pcap_fuzzer

fuzz_pcaps function doc:

pcap_fuzzer.fuzz_pcaps(
    pcaps: Union[str, list]       # (List of) input PCAP files
    output: str,                  # [Optional] Output PCAP file path. Used only if a single input file is specified.
    random_range: int = 1,        # [Optional] Upper bound for random range (not included). Defaults to 1.
    packet_numbers: list = None,  # [Optional] List of indices, starting from 1, of packets to edit. If not specified, packets are randomly picked.
    dry_run: bool = False         # [Optional] If True, do not write output PCAP file(s).
) -> None

This function produces new, edited PCAP file(s). If no output file is specified (for a single input file), or if multiple input files are given, the output file(s) will have the same name as the input file(s), but with the suffix .edit, and will be placed in a directory called edited, in the same directory as the input files. It will be created if it doesn't exist.

The program also produces CSV log files, indicating which fields were edited for each packet. The log files will be placed in a directory called logs, in the same directory as the input files. It will be created if it doesn't exist.

Supported protocols (for now)

  • Datalink Layer (2)
    • ARP
  • Network Layer (3)
    • IPv4
    • IPv6
  • Transport Layer (4)
    • TCP
    • UDP
    • ICMP
    • IGMP(v2 and v3)
  • Application Layer (7)
    • HTTP
    • DNS
    • DHCP
    • SSDP
    • CoAP

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pcap_fuzzer-0.4.0.tar.gz (35.1 kB view details)

Uploaded Source

Built Distribution

pcap_fuzzer-0.4.0-py3-none-any.whl (29.1 kB view details)

Uploaded Python 3

File details

Details for the file pcap_fuzzer-0.4.0.tar.gz.

File metadata

  • Download URL: pcap_fuzzer-0.4.0.tar.gz
  • Upload date:
  • Size: 35.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.8.10

File hashes

Hashes for pcap_fuzzer-0.4.0.tar.gz
Algorithm Hash digest
SHA256 e6299cc80d833ce6e0667bfb6b6ec2180ac01e2e710ad0f9f1da9d9043d22dc9
MD5 685c9371d8acde8593972b383ba42f6a
BLAKE2b-256 25796998401da2c35d45dd00d7186b236bb10d0cba6edebd14f47d71b705f8eb

See more details on using hashes here.

File details

Details for the file pcap_fuzzer-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: pcap_fuzzer-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 29.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.8.10

File hashes

Hashes for pcap_fuzzer-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 120c5c5a911a3369ab9fb7c9ddc1f49acfdf29c1d34f8f2a9ccdc97b0e645496
MD5 071ed70280308f5a33d6b08654d60ba2
BLAKE2b-256 940ee2473d072893331b08e403bcc2b96130b9309f4c9e3af0f65f9e75284aa2

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page