Skip to content

Commit

Permalink
Added --version option
Browse files Browse the repository at this point in the history
  • Loading branch information
H21lab committed Jul 16, 2020
1 parent 5a2cda4 commit 30fb6f0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ pip install ijson

## Usage
```
usage: json2pcap.py [-h] [-i [INFILE]] -o OUTFILE [-p] [-m MASKED_FIELD] [-a ANONYMIZED_FIELD] [-s SALT] [-v]
usage: json2pcap.py [-h] [--version] [-i [INFILE]] -o OUTFILE [-p] [-m MASKED_FIELD]
[-a ANONYMIZED_FIELD] [-s SALT] [-v]
json2pcap v1.1
json2pcap 1.1
Utility to generate pcap from json format.
Expand Down Expand Up @@ -73,6 +74,7 @@ allowed values of the target field and field encoding.
optional arguments:
-h, --help show this help message and exit
--version show program's version number and exit
-i [INFILE], --infile [INFILE]
json generated by tshark -T json -x
or by tshark -T jsonraw (not preserving frame timestamps).
Expand Down
7 changes: 5 additions & 2 deletions json2pcap.py
Original file line number Diff line number Diff line change
Expand Up @@ -473,8 +473,10 @@ def generate_pcap(d):
#
# ************ MAIN **************
#
VERSION = "1.1"

parser = argparse.ArgumentParser(description="""
json2pcap v1.1
json2pcap {version}
Utility to generate pcap from json format.
Expand Down Expand Up @@ -526,7 +528,8 @@ def generate_pcap(d):
json2pcap is no performing correct protocol encoding with respect to
allowed values of the target field and field encoding.
""", formatter_class=argparse.RawTextHelpFormatter)
""".format(version=VERSION), formatter_class=argparse.RawTextHelpFormatter)
parser.add_argument('--version', action='version', version='%(prog)s ' + VERSION)
parser.add_argument('-i', '--infile', nargs='?', help='json generated by tshark -T json -x\nor by tshark -T jsonraw (not preserving frame timestamps).\nIf no inpout file is specified script reads from stdin.')
parser.add_argument('-o', '--outfile', required=True, help='output pcap filename')
parser.add_argument('-p', '--python', help='generate python payload instead of pcap (only 1st packet)', default=False, action='store_true')
Expand Down

0 comments on commit 30fb6f0

Please sign in to comment.