Skip to main content

Anonymize PCAP files

Project description

pcap-anonymize

This Python package reads PCAP files, and produces anonymized versions of the given files. More precisely, the following fields are anonymized:

  • Ethernet
    • Source MAC address
    • Destination MAC address
  • ARP
    • Source hardware address
    • Destination hardware address
  • DHCP
    • Client hardware address
    • Client Identifier option
  • HTTP
    • All fields are removed, except the method and URI path.
    • Request parameters are removed
  • CoAP
    • All fields are removed, except the type, code, and URI path.
  • TP-Link Smart Home protocol (TCP port 9999)
    • The TCP payload is removed.

Installation

Dependencies

Retrieve from PyPI

pip install pcap-anonymize

Usage

CLI

pcap-anonymize [-i input] [-o output] [-d dir]

The program can be used either with a single input PCAP file, or a directory containing multiple PCAP files.

Options for the former case are the following:

  • input: path to a single input PCAP file
  • output: path to a single output file.
    • If not specified, a new file is created in the same directory as the input file, with the name <input>.anon.pcap.

In the latter case, only the directory containing the PCAP files is provided. For each PCAP file, its corresponding, anonymized output file will be created in the same directory, with the suffix anon.pcap.

If no option is provided, the program stops directly.

Library

Single input/output file

from pcap_anonymize import anonymize_pcap

anonymize_pcap(
    input: os.PathLike,
    output: os.PathLike = None
)

Directory

from pcap_anonymize import anonymize_pcaps_in_dir

anonymize_pcaps_in_dir(
    dir: os.PathLike
)

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_anonymize-0.3.0.tar.gz (8.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pcap_anonymize-0.3.0-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

Details for the file pcap_anonymize-0.3.0.tar.gz.

File metadata

  • Download URL: pcap_anonymize-0.3.0.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for pcap_anonymize-0.3.0.tar.gz
Algorithm Hash digest
SHA256 2e668c9d1374878439b71c12fbfdba83873e30c92115d5a360f50b2b6c4b30a6
MD5 da342d66021bc1f339b4180bd7ae4f36
BLAKE2b-256 5b49406e39f37d2474d7e683c5c894ff29b9cc030a3c83accd2dbacc0cb31b30

See more details on using hashes here.

File details

Details for the file pcap_anonymize-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: pcap_anonymize-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 10.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for pcap_anonymize-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c3cfd299fcf60a531cbdfd9c13c732d418167c209779c707d05942115b627173
MD5 a1e78bb2a2ca807211094d4029b57dd3
BLAKE2b-256 36dfe18125d80ca7835a5476f0ee1367308eabcc610cac1b1ee6d305a4805fe3

See more details on using hashes here.

Supported by

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