Skip to content
This repository has been archived by the owner on Nov 28, 2022. It is now read-only.

searchsploit --json <query> is not valid JSON #64

Closed
rmetzler opened this issue Dec 4, 2016 · 3 comments
Closed

searchsploit --json <query> is not valid JSON #64

rmetzler opened this issue Dec 4, 2016 · 3 comments
Assignees
Labels

Comments

@rmetzler
Copy link

rmetzler commented Dec 4, 2016

When the --json switch is used to get JSON formatted output, it's not valid JSON, because there are are two double quotes after the value for "Exploit":

$ searchsploit --json WordPress
{
  "SEARCH": "WordPress",
  "RESULTS": [
                {"Exploit":"WordPress 2.9 - Denial of Service"","Path":"/usr/local/Cellar/exploitdb/2016-12-02/share/exploitdb/platforms/php/dos/10825.sh","EDB-ID":10825},
                {"Exploit":"WordPress 4.0 - Denial of Service"","Path":"/usr/local/Cellar/exploitdb/2016-12-02/share/exploitdb/platforms/php/dos/35413.php","EDB-ID":35413},

...

Using jq will tell you there is a problem parsing the resulting JSON.

I didn't found out where the value came from, but I can provide a workaround:

in Line 632 of searchsploit I added another sed command to substitute "", for ",:

-    | sed '$ s/,$//g' )"
+    | sed -e '$ s/,$//g' -e 's/\"\",/\",/g' )"

I can provide a pull request if you want.

@g0tmi1k
Copy link
Collaborator

g0tmi1k commented Dec 6, 2016

Thanks for the heads up, will look into it at the weekend (at the latest).

g0tmi1k added a commit that referenced this issue Dec 8, 2016
@g0tmi1k
Copy link
Collaborator

g0tmi1k commented Dec 8, 2016

Sorted!

@g0tmi1k g0tmi1k closed this as completed Dec 8, 2016
@g0tmi1k g0tmi1k added the bug label Dec 19, 2016
@g0tmi1k g0tmi1k self-assigned this Dec 19, 2016
g0tmi1k added a commit that referenced this issue Dec 20, 2016
g0tmi1k added a commit that referenced this issue Dec 20, 2016
@ghost
Copy link

ghost commented May 13, 2017

In line 681
OUTPUT="$( eval ${SEARCH} | awk -F ',' '{ printf "\r\t\t'{'\"Exploit\":\"%s\",\"Platform\":\"%s\",\"Type\":\"%s\",\"Date\":\"%s\",\"Path\":\"'${gitpath}/'%s\",\"EDB-ID\":%s},\n", $3, $5, $6, $4, $2, $1 }' | sed '$ s/,$//g' )"

change to below code
OUTPUT="$( eval ${SEARCH} | awk -F ',' '{ printf "\r\t\t'{'\"Exploit\":\"%s\",\"Platform\":\"%s\",\"Type\":\"%s\",\"Date\":\"%s\",\"Path\":\"'${gitpath}/'%s\",\"EDB-ID\":%s},\n", $3, $5, $6, $4, $2, $1 }' | sed '$ s/,$//g' | sed 's|\\|\//|g' )"

It's work.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants