Skip to content

Commit

Permalink
Add 'show amount of urls scanned out of total amount of given urls' o…
Browse files Browse the repository at this point in the history
…n file/pipe mode
  • Loading branch information
hahwul committed Aug 6, 2020
1 parent 005b481 commit 300f231
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
2 changes: 2 additions & 0 deletions cmd/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ var fileCmd = &cobra.Command{
}
wg.Wait()
} else {
optionsStr["allURLs"] = strconv.Itoa(len(targets))
for i := range targets {
optionsStr["nowURL"] = strconv.Itoa(i+1)
scanning.Scan(targets[i], optionsStr, optionsBool)
}

Expand Down
2 changes: 2 additions & 0 deletions cmd/pipe.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ var pipeCmd = &cobra.Command{
}
wg.Wait()
} else {
optionsStr["allURLs"] = strconv.Itoa(len(targets))
for i := range targets {
optionsStr["nowURL"] = strconv.Itoa(i+1)
scanning.Scan(targets[i], optionsStr, optionsBool)
}

Expand Down
9 changes: 8 additions & 1 deletion pkg/scanning/scan.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ func Scan(target string, optionsStr map[string]string, optionsBool map[string]bo
s := spinner.New(spinner.CharSets[4], 100*time.Millisecond, spinner.WithWriter(os.Stderr)) // Build our new spinner
s.Prefix = " "
s.Suffix = " Waiting routines.."
if optionsStr["nowURL"] != "" {
s.Suffix = " URLs("+optionsStr["nowURL"]+" / "+optionsStr["allURLs"]+") :: Waiting routines"
}
if optionsStr["silence"] == "" {
time.Sleep(1 * time.Second) // Waiting log
s.Start() // Start the spinner
Expand Down Expand Up @@ -425,7 +428,11 @@ func Scan(target string, optionsStr map[string]string, optionsBool map[string]bo

if optionsStr["silence"] == "" {
s.Lock()
s.Suffix = " Tested (" + strconv.Itoa(queryCount) + " / " + strconv.Itoa(len(query)) + ") queries from " + optionsStr["concurrence"] + " worker"
if optionsStr["nowURL"] == ""{
s.Suffix = " Queries(" + strconv.Itoa(queryCount) + " / " + strconv.Itoa(len(query)) + ") :: Testing with " + optionsStr["concurrence"] + " worker"
} else {
s.Suffix = " Queries(" + strconv.Itoa(queryCount) + " / " + strconv.Itoa(len(query)) + "), URLs("+optionsStr["nowURL"]+" / "+optionsStr["allURLs"]+") :: Testing with " + optionsStr["concurrence"] + " worker"
}
//s.Suffix = " Waiting routines.. (" + strconv.Itoa(queryCount) + " / " + strconv.Itoa(len(query)) + ") reqs"
s.Unlock()
}
Expand Down

0 comments on commit 300f231

Please sign in to comment.