Skip to content

Commit

Permalink
Merge branch 'master' of github.com:tomnomnom/assetfinder
Browse files Browse the repository at this point in the history
  • Loading branch information
tomnomnom committed Apr 15, 2020
2 parents 0290958 + e0a2b33 commit 4e95d87
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 17 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ Please feel free to issue pull requests with new sources! :)
* wayback machine
* dns.bufferover.run
* facebook
* Needs `FB_APP_ID` and `FB_APP_SECRET` environment variables set
* Needs `FB_APP_ID` and `FB_APP_SECRET` environment variables set (https://developers.facebook.com/)
* You need to be careful with your app's rate limits
* virustotal
* Needs `VT_API_KEY` environment variable set
* Needs `VT_API_KEY` environment variable set (https://developers.virustotal.com/reference)
* findsubdomains
* Needs `SPYSE_API_TOKEN` environment variable set (the free version always gives the first response page, and you also get "25 unlimited requests")
* Needs `SPYSE_API_TOKEN` environment variable set (the free version always gives the first response page, and you also get "25 unlimited requests") — (https://spyse.com/apidocs)

### Sources to be implemented
* http://api.passivetotal.org/api/docs/
Expand Down
3 changes: 3 additions & 0 deletions bufferoverrun.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ func fetchBufferOverrun(domain string) ([]string, error) {

for _, r := range wrapper.Records {
parts := strings.SplitN(r, ",", 2)
if len(parts) != 2 {
continue
}
out = append(out, parts[1])
}

Expand Down
27 changes: 13 additions & 14 deletions crtsh.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,17 @@ package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
)

type CrtShResult struct {
Name string `json:"name_value"`
}

func fetchCrtSh(domain string) ([]string, error) {
var results []CrtShResult

resp, err := http.Get(
fmt.Sprintf("https://crt.sh/?q=%%25.%s&output=json", domain),
)
Expand All @@ -17,22 +24,14 @@ func fetchCrtSh(domain string) ([]string, error) {

output := make([]string, 0)

dec := json.NewDecoder(resp.Body)
body, _ := ioutil.ReadAll(resp.Body)

// The crt.sh API is a little funky... It returns multiple
// JSON objects with no delimiter, so you just have to keep
// attempting a decode until you hit EOF
for {
wrapper := struct {
Name string `json:"name_value"`
}{}

err := dec.Decode(&wrapper)
if err != nil {
break
}
if err := json.Unmarshal(body, &results); err != nil {
return []string{}, err
}

output = append(output, wrapper.Name)
for _, res := range results {
output = append(output, res.Name)
}
return output, nil
}

0 comments on commit 4e95d87

Please sign in to comment.