From 03fb1c44497c1d2ef264fc01e5331196f00a2a71 Mon Sep 17 00:00:00 2001 From: cubixle Date: Fri, 24 Jul 2020 22:45:44 +0100 Subject: [PATCH] updates readme, removes commented code, make sure status is not added to file output if turned off --- README.md | 19 ++++++++++++++++++- cmd/assetfinder/main.go | 1 - scanner.go | 10 +++++++--- 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 15861ab..05400b6 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,20 @@ # Assetfinder -Domain recon tool \ No newline at end of file +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. +``` \ No newline at end of file diff --git a/cmd/assetfinder/main.go b/cmd/assetfinder/main.go index 511b6b9..f4a7e0f 100644 --- a/cmd/assetfinder/main.go +++ b/cmd/assetfinder/main.go @@ -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.") diff --git a/scanner.go b/scanner.go index 5e94c0e..a306c54 100644 --- a/scanner.go +++ b/scanner.go @@ -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)