|
@@ -69,12 +69,10 @@ func blockAndlearn(resp *http.Response) error {
|
|
|
|
|
|
func sanitizeHeaders(s string) string {
|
|
|
|
|
|
- re := regexp.MustCompile(`[a-zA-Z]{4,32}|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})|([{][/].*[}])|([0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12})`)
|
|
|
+ re := regexp.MustCompile(`[a-zA-Z]{4,32}|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})|([0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12})`)
|
|
|
matched := re.FindAllString(s, -1)
|
|
|
|
|
|
tmpSt := strings.ToLower(strings.Join(matched, " "))
|
|
|
- tmpSt = strings.ReplaceAll(tmpSt, "{", "")
|
|
|
- tmpSt = strings.ReplaceAll(tmpSt, "}", "")
|
|
|
|
|
|
log.Println("Matched: " + tmpSt)
|
|
|
|
|
@@ -86,13 +84,11 @@ func feedRequest(req *http.Request, class string) {
|
|
|
|
|
|
feed := formatRequest(req)
|
|
|
|
|
|
- feed = sanitizeHeaders(feed)
|
|
|
-
|
|
|
if class == "BAD" {
|
|
|
|
|
|
log.Println("Feeding BAD token: ", feed)
|
|
|
|
|
|
- ControPlane.BadTokens <- feed
|
|
|
+ ControPlane.BadTokens <- sanitizeHeaders(feed)
|
|
|
|
|
|
}
|
|
|
|
|
@@ -100,7 +96,7 @@ func feedRequest(req *http.Request, class string) {
|
|
|
|
|
|
log.Println("Feeding GOOD Token:", feed)
|
|
|
|
|
|
- ControPlane.GoodTokens <- feed
|
|
|
+ ControPlane.GoodTokens <- sanitizeHeaders(feed)
|
|
|
|
|
|
}
|
|
|
|
|
@@ -117,6 +113,6 @@ func formatRequest(req *http.Request) string {
|
|
|
fmt.Println(err)
|
|
|
}
|
|
|
|
|
|
- return fmt.Sprintf("{%s} %s\n", req.URL.Path, requestDump)
|
|
|
+ return fmt.Sprintf("%s\n", requestDump)
|
|
|
|
|
|
}
|