diff --git a/_uaupdate/main.go b/_uaupdate/main.go index 49f1523..cc0ebe2 100644 --- a/_uaupdate/main.go +++ b/_uaupdate/main.go @@ -3,15 +3,13 @@ package main import ( "os" "regexp" - "strconv" - "github.com/buger/jsonparser" "github.com/vulncheck-oss/go-exploit/output" "github.com/vulncheck-oss/go-exploit/protocol" ) func main() { - uri := "https://raw.githubusercontent.com/projectdiscovery/useragent/main/useragent_data.json" + uri := "https://www.whatismybrowser.com/guides/the-latest-user-agent/chrome" resp, body, ok := protocol.HTTPSendAndRecv("GET", uri, "") if !ok { return @@ -23,34 +21,9 @@ func main() { return } - // looking in tags for the latest Chrome on Windows whatever - chromePattern := regexp.MustCompile(`^Chrome (\d+) on Windows \d+$`) - - // pattern to find the Safari string so we can drop everything after - safariPattern := regexp.MustCompile(`^.*Chrome/\d+.\d+.\d+.\d+ Safari/[\d\.]+`) - - // store the newest version as we loop through the data - latestChromeUA := "" - latestChromeVer := 0 - - _, _ = jsonparser.ArrayEach([]byte(body), func(entry []byte, _ jsonparser.ValueType, _ int, _ error) { - _, _ = jsonparser.ArrayEach(entry, func(tag []byte, _ jsonparser.ValueType, _ int, _ error) { - matches := chromePattern.FindStringSubmatch(string(tag)) - if len(matches) == 2 { - version, _ := strconv.Atoi(matches[1]) - if version > latestChromeVer { - ua, _ := jsonparser.GetString(entry, "Raw") - cleanedUA := safariPattern.FindString(ua) - if cleanedUA != "" { - latestChromeUA = cleanedUA - latestChromeVer = version - } - } - } - }, "Tags") - }) - - if len(latestChromeUA) != 0 { - _ = os.WriteFile("../protocol/http-user-agent.txt", []byte(latestChromeUA), 0o644) + // looking in the body for the latest Chrome on Windows whatever + matches := regexp.MustCompile(`
  • (Mozilla/\d+.\d+ \(Windows NT [^<]+)
  • `).FindStringSubmatch(body) + if len(matches) != 0 { + _ = os.WriteFile("../protocol/http-user-agent.txt", []byte(matches[1]), 0o644) } } diff --git a/protocol/http-user-agent.txt b/protocol/http-user-agent.txt index 06202d8..a960b90 100644 --- a/protocol/http-user-agent.txt +++ b/protocol/http-user-agent.txt @@ -1 +1 @@ -Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36 \ No newline at end of file +Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36 \ No newline at end of file