Merge pull request #156 from ggranjus/master

Fix json.Unmarshal error for crtsh
master
Ice3man 2019-01-28 21:37:21 +05:30 committed by GitHub
commit a8356b6e5c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 13 deletions

View File

@ -56,20 +56,8 @@ func Query(args ...interface{}) interface{} {
return subdomains
}
// Convert Response Body to string and then replace }{ to },{
// This is done in order to enable parsing of JSON format employed by
// crt.sh
correctFormat := strings.Replace(string(respBody), "}{", "},{", -1)
// Now convert it into a json array like this
// [
// {abc},
// {abc}
// ]
jsonOutput := "[" + correctFormat + "]"
// Decode the json format
err = json.Unmarshal([]byte(jsonOutput), &crtshData)
err = json.Unmarshal([]byte(respBody), &crtshData)
if err != nil {
if !state.Silent {
fmt.Printf("\ncrtsh: %v\n", err)