Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix zap JQ pattern #153

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions docs/dynamic_task.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ curl --fail $PROXY_URL/OTHER/core/other/jsonreport/?formMethod=GET --output repo
```
Than, use [jq](https://stedolan.github.io/jq/) to flatten the report so Glue can parse it:
```
jq '{ "@name" : .site."@name",
jq '{ "@name" : .site[0]."@name",
"alerts":
[.site.alerts[] as $in
[.site[] | .alerts[] as $in
| $in.instances[] as $h
| $in
| $h * $in
Expand All @@ -65,10 +65,10 @@ jq '{ "@name" : .site."@name",
"source": "URI: \($h.uri) Method: \($h.method)",
"detail": "\($in.name) \n Evidence: \($h.evidence) \n Solution: \($in.solution) \n Other info: \($in.otherinfo) \n Reference: \($in.reference)",
"severity": $in.riskdesc | split(" ") | .[0],
"fingerprint": "\($in.pluginid)_\($h.uri)_\($h.method)"
"fingerprint": "\($in.pluginid)_\($in.name)_\($h.uri)_\($h.method)"
}
]
} ' report.json > output.json
}' report.json > output.json
```
Now use Glue to process the report:
```
Expand All @@ -78,4 +78,4 @@ You can modify the jq pattern to modify the fields in Glue's results. For exampl
## Adding a new tool
First, create the mapping file.
After you have a working mapping file, open a PR and add it under `/lib/glue/mappings/`.
Also add a test to `dynamic_spec`, see mobsf tests for reference.
Also add a test to `dynamic_spec`, see mobsf tests for reference.