question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature Request: --json to format output as JSON to stdout for easier use with ansible

See original GitHub issue

It would be very handy for automation if the output could be formatted as a json document by adding “–json” to the command.

Perhaps something like:

[
{
  "id" : "Scanner"
  "version": "1.6.3"
  "scan_path":"/path/to/start"
   "files": {
        "cve1": [ "pathtojar","pathtojar2"... ] 
         "cve2": [ "pathtootherjar", ... ]
        "permissions": [ "pathtounreadable", "pathtounreadable2" ... ] 
   }
   "scanned_count": 2000
   "vuln_count": 3
   "perm_count": 10
   "mitigated_count": 5
   "exitcode": 1
}
]

(apologies for any syntax errors, this is an ad-hoc example.)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
Afroupercommented, Dec 19, 2021

I’ve made a first suggestion (see PR). The output is:

{ “files”: [ { “path”: “/opt/log4j/log4j-core-2.14.0.jar”, “entry”: “”, “product”: “Log4j 2”, “hostname”: “saturn.space”, “cve”: “CVE-2021-44228”, “fixed”: false, “detectedAt”: “2021-12-19 22:44:09”, “version”: “2.14.0” } ], “metrics”: { “scanFileCount”: 54, “fixedFileCount”: 0, “lastStatusLoggingTime”: 1639950249455, “statusReporting”: false, “lastVisitDirectory”: “/opt/log4j”, “scanDirCount”: 1, “lastStatusLoggingCount”: 0, “scanStartTime”: 1639950249455, “errorCount”: 0 } }

0reactions
xeraphcommented, Dec 20, 2021

@jlellis @strawgate Just released v2.4.0. Would you test --report-json option? See also https://github.com/logpresso/CVE-2021-44228-Scanner/wiki/JSON-Report-Sample

Read more comments on GitHub >

github_iconTop Results From Across the Web

Parse JSON using Ansible json_query - Middleware Inventory
Ansible json_query is an on-demand feature that every ansible user wants to explore. In this post we are going to how Ansible JSON...
Read more >
Using filters to manipulate data - Ansible Documentation
Filters let you transform JSON data into YAML data, split a URL to extract the hostname, get the SHA1 hash of a string,...
Read more >
5 ways to process JSON data in Ansible - Opensource.com
5 ways to process JSON data in Ansible ; Go down the JSON file 2 levels hosts: localhost vars: input · "{{ lookup('file','output.json')...
Read more >
Ansible Filter/Parse output to json - python - Stack Overflow
Trying to parse the output from Ansible seems like a waste of time. If you want JSON output from Ansible, just write JSON...
Read more >
Filter JSON Data in Ansible Using json_query | The NTC Mag
Parsing structured JSON data in Ansible playbooks is a common task. Nowadays, the JSON format is heavily used by equipment vendors to ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found