about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEmile <hanemile@protonmail.com>2019-11-02 22:27:03 +0100
committerEmile <hanemile@protonmail.com>2019-11-02 22:27:03 +0100
commit1ebff74874b295757f18249169ed411f0c48b645 (patch)
treeab45cea51ad7857e246b70551b9d661f72232b31
parent60d95c739b1eb6e9d4c02d91c79dcd0534bcb0f2 (diff)
basic functionality hiding the codes given using hideCode or hc
-rw-r--r--src/printer.go38
1 files changed, 21 insertions, 17 deletions
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("[+]"))