Skip to content
Extraits de code Groupes Projets
Valider a86d81ea rédigé par François De Keersmaeker's avatar François De Keersmaeker
Parcourir les fichiers

Updated README

parent 45e2d316
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
# pcap-fuzzer
[PyPI package page](https://pypi.org/project/pcap-fuzzer/)
This program randomly edits packets from a PCAP file,
one field per edited packet.
......@@ -9,36 +12,36 @@ Example: a DNS packet will have one of its DNS fields edited,
and not one of the UDP or IP fields.
## Dependencies
## Installation
* [Scapy](https://scapy.net/)
* `pip install scapy`
Install all with:
```bash
pip install -r requirements.txt
pip install pcap-fuzzer
```
## Usage
### From PyPI
```bash
pip install pcap-fuzzer
Import statement:
```python
import pcap_fuzzer
```
See documentation: [https://pypi.org/project/pcap-fuzzer/](https://pypi.org/project/pcap-fuzzer/).
### Directly from sources
```bash
python3 pcap_fuzzer.py [-h] [-o OUTPUT] [-r RANDOM_RANGE] [-n PACKET_NUMBER] [-d] pcap [pcap ...]
`fuzz_pcaps` function doc:
```python
pcap_fuzzer.fuzz_pcaps(
pcaps: Union[str, list] # (List of) input PCAP files
output: str, # 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
```
The program produces new PCAP file with the same name as the input files,
but with the suffix `.edit`.
The output files will be placed in a directory called `edited`,
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.
......@@ -48,18 +51,6 @@ 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.
### Positional arguments
* `pcap`: PCAP file(s) to edit
### Optional arguments
* `-h`, `--help`: show help message and exit
* `-o`, `--output`: output PCAP (and CSV) file path. Used only if a single input file is specified. Default: `edited/<input_pcap>.edit.pcap`
* `-r`, `--random-range`: upper bound for the random range, which will select for each packet if it will be edited or not. In practice, each packet will be edited with a probability of `1/r`. Must be a strictly positive integer. Default: `1` (edit all packets).
* `-n`, `--packet-number`: index of the packet to edit, starting from 1. Can be specified multiple times. If this is used, only the specified packets will be edited, and no random editing will be performed.
* `-d`, `--dry-run`: don't write the output PCAP file (but still write the CSV log file)
## Supported protocols (for now)
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter