updates readme, removes commented code, make sure status is not added to file output if turned off

This commit is contained in:
2020-07-24 22:45:44 +01:00
parent f6be925acf
commit 03fb1c4449
3 changed files with 25 additions and 5 deletions

View File

@@ -1,3 +1,20 @@
# Assetfinder
Domain recon tool
```sh
$ go get -u github.com/cubixle/assetfinder/cmd/assetfinder
```
```sh
$ assetfinder -h
Usage of assetfinder:
-https
Enable/Disable the checking of status of https on a domain. (default true)
-output string
Where to save results to.
-status
Enable/Disable checking the status code for each sub domain found.
-verbose
Turns on verbose logging. Mainly used for debugging development.
```

View File

@@ -8,7 +8,6 @@ import (
)
func main() {
// subsOnly := flag.Bool("subs-only", false, "Only search for subdomains.")
disableStatusCheck := flag.Bool("status", false, "Enable/Disable checking the status code for each sub domain found.")
checkHTTPS := flag.Bool("https", true, "Enable/Disable the checking of status of https on a domain.")
outfile := flag.String("output", "", "Where to save results to.")

View File

@@ -54,16 +54,20 @@ func Scanner(verboseLogging, checkHTTPS, disableStatusCheck bool, outputFile, do
return nil
}
return writeFile(outputFile, ress)
return writeFile(outputFile, ress, disableStatusCheck)
}
func writeFile(outputFile string, res []Result) error {
func writeFile(outputFile string, res []Result, disableStatusCheck bool) error {
resBytes := []byte("domain, status code")
for _, r := range res {
if r.StatusCode == 0 || r.Error != nil {
continue
}
resBytes = append(resBytes, []byte(fmt.Sprintf("%s, %d\n", r.Domain, r.StatusCode))...)
if disableStatusCheck {
resBytes = append(resBytes, []byte(fmt.Sprintf("%s\n", r.Domain))...)
} else {
resBytes = append(resBytes, []byte(fmt.Sprintf("%s, %d\n", r.Domain, r.StatusCode))...)
}
}
err := ioutil.WriteFile(outputFile, resBytes, 0775)