add haosou, proximic and mail_ru user agents
add pre_global js hook try to fix archive.org ua patching don't word split uas at _
This commit is contained in:
parent
d22d6f0b27
commit
f55a7a23ba
107
gen_router.go
107
gen_router.go
|
@ -591,28 +591,31 @@ var agentMapEnum = map[string]int{
|
||||||
"baidu": 17,
|
"baidu": 17,
|
||||||
"sogou": 18,
|
"sogou": 18,
|
||||||
"toutiao": 19,
|
"toutiao": 19,
|
||||||
"duckduckgo": 20,
|
"haosou": 20,
|
||||||
"seznambot": 21,
|
"duckduckgo": 21,
|
||||||
"discord": 22,
|
"seznambot": 22,
|
||||||
"twitter": 23,
|
"discord": 23,
|
||||||
"facebook": 24,
|
"twitter": 24,
|
||||||
"cloudflare": 25,
|
"facebook": 25,
|
||||||
"archive_org": 26,
|
"cloudflare": 26,
|
||||||
"uptimebot": 27,
|
"archive_org": 27,
|
||||||
"slackbot": 28,
|
"uptimebot": 28,
|
||||||
"apple": 29,
|
"slackbot": 29,
|
||||||
"discourse": 30,
|
"apple": 30,
|
||||||
"alexa": 31,
|
"discourse": 31,
|
||||||
"lynx": 32,
|
"alexa": 32,
|
||||||
"blank": 33,
|
"lynx": 33,
|
||||||
"malformed": 34,
|
"blank": 34,
|
||||||
"suspicious": 35,
|
"malformed": 35,
|
||||||
"semrush": 36,
|
"suspicious": 36,
|
||||||
"dotbot": 37,
|
"semrush": 37,
|
||||||
"ahrefs": 38,
|
"dotbot": 38,
|
||||||
"majestic": 39,
|
"ahrefs": 39,
|
||||||
"aspiegel": 40,
|
"proximic": 40,
|
||||||
"zgrab": 41,
|
"majestic": 41,
|
||||||
|
"aspiegel": 42,
|
||||||
|
"mail_ru": 43,
|
||||||
|
"zgrab": 44,
|
||||||
}
|
}
|
||||||
var reverseAgentMapEnum = map[int]string{
|
var reverseAgentMapEnum = map[int]string{
|
||||||
0: "unknown",
|
0: "unknown",
|
||||||
|
@ -635,28 +638,31 @@ var reverseAgentMapEnum = map[int]string{
|
||||||
17: "baidu",
|
17: "baidu",
|
||||||
18: "sogou",
|
18: "sogou",
|
||||||
19: "toutiao",
|
19: "toutiao",
|
||||||
20: "duckduckgo",
|
20: "haosou",
|
||||||
21: "seznambot",
|
21: "duckduckgo",
|
||||||
22: "discord",
|
22: "seznambot",
|
||||||
23: "twitter",
|
23: "discord",
|
||||||
24: "facebook",
|
24: "twitter",
|
||||||
25: "cloudflare",
|
25: "facebook",
|
||||||
26: "archive_org",
|
26: "cloudflare",
|
||||||
27: "uptimebot",
|
27: "archive_org",
|
||||||
28: "slackbot",
|
28: "uptimebot",
|
||||||
29: "apple",
|
29: "slackbot",
|
||||||
30: "discourse",
|
30: "apple",
|
||||||
31: "alexa",
|
31: "discourse",
|
||||||
32: "lynx",
|
32: "alexa",
|
||||||
33: "blank",
|
33: "lynx",
|
||||||
34: "malformed",
|
34: "blank",
|
||||||
35: "suspicious",
|
35: "malformed",
|
||||||
36: "semrush",
|
36: "suspicious",
|
||||||
37: "dotbot",
|
37: "semrush",
|
||||||
38: "ahrefs",
|
38: "dotbot",
|
||||||
39: "majestic",
|
39: "ahrefs",
|
||||||
40: "aspiegel",
|
40: "proximic",
|
||||||
41: "zgrab",
|
41: "majestic",
|
||||||
|
42: "aspiegel",
|
||||||
|
43: "mail_ru",
|
||||||
|
44: "zgrab",
|
||||||
}
|
}
|
||||||
var markToAgent = map[string]string{
|
var markToAgent = map[string]string{
|
||||||
"OPR": "opera",
|
"OPR": "opera",
|
||||||
|
@ -675,13 +681,14 @@ var markToAgent = map[string]string{
|
||||||
"Baiduspider": "baidu",
|
"Baiduspider": "baidu",
|
||||||
"Sogou": "sogou",
|
"Sogou": "sogou",
|
||||||
"ToutiaoSpider": "toutiao",
|
"ToutiaoSpider": "toutiao",
|
||||||
|
"360Spider": "haosou",
|
||||||
"bingbot": "bing",
|
"bingbot": "bing",
|
||||||
"BingPreview": "bing",
|
"BingPreview": "bing",
|
||||||
"Slurp": "slurp",
|
"Slurp": "slurp",
|
||||||
"Exabot": "exabot",
|
"Exabot": "exabot",
|
||||||
"SeznamBot": "seznambot",
|
"SeznamBot": "seznambot",
|
||||||
"CloudFlare": "cloudflare",
|
"CloudFlare": "cloudflare",
|
||||||
"archive.org_bot": "archive_org",
|
"archive": "archive_org",
|
||||||
"Uptimebot": "uptimebot",
|
"Uptimebot": "uptimebot",
|
||||||
"Slackbot": "slackbot",
|
"Slackbot": "slackbot",
|
||||||
"Slack": "slackbot",
|
"Slack": "slackbot",
|
||||||
|
@ -695,8 +702,10 @@ var markToAgent = map[string]string{
|
||||||
"SemrushBot": "semrush",
|
"SemrushBot": "semrush",
|
||||||
"DotBot": "dotbot",
|
"DotBot": "dotbot",
|
||||||
"AhrefsBot": "ahrefs",
|
"AhrefsBot": "ahrefs",
|
||||||
|
"proximic": "proximic",
|
||||||
"MJ12bot": "majestic",
|
"MJ12bot": "majestic",
|
||||||
"AspiegelBot": "aspiegel",
|
"AspiegelBot": "aspiegel",
|
||||||
|
"RU_Bot": "mail_ru",
|
||||||
"zgrab": "zgrab",
|
"zgrab": "zgrab",
|
||||||
}
|
}
|
||||||
/*var agentRank = map[string]int{
|
/*var agentRank = map[string]int{
|
||||||
|
@ -822,7 +831,7 @@ func (r *GenRouter) SuspiciousRequest(req *http.Request, prepend string) {
|
||||||
prepend += "\n"
|
prepend += "\n"
|
||||||
}
|
}
|
||||||
r.DumpRequest(req,prepend+"Suspicious Request")
|
r.DumpRequest(req,prepend+"Suspicious Request")
|
||||||
co.AgentViewCounter.Bump(35)
|
co.AgentViewCounter.Bump(36)
|
||||||
}
|
}
|
||||||
|
|
||||||
func isLocalHost(h string) bool {
|
func isLocalHost(h string) bool {
|
||||||
|
@ -837,7 +846,7 @@ func (r *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) {
|
||||||
w.WriteHeader(200) // 400
|
w.WriteHeader(200) // 400
|
||||||
w.Write([]byte(""))
|
w.Write([]byte(""))
|
||||||
r.DumpRequest(req,"Malformed Request T"+strconv.Itoa(typ))
|
r.DumpRequest(req,"Malformed Request T"+strconv.Itoa(typ))
|
||||||
co.AgentViewCounter.Bump(34)
|
co.AgentViewCounter.Bump(35)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Split the Host and Port string
|
// Split the Host and Port string
|
||||||
|
@ -979,7 +988,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
|
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 == "" {
|
if ua == "" {
|
||||||
co.AgentViewCounter.Bump(33)
|
co.AgentViewCounter.Bump(34)
|
||||||
if c.Dev.DebugMode {
|
if c.Dev.DebugMode {
|
||||||
var prepend string
|
var prepend string
|
||||||
for _, char := range req.UserAgent() {
|
for _, char := range req.UserAgent() {
|
||||||
|
@ -995,7 +1004,7 @@ func (r *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) {
|
||||||
for _, it := range uutils.StringToBytes(ua) {
|
for _, it := range uutils.StringToBytes(ua) {
|
||||||
if (it > 64 && it < 91) || (it > 96 && it < 123) {
|
if (it > 64 && it < 91) || (it > 96 && it < 123) {
|
||||||
buffer = append(buffer, it)
|
buffer = append(buffer, it)
|
||||||
} else if it == ' ' || it == '(' || it == ')' || it == '-' || (it > 47 && it < 58) || it == '_' || it == ';' || it == ':' || it == '.' || it == '+' || it == '~' || it == '@' || (it == ':' && bytes.Equal(buffer,[]byte("http"))) || it == ',' || it == '/' {
|
} else if it == ' ' || it == '(' || it == ')' || it == '-' || (it > 47 && it < 58) || it == ';' || it == ':' || it == '.' || it == '+' || it == '~' || it == '@' || (it == ':' && bytes.Equal(buffer,[]byte("http"))) || it == ',' || it == '/' {
|
||||||
if len(buffer) != 0 {
|
if len(buffer) != 0 {
|
||||||
if len(buffer) > 2 {
|
if len(buffer) > 2 {
|
||||||
// Use an unsafe zero copy conversion here just to use the switch, it's not safe for this string to escape from here, as it will get mutated, so do a regular string conversion in append
|
// Use an unsafe zero copy conversion here just to use the switch, it's not safe for this string to escape from here, as it will get mutated, so do a regular string conversion in append
|
||||||
|
|
|
@ -204,6 +204,7 @@
|
||||||
"exabot":"Exabot",
|
"exabot":"Exabot",
|
||||||
"sogou":"Sogou",
|
"sogou":"Sogou",
|
||||||
"toutiao":"Toutiao",
|
"toutiao":"Toutiao",
|
||||||
|
"haosou":"Qihoo 360 Search",
|
||||||
"baidu":"Baidu",
|
"baidu":"Baidu",
|
||||||
"duckduckgo":"DuckDuckBot",
|
"duckduckgo":"DuckDuckBot",
|
||||||
"seznambot":"SeznamBot",
|
"seznambot":"SeznamBot",
|
||||||
|
@ -222,8 +223,10 @@
|
||||||
"semrush":"SemrushBot",
|
"semrush":"SemrushBot",
|
||||||
"dotbot":"DotBot",
|
"dotbot":"DotBot",
|
||||||
"ahrefs":"Ahrefs",
|
"ahrefs":"Ahrefs",
|
||||||
|
"proximic":"Comscore",
|
||||||
"majestic":"MJ12bot",
|
"majestic":"MJ12bot",
|
||||||
"aspiegel":"AspiegelBot",
|
"aspiegel":"AspiegelBot",
|
||||||
|
"mail_ru":"Mail.ru bot",
|
||||||
"zgrab":"Zgrab App Scanner",
|
"zgrab":"Zgrab App Scanner",
|
||||||
"suspicious":"Suspicious",
|
"suspicious":"Suspicious",
|
||||||
"unknown":"Unknown",
|
"unknown":"Unknown",
|
||||||
|
|
|
@ -343,6 +343,7 @@ function runWebSockets(resume = false) {
|
||||||
|
|
||||||
(() => {
|
(() => {
|
||||||
addInitHook("pre_init", () => {
|
addInitHook("pre_init", () => {
|
||||||
|
runInitHook("pre_global");
|
||||||
console.log("before notify on alert")
|
console.log("before notify on alert")
|
||||||
// We can only get away with this because template_alert has no phrases, otherwise it too would have to be part of the "dance", I miss Go concurrency :(
|
// We can only get away with this because template_alert has no phrases, otherwise it too would have to be part of the "dance", I miss Go concurrency :(
|
||||||
if(!noAlerts) {
|
if(!noAlerts) {
|
||||||
|
|
|
@ -250,6 +250,7 @@ func main() {
|
||||||
"baidu",
|
"baidu",
|
||||||
"sogou",
|
"sogou",
|
||||||
"toutiao",
|
"toutiao",
|
||||||
|
"haosou",
|
||||||
"duckduckgo",
|
"duckduckgo",
|
||||||
"seznambot",
|
"seznambot",
|
||||||
"discord",
|
"discord",
|
||||||
|
@ -269,8 +270,10 @@ func main() {
|
||||||
"semrush",
|
"semrush",
|
||||||
"dotbot",
|
"dotbot",
|
||||||
"ahrefs",
|
"ahrefs",
|
||||||
|
"proximic",
|
||||||
"majestic",
|
"majestic",
|
||||||
"aspiegel",
|
"aspiegel",
|
||||||
|
"mail_ru",
|
||||||
"zgrab",
|
"zgrab",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -297,13 +300,14 @@ func main() {
|
||||||
"Baiduspider",
|
"Baiduspider",
|
||||||
"Sogou",
|
"Sogou",
|
||||||
"ToutiaoSpider",
|
"ToutiaoSpider",
|
||||||
|
"360Spider",
|
||||||
"bingbot",
|
"bingbot",
|
||||||
"BingPreview",
|
"BingPreview",
|
||||||
"Slurp",
|
"Slurp",
|
||||||
"Exabot",
|
"Exabot",
|
||||||
"SeznamBot",
|
"SeznamBot",
|
||||||
"CloudFlare",
|
"CloudFlare",
|
||||||
"archive.org_bot",
|
"archive", //archive.org_bot
|
||||||
"Uptimebot",
|
"Uptimebot",
|
||||||
"Slackbot",
|
"Slackbot",
|
||||||
"Slack",
|
"Slack",
|
||||||
|
@ -318,8 +322,10 @@ func main() {
|
||||||
"SemrushBot",
|
"SemrushBot",
|
||||||
"DotBot",
|
"DotBot",
|
||||||
"AhrefsBot",
|
"AhrefsBot",
|
||||||
|
"proximic",
|
||||||
"MJ12bot",
|
"MJ12bot",
|
||||||
"AspiegelBot",
|
"AspiegelBot",
|
||||||
|
"RU_Bot", // Mail.RU_Bot
|
||||||
"zgrab",
|
"zgrab",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -341,13 +347,14 @@ func main() {
|
||||||
"Baiduspider": "baidu",
|
"Baiduspider": "baidu",
|
||||||
"Sogou": "sogou",
|
"Sogou": "sogou",
|
||||||
"ToutiaoSpider": "toutiao",
|
"ToutiaoSpider": "toutiao",
|
||||||
|
"360Spider": "haosou",
|
||||||
"bingbot": "bing",
|
"bingbot": "bing",
|
||||||
"BingPreview": "bing",
|
"BingPreview": "bing",
|
||||||
"Slurp": "slurp",
|
"Slurp": "slurp",
|
||||||
"Exabot": "exabot",
|
"Exabot": "exabot",
|
||||||
"SeznamBot": "seznambot",
|
"SeznamBot": "seznambot",
|
||||||
"CloudFlare": "cloudflare", // Track alwayson specifically in case there are other bots?
|
"CloudFlare": "cloudflare", // Track alwayson specifically in case there are other bots?
|
||||||
"archive.org_bot": "archive_org",
|
"archive": "archive_org", //archive.org_bot
|
||||||
"Uptimebot": "uptimebot",
|
"Uptimebot": "uptimebot",
|
||||||
"Slackbot": "slackbot",
|
"Slackbot": "slackbot",
|
||||||
"Slack": "slackbot",
|
"Slack": "slackbot",
|
||||||
|
@ -362,8 +369,10 @@ func main() {
|
||||||
"SemrushBot": "semrush",
|
"SemrushBot": "semrush",
|
||||||
"DotBot": "dotbot",
|
"DotBot": "dotbot",
|
||||||
"AhrefsBot": "ahrefs",
|
"AhrefsBot": "ahrefs",
|
||||||
|
"proximic": "proximic",
|
||||||
"MJ12bot": "majestic",
|
"MJ12bot": "majestic",
|
||||||
"AspiegelBot": "aspiegel",
|
"AspiegelBot": "aspiegel",
|
||||||
|
"RU_Bot": "mail_ru", // Mail.RU_Bot
|
||||||
"zgrab": "zgrab",
|
"zgrab": "zgrab",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -715,7 +724,7 @@ func (r *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) {
|
||||||
for _, it := range uutils.StringToBytes(ua) {
|
for _, it := range uutils.StringToBytes(ua) {
|
||||||
if (it > 64 && it < 91) || (it > 96 && it < 123) {
|
if (it > 64 && it < 91) || (it > 96 && it < 123) {
|
||||||
buffer = append(buffer, it)
|
buffer = append(buffer, it)
|
||||||
} else if it == ' ' || it == '(' || it == ')' || it == '-' || (it > 47 && it < 58) || it == '_' || it == ';' || it == ':' || it == '.' || it == '+' || it == '~' || it == '@' || (it == ':' && bytes.Equal(buffer,[]byte("http"))) || it == ',' || it == '/' {
|
} else if it == ' ' || it == '(' || it == ')' || it == '-' || (it > 47 && it < 58) || it == ';' || it == ':' || it == '.' || it == '+' || it == '~' || it == '@' || (it == ':' && bytes.Equal(buffer,[]byte("http"))) || it == ',' || it == '/' {
|
||||||
if len(buffer) != 0 {
|
if len(buffer) != 0 {
|
||||||
if len(buffer) > 2 {
|
if len(buffer) > 2 {
|
||||||
// Use an unsafe zero copy conversion here just to use the switch, it's not safe for this string to escape from here, as it will get mutated, so do a regular string conversion in append
|
// Use an unsafe zero copy conversion here just to use the switch, it's not safe for this string to escape from here, as it will get mutated, so do a regular string conversion in append
|
||||||
|
|
|
@ -31,7 +31,7 @@ function noxMenuBind() {
|
||||||
|
|
||||||
(() => {
|
(() => {
|
||||||
if(window.location.pathname.startsWith("/panel/")) {
|
if(window.location.pathname.startsWith("/panel/")) {
|
||||||
addInitHook("pre_init", () => noAlerts = true);
|
addInitHook("pre_global", () => noAlerts = true);
|
||||||
}
|
}
|
||||||
|
|
||||||
function moveAlerts() {
|
function moveAlerts() {
|
||||||
|
|
Loading…
Reference in New Issue