diff --git a/README.md b/README.md index 43bb09a61032b370e41dae84e69d673b76caad84..de5311f8c7398bcebf8548debe382220689d6739 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ import pcap_fuzzer ```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. + 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). diff --git a/pcap_fuzzer/pcap_fuzzer.py b/pcap_fuzzer/pcap_fuzzer.py index 8430e1533dd6f1358f02b1fa8a75be1f7ab345e5..5edbe1ef6983ebe55f454aa0378fbf89b092e66f 100644 --- a/pcap_fuzzer/pcap_fuzzer.py +++ b/pcap_fuzzer/pcap_fuzzer.py @@ -49,7 +49,7 @@ def must_edit_packet(i: int, packet_numbers: list, random_range: int) -> bool: return is_specified or is_random -def fuzz_pcaps(pcaps: Union[str, list], output: str, random_range: int = 1, packet_numbers: list = None, dry_run: bool = False) -> None: +def fuzz_pcaps(pcaps: Union[str, list], output: str = None, random_range: int = 1, packet_numbers: list = None, dry_run: bool = False) -> None: """ Main functionality of the program: (Randomly) edit packet fields in a (list of) PCAP file(s). @@ -117,7 +117,6 @@ def fuzz_pcaps(pcaps: Union[str, list], output: str, random_range: int = 1, pack i += 1 # Write output PCAP file - output_pcap = "" if output is not None and len(pcaps) == 1: output_pcap = output else: @@ -150,7 +149,7 @@ if __name__ == "__main__": # Positional arguments: input PCAP file(s) parser.add_argument("input_pcaps", metavar="pcap", type=str, nargs="+", help="Input PCAP file(s).") # Optional flag: -o / --output - parser.add_argument("-o", "--output", type=str, help="Output PCAP (and CSV) file path. Used only if a single input file is specified. Default: edited/<input_pcap>.edit.pcap") + parser.add_argument("-o", "--output", type=str, default=None, help="Output PCAP (and CSV) file path. Used only if a single input file is specified. Default: edited/<input_pcap>.edit.pcap") # Optional flag: -r / --random-range parser.add_argument("-r", "--random-range", type=strictly_positive_int, default=1, help="Upper bound for random range (not included). Must be a strictly positive integer. Default: 1 (edit each packet).") diff --git a/setup.py b/setup.py index 50023af23eb5a61ad33df05e60f40b28ac5d6585..a088a0054f65beb9b46d7e69d391ce3805b3083b 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from setuptools import setup, find_packages setup( name='pcap_fuzzer', - version='0.3.0', + version='0.4.0', author='François De Keersmaeker', author_email='francois.dekeersmaeker@uclouvain.be', description='Randomly edit packet fields in a PCAP file.',