add archive.org user agent

This commit is contained in:
Azareal 2020-03-07 13:49:44 +10:00
parent ce306d2a4b
commit b1014d5647
3 changed files with 36 additions and 29 deletions

View File

@ -596,19 +596,20 @@ var agentMapEnum = map[string]int{
"twitter": 22, "twitter": 22,
"facebook": 23, "facebook": 23,
"cloudflare": 24, "cloudflare": 24,
"uptimebot": 25, "archive_org": 25,
"slackbot": 26, "uptimebot": 26,
"apple": 27, "slackbot": 27,
"discourse": 28, "apple": 28,
"alexa": 29, "discourse": 29,
"lynx": 30, "alexa": 30,
"blank": 31, "lynx": 31,
"malformed": 32, "blank": 32,
"suspicious": 33, "malformed": 33,
"semrush": 34, "suspicious": 34,
"dotbot": 35, "semrush": 35,
"aspiegel": 36, "dotbot": 36,
"zgrab": 37, "aspiegel": 37,
"zgrab": 38,
} }
var reverseAgentMapEnum = map[int]string{ var reverseAgentMapEnum = map[int]string{
0: "unknown", 0: "unknown",
@ -636,19 +637,20 @@ var reverseAgentMapEnum = map[int]string{
22: "twitter", 22: "twitter",
23: "facebook", 23: "facebook",
24: "cloudflare", 24: "cloudflare",
25: "uptimebot", 25: "archive_org",
26: "slackbot", 26: "uptimebot",
27: "apple", 27: "slackbot",
28: "discourse", 28: "apple",
29: "alexa", 29: "discourse",
30: "lynx", 30: "alexa",
31: "blank", 31: "lynx",
32: "malformed", 32: "blank",
33: "suspicious", 33: "malformed",
34: "semrush", 34: "suspicious",
35: "dotbot", 35: "semrush",
36: "aspiegel", 36: "dotbot",
37: "zgrab", 37: "aspiegel",
38: "zgrab",
} }
var markToAgent = map[string]string{ var markToAgent = map[string]string{
"OPR": "opera", "OPR": "opera",
@ -672,6 +674,7 @@ var markToAgent = map[string]string{
"Exabot": "exabot", "Exabot": "exabot",
"SeznamBot": "seznambot", "SeznamBot": "seznambot",
"CloudFlare": "cloudflare", "CloudFlare": "cloudflare",
"archive.org_bot": "archive_org",
"Uptimebot": "uptimebot", "Uptimebot": "uptimebot",
"Slackbot": "slackbot", "Slackbot": "slackbot",
"Discordbot": "discord", "Discordbot": "discord",
@ -809,7 +812,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(33) co.AgentViewCounter.Bump(34)
} }
func isLocalHost(h string) bool { func isLocalHost(h string) bool {
@ -824,7 +827,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(32) co.AgentViewCounter.Bump(33)
} }
// Split the Host and Port string // Split the Host and Port string
@ -966,7 +969,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(31) co.AgentViewCounter.Bump(32)
if c.Dev.DebugMode { if c.Dev.DebugMode {
var prepend string var prepend string
for _, char := range req.UserAgent() { for _, char := range req.UserAgent() {

View File

@ -209,6 +209,7 @@
"discord":"Discord", "discord":"Discord",
"twitter":"Twitterbot", "twitter":"Twitterbot",
"cloudflare":"Cloudflare Alwayson", "cloudflare":"Cloudflare Alwayson",
"archive_org":"Archive.org",
"uptimebot":"Uptimebot", "uptimebot":"Uptimebot",
"slackbot":"Slackbot", "slackbot":"Slackbot",
"facebook":"FacebookBot", "facebook":"FacebookBot",

View File

@ -255,6 +255,7 @@ func main() {
"twitter", "twitter",
"facebook", "facebook",
"cloudflare", "cloudflare",
"archive_org",
"uptimebot", "uptimebot",
"slackbot", "slackbot",
"apple", "apple",
@ -298,6 +299,7 @@ func main() {
"Exabot", "Exabot",
"SeznamBot", "SeznamBot",
"CloudFlare", "CloudFlare",
"archive.org_bot",
"Uptimebot", "Uptimebot",
"Slackbot", "Slackbot",
"Discordbot", "Discordbot",
@ -337,6 +339,7 @@ func main() {
"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",
"Uptimebot": "uptimebot", "Uptimebot": "uptimebot",
"Slackbot": "slackbot", "Slackbot": "slackbot",
"Discordbot": "discord", "Discordbot": "discord",