From fc6544d6203d7ac71aaf1848e5035ae9603a1000 Mon Sep 17 00:00:00 2001 From: Azareal Date: Sat, 28 Mar 2020 15:39:05 +1000 Subject: [PATCH] add mattermost ua save bytes in req dump phrases: rename panel_group_promotion_registered_for to panel_group_promotion_reg_for rename panel_group_promotion_registered_months_suffix to panel_group_promotion_reg_months_suffix rename panel_group_promotion_registered_days_suffix to panel_group_promotion_reg_days_suffix rename panel_group_promotion_registered_hours_suffix to panel_group_promotion_reg_hours_suffix --- gen_router.go | 110 +++++++++++---------- langs/english.json | 9 +- router_gen/main.go | 5 +- templates/panel_group_edit_promotions.html | 8 +- 4 files changed, 70 insertions(+), 62 deletions(-) diff --git a/gen_router.go b/gen_router.go index da958e2f..816ef721 100644 --- a/gen_router.go +++ b/gen_router.go @@ -606,23 +606,24 @@ var agentMapEnum = map[string]int{ "slackbot": 32, "apple": 33, "discourse": 34, - "alexa": 35, - "lynx": 36, - "blank": 37, - "malformed": 38, - "suspicious": 39, - "semrush": 40, - "dotbot": 41, - "ahrefs": 42, - "proximic": 43, - "majestic": 44, - "blexbot": 45, - "aspiegel": 46, - "mail_ru": 47, - "zgrab": 48, - "curl": 49, - "python": 50, - "go": 51, + "mattermost": 35, + "alexa": 36, + "lynx": 37, + "blank": 38, + "malformed": 39, + "suspicious": 40, + "semrush": 41, + "dotbot": 42, + "ahrefs": 43, + "proximic": 44, + "majestic": 45, + "blexbot": 46, + "aspiegel": 47, + "mail_ru": 48, + "zgrab": 49, + "curl": 50, + "python": 51, + "go": 52, } var reverseAgentMapEnum = map[int]string{ 0: "unknown", @@ -660,23 +661,24 @@ var reverseAgentMapEnum = map[int]string{ 32: "slackbot", 33: "apple", 34: "discourse", - 35: "alexa", - 36: "lynx", - 37: "blank", - 38: "malformed", - 39: "suspicious", - 40: "semrush", - 41: "dotbot", - 42: "ahrefs", - 43: "proximic", - 44: "majestic", - 45: "blexbot", - 46: "aspiegel", - 47: "mail_ru", - 48: "zgrab", - 49: "curl", - 50: "python", - 51: "go", + 35: "mattermost", + 36: "alexa", + 37: "lynx", + 38: "blank", + 39: "malformed", + 40: "suspicious", + 41: "semrush", + 42: "dotbot", + 43: "ahrefs", + 44: "proximic", + 45: "majestic", + 46: "blexbot", + 47: "aspiegel", + 48: "mail_ru", + 49: "zgrab", + 50: "curl", + 51: "python", + 52: "go", } var markToAgent = map[string]string{ "OPR": "opera", @@ -718,6 +720,7 @@ var markToAgent = map[string]string{ "Facebot": "facebook", "Applebot": "apple", "Discourse": "discourse", + "mattermost": "mattermost", "ia_archiver": "alexa", "SemrushBot": "semrush", "DotBot": "dotbot", @@ -740,7 +743,7 @@ var markToID = map[string]int{ "MSIE": 6, "Trident": 7, "Edge": 5, - "Lynx": 36, + "Lynx": 37, "SamsungBrowser": 10, "UCBrowser": 11, "Google": 12, @@ -772,19 +775,20 @@ var markToID = map[string]int{ "Facebot": 28, "Applebot": 33, "Discourse": 34, - "ia_archiver": 35, - "SemrushBot": 40, - "DotBot": 41, - "AhrefsBot": 42, - "proximic": 43, - "MJ12bot": 44, - "BLEXBot": 45, - "AspiegelBot": 46, - "RU_Bot": 47, - "zgrab": 48, - "curl": 49, - "python": 50, - "Go": 51, + "mattermost": 35, + "ia_archiver": 36, + "SemrushBot": 41, + "DotBot": 42, + "AhrefsBot": 43, + "proximic": 44, + "MJ12bot": 45, + "BLEXBot": 46, + "AspiegelBot": 47, + "RU_Bot": 48, + "zgrab": 49, + "curl": 50, + "python": 51, + "Go": 52, } /*var agentRank = map[string]int{ "opera":9, @@ -901,7 +905,7 @@ func (r *GenRouter) DumpRequest(req *http.Request, pre string) { var heads string for key, value := range req.Header { for _, vvalue := range value { - heads += "Header '" + c.SanitiseSingleLine(key) + "': " + c.SanitiseSingleLine(vvalue) + "\n" + heads += "Head " + c.SanitiseSingleLine(key) + ": " + c.SanitiseSingleLine(vvalue) + "\n" } } @@ -920,7 +924,7 @@ func (r *GenRouter) SuspiciousRequest(req *http.Request, pre string) { pre += "\n" } r.DumpRequest(req,pre+"Suspicious Request") - co.AgentViewCounter.Bump(39) + co.AgentViewCounter.Bump(40) } func isLocalHost(h string) bool { @@ -935,7 +939,7 @@ func (r *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { w.WriteHeader(200) // 400 w.Write([]byte("")) r.DumpRequest(req,"Malformed Request T"+strconv.Itoa(typ)) - co.AgentViewCounter.Bump(38) + co.AgentViewCounter.Bump(39) } // Split the Host and Port string @@ -1074,7 +1078,7 @@ func (r *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { ua := strings.TrimSpace(strings.Replace(strings.TrimPrefix(req.UserAgent(),"Mozilla/5.0 ")," Safari/537.36","",-1)) // Noise, no one's going to be running this and it would require some sort of agent ranking system to determine which identifier should be prioritised over another if ua == "" { - co.AgentViewCounter.Bump(37) + co.AgentViewCounter.Bump(38) if c.Dev.DebugMode { var pre string for _, char := range req.UserAgent() { @@ -1156,7 +1160,7 @@ func (r *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { if strings.Contains(ua,"rv:11") { agent = 6 } - case 48: + case 49: r.SuspiciousRequest(req,"Vulnerability Scanner") } diff --git a/langs/english.json b/langs/english.json index 6ebe62dd..35e6d5a4 100644 --- a/langs/english.json +++ b/langs/english.json @@ -220,6 +220,7 @@ "facebook":"Facebook", "apple":"AppleBot", "discourse":"Discourse Forum Onebox", + "mattermost":"Mattermost", "alexa":"Alexa", "lynx":"Lynx", @@ -960,10 +961,10 @@ "panel_group_promotions_two_way":"Two Way", "panel_group_promotions_level":"Level", "panel_group_promotions_posts":"Posts", - "panel_group_promotion_registered_for":"Registered For", - "panel_group_promotion_registered_months_suffix":" months", - "panel_group_promotion_registered_days_suffix":" days", - "panel_group_promotion_registered_hours_suffix":" hours", + "panel_group_promotion_reg_for":"Registered For", + "panel_group_promotion_reg_months_suffix":" months", + "panel_group_promotion_reg_days_suffix":" days", + "panel_group_promotion_reg_hours_suffix":" hours", "panel_group_promotions_create_button":"Add Promotion", "panel_word_filters_head":"Word Filters", diff --git a/router_gen/main.go b/router_gen/main.go index f1fd97a7..82f3ac3f 100644 --- a/router_gen/main.go +++ b/router_gen/main.go @@ -266,6 +266,7 @@ func main() { "slackbot", "apple", "discourse", + "mattermost", "alexa", "lynx", "blank", @@ -331,6 +332,7 @@ func main() { "Facebot", "Applebot", "Discourse", + "mattermost", "ia_archiver", "SemrushBot", @@ -388,6 +390,7 @@ func main() { "Facebot": "facebook", "Applebot": "apple", "Discourse": "discourse", + "mattermost":"mattermost", "ia_archiver": "alexa", "SemrushBot": "semrush", @@ -579,7 +582,7 @@ func (r *GenRouter) DumpRequest(req *http.Request, pre string) { var heads string for key, value := range req.Header { for _, vvalue := range value { - heads += "Header '" + c.SanitiseSingleLine(key) + "': " + c.SanitiseSingleLine(vvalue) + "\n" + heads += "Head " + c.SanitiseSingleLine(key) + ": " + c.SanitiseSingleLine(vvalue) + "\n" } } diff --git a/templates/panel_group_edit_promotions.html b/templates/panel_group_edit_promotions.html index 329e9255..d8100b69 100644 --- a/templates/panel_group_edit_promotions.html +++ b/templates/panel_group_edit_promotions.html @@ -64,11 +64,11 @@
- +
- {{lang "panel_group_promotion_registered_months_suffix"}}
- {{lang "panel_group_promotion_registered_days_suffix"}}
- {{lang "panel_group_promotion_registered_hours_suffix"}} + {{lang "panel_group_promotion_reg_months_suffix"}}
+ {{lang "panel_group_promotion_reg_days_suffix"}}
+ {{lang "panel_group_promotion_reg_hours_suffix"}}