Skip to content

Commit de7d63e

Browse files
committed
add util to convert burp or HAR files to Probely's navigation sequences
1 parent adda76e commit de7d63e

2 files changed

Lines changed: 83 additions & 0 deletions

File tree

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Burp and HAR files converter
2+
3+
## Converts Burp or HAR files to Probely's Navigation sequences.
4+
5+
### Required options
6+
7+
- `--type/-t`: `burp` or `har` (input file format)
8+
- `--input/-i`: `/path/to/original_file`
9+
- `--output/-o`: `/path/to/destination_file`
10+
11+
### Optional
12+
13+
- `--crawl` or `--no-crawl` (default: `crawl`)
14+
15+
### From Burp file to Probely's Navigation sequence
16+
17+
```sh
18+
$ python3 ./burp_har_to_navigation_seq.py -t burp -i /tmp/burp_exported_file.xml -o /tmp/probely_navigation.json
19+
```
20+
21+
22+
### From HAR file to Probely's Navigation sequence
23+
24+
```sh
25+
$ python3 ./burp_har_to_navigation_seq.py -t har -i /tmp/har_exported_file.har -o /tmp/probely_navigation.json
26+
```
27+
28+
```sh
29+
$ python3 ./burp_har_to_navigation_seq.py -h
30+
usage: burp_har_to_navigation_seq.py [-h] -t {burp,har} -i INPUT -o OUTPUT [--crawl | --no-crawl]
31+
32+
Converts Burp or HAR files to Probely's navigation sequences
33+
34+
options:
35+
-h, --help show this help message and exit
36+
-t {burp,har}, --type {burp,har}
37+
burp/har
38+
-i INPUT, --input INPUT
39+
Input file
40+
-o OUTPUT, --output OUTPUT
41+
Output file
42+
--crawl, --no-crawl Crawl the requests
43+
```
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/usr/bin/env python
2+
"""
3+
Converts Burp or HAR files to Probely's Navigation sequences.
4+
"""
5+
import argparse
6+
import json
7+
8+
def run():
9+
parser = argparse.ArgumentParser(description='Converts Burp or HAR files to Probely\'s navigation sequences')
10+
parser.add_argument('-t', '--type', help='burp/har', choices=['burp', 'har'], required=True)
11+
parser.add_argument('-i', '--input', help='Input file', type=argparse.FileType('r'), required=True)
12+
parser.add_argument('-o', '--output', help='Output file', type=argparse.FileType('w'), required=True)
13+
parser.add_argument('--crawl', help='Crawl the requests', default=True, action=argparse.BooleanOptionalAction)
14+
args = parser.parse_args()
15+
16+
with args.input as file:
17+
input_data = file.read()
18+
19+
if args.type == 'burp':
20+
out_data = [{
21+
'file_type': 'burp',
22+
'crawl': args.crawl,
23+
'file_data': input_data
24+
}]
25+
elif args.type == 'har':
26+
out_data = [{
27+
'file_type': 'har',
28+
'crawl': args.crawl,
29+
'file_data': input_data
30+
}]
31+
32+
final_json = json.dumps(out_data, indent=2)
33+
args.output.write(final_json)
34+
35+
print('Done.')
36+
print('File converted to file: {}'.format(args.output.name))
37+
38+
39+
if __name__ == '__main__':
40+
run()

0 commit comments

Comments
 (0)