objective-see / KnockKnock

Enumerate persistently installed software
GNU General Public License v3.0
430 stars 32 forks source link

-pretty flag failing to convert to JSON #12

Open matt-taylor934 opened 3 years ago

matt-taylor934 commented 3 years ago

In v2.3.0 the -pretty flag is failing with the following error when doing a CLI scan: {"ERROR" : "failed to covert output to JSON"}

Running the scan without -pretty and trying to convert the results to JSON afterwards with 'jq' also fails,

Confirmed across various Macs running macOS 11.4 and 11.15.1.

actualben commented 2 years ago

I have seen this issue when a Browser Extension has quotation marks in the details field, Parallels Desktop includes at least one such extension in the app bundle. This results in the output being non-conforming json and the prettifier can't parse it.

evild3ad commented 1 year ago

My workaround:

sudo ./KnockKnock.app/Contents/MacOS/KnockKnock -whosthere > "$OUTPUT"/KnockKnock/KnockKnock-draft.json
/bin/cat "$OUTPUT"/KnockKnock/KnockKnock-draft.json | /usr/bin/sed -E 's/(""[^"]*)"/\1/' | /usr/bin/sed 's/""/"/g' | jq . > "$OUTPUT"/KnockKnock/KnockKnock.json
/bin/rm "$OUTPUT"/KnockKnock/KnockKnock-draft.json

Please fix!