From 1ebff74874b295757f18249169ed411f0c48b645 Mon Sep 17 00:00:00 2001 From: Emile Date: Sat, 2 Nov 2019 22:27:03 +0100 Subject: basic functionality hiding the codes given using hideCode or hc --- src/printer.go | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) (limited to 'src/printer.go') diff --git a/src/printer.go b/src/printer.go index 291adbb..d33360a 100644 --- a/src/printer.go +++ b/src/printer.go @@ -21,28 +21,32 @@ func printResponses(channels channels) { // codes var statusCode string - switch response.StatusCode { - case 200: - - // jump to the beginning of the line, clear the line, then print - // the response - prefix = "\r\033[K" - statusCode = green(fmt.Sprintf("%d", response.StatusCode)) - postfix = "\n" - - case 404: + var color string + + // default values: clear the line, print, newline, green + prefix = "\r\033[K" + postfix = "\n" + color = "green" + + // hide some of the requests, filter using the status code + for _, codeToHide := range hide.HideCode { + if response.StatusCode == codeToHide { + prefix = "" + postfix = "\033[K\r" + color = "red" + } + } - // print the status code, then clear the line and jump back to - // the beginning + // color + if color == "red" { statusCode = red(fmt.Sprintf("%d", response.StatusCode)) - postfix = "\033[K\r" - - // this prints the 404 line, but prints the entry on the same line - + } else if color == "green" { + statusCode = green(fmt.Sprintf("%d", response.StatusCode)) } - // print the foo + // print the requests fmt.Printf("%s%.7d: %s %s%s", prefix, i, statusCode, response.FuzzWord, postfix) + i++ } log.Printf("%s Done printing the responses", green("[+]")) -- cgit 1.4.1