-
Notifications
You must be signed in to change notification settings - Fork 3
/
har-scan-req-postdata.jq
43 lines (34 loc) · 1.01 KB
/
har-scan-req-postdata.jq
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# For HAR files only.
# This script traverses a HAR file and tries to interpret the content of each POST request as a json.
# It outputs the URL of each request, with an index number and pretty-printed version of the json.
#
# Save the original input, because we will need it, below...
. as $original
|
# get all the entries
.log.entries
|
# get all the index numbers for the entries
keys
|
# for each entry, save the index number for later...
.[] as $index
|
# ...then go back to the original input and pick out the entry for that index number
$original.log.entries[$index]
|
# check if the content type include "json" or "text"
# (the reason we check for text type is that in some webapps jsons are mislabeled as text type)
select(
.request.postData.text != null and .request.postData.text != ""
)
|
# now we are ready for output...
# this outputs the entry index
[
(["Entry", $index]| join(": ")),
$original.log.entries[$index].request.url
]
|
# output as a TSV
@tsv