package yu_useragent import ( "fmt" yu_rand "gogs.qqck.cn/s/tools/rand" ) // ************************************************************************************************************************************ ChromePc func ChromePcWindows() string { Safari := rand_safari() Chrome := rand_chrome() WindowsNT := rand_windows_version() return fmt.Sprintf("Mozilla/5.0 (Windows NT %s; WOW64) AppleWebKit/%s (KHTML, like Gecko) Chrome/%s Safari/%s", WindowsNT, Safari, Chrome, Safari) } func ChromePcLinux() string { Safari := rand_safari() Chrome := rand_chrome() Linux := rand_linux_vertion() return fmt.Sprintf("Mozilla/5.0 (X11; %s) AppleWebKit/%s (KHTML, like Gecko) Chrome/%s Safari/%s", Linux, Safari, Chrome, Safari) } func ChromePcMac() string { Safari := rand_safari() Chrome := rand_chrome() mac_version := rand_mac_version() return fmt.Sprintf("Mozilla/5.0 (Macintosh; Intel Mac OS X %s) AppleWebKit/%s (KHTML, like Gecko) Chrome/%s Safari/%s", mac_version, Safari, Chrome, Safari) } func ChromePc() string { num := yu_rand.Uint31n(3) if num == 0 { return ChromePcWindows() } else if num == 1 { return ChromePcMac() } else { return ChromePcLinux() } } // ************************************************************************************************************************************ FirefoxPc func FirefoxPcWindows() string { Firefox := rand_firefox() WindowsNT := rand_windows_version() return fmt.Sprintf("Mozilla/5.0 (Windows NT %s; WOW64; rv:%s) Gecko/20100101 Firefox/%s", WindowsNT, Firefox, Firefox) } func FirefoxPcLinux() string { Firefox := rand_firefox() Linux := rand_linux_vertion() return fmt.Sprintf("Mozilla/5.0 (X11; %s; rv:%s) Gecko/20100101 Firefox/%s", Linux, Firefox, Firefox) } func FirefoxPcMac() string { Firefox := rand_firefox() mac_version := rand_mac_version() return fmt.Sprintf("Mozilla/5.0 (Macintosh; Intel Mac OS X %s; rv:%s) Gecko/20100101 Firefox/%s", mac_version, Firefox, Firefox) } func FirefoxPc() string { num := yu_rand.Uint31n(3) if num == 0 { return FirefoxPcWindows() } else if num == 1 { return FirefoxPcMac() } else { return FirefoxPcLinux() } } // ************************************************************************************************************************************ Pc func PcWindows() string { num := yu_rand.Uint31n(2) if num == 0 { return ChromePcWindows() } else { return FirefoxPcWindows() } } func PcLinux() string { num := yu_rand.Uint31n(2) if num == 0 { return ChromePcLinux() } else { return FirefoxPcLinux() } } func PcMac() string { num := yu_rand.Uint31n(2) if num == 0 { return ChromePcMac() } else { return FirefoxPcMac() } } func Pc() string { num := yu_rand.Uint31n(3) if num == 0 { return PcWindows() } else if num == 1 { return PcLinux() } else { return PcMac() } } // ************************************************************************************************************************************ Wechat func WechatAndroid() string { androidVersion := rand_android_version() androidPhone := rand_android_phone() Safari := rand_safari() Chrome := rand_chrome() XWEB := fmt.Sprintf("%d", yu_rand.IntMinMax(3317, 4317)) MMWEBSDK := "" if yu_rand.Uint31n(2) == 0 { MMWEBSDK = fmt.Sprintf("20220%d0%d", yu_rand.IntMinMax(1, 9), yu_rand.IntMinMax(0, 9)) } else { MMWEBSDK = fmt.Sprintf("20%d%d%d", yu_rand.IntMinMax(19, 21), yu_rand.IntMinMax(10, 12), yu_rand.IntMinMax(10, 26)) } MMWEBID := fmt.Sprintf("%d", yu_rand.IntMinMax(8654, 9654)) MicroMessenger := fmt.Sprintf("8.0.%d.%d(0x%d)", yu_rand.IntMinMax(15, 25), yu_rand.IntMinMax(1200, 2200), yu_rand.IntMinMax(27001937, 28001937)) NetType := rand_nettype() // Mozilla/5.0 (Linux; Android 12; SM-G9980 Build/SP1A.210812.016; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/86.0.4240.99 XWEB/4317 MMWEBSDK/20220706 Mobile Safari/537.36 MMWEBID/9654 MicroMessenger/8.0.25.2200(0x28001937) WeChat/arm64 Weixin NetType/WIFI Language/zh_CN ABI/arm64 return fmt.Sprintf("Mozilla/5.0 (Linux; Android %s; %s; wv) AppleWebKit/%s (KHTML, like Gecko) Version/4.0 Chrome/%s XWEB/%s MMWEBSDK/%s Mobile Safari/%s MMWEBID/%s MicroMessenger/%s WeChat/arm64 Weixin NetType/%s Language/zh_CN ABI/arm64", androidVersion, androidPhone, Safari, Chrome, XWEB, MMWEBSDK, Safari, MMWEBID, MicroMessenger, NetType, ) } func WechatIphone() string { mac_version := rand_mac_version() Safari := rand_safari() j_Mobile := yu_rand.S0AZ(6) MicroMessenger := fmt.Sprintf("8.0.%d.%d(0x%d)", yu_rand.IntMinMax(15, 25), yu_rand.IntMinMax(1200, 2200), yu_rand.IntMinMax(27001937, 28001937)) NetType := rand_nettype() // Mozilla/5.0 (iPhone; CPU iPhone OS 15_0_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/8.0.29(0x18001d30) NetType/WIFI Language/zh_CN return fmt.Sprintf("Mozilla/5.0 (iPhone; CPU iPhone OS %s like Mac OS X) AppleWebKit/%s (KHTML, like Gecko) Mobile/%s MicroMessenger/%s NetType/%s Language/zh_CN", mac_version, Safari, j_Mobile, MicroMessenger, NetType, ) } // Wechat wechat 微信 func Wechat() string { num := yu_rand.Uint31n(2) if num == 0 { return WechatAndroid() } else { return WechatIphone() } } // ************************************************************************************************************************************ Wechat func QQAndroid() string { androidVersion := rand_android_version() androidPhone := rand_android_phone() Safari := rand_safari() Chrome := rand_chrome() NetType := rand_nettype() GlobalDensityScale := fmt.Sprintf("0.%d", yu_rand.IntMinMax(95000004, 96000004)) // Mozilla/5.0 (Linux; Android 12; SM-G9980 Build/SP1A.210812.016; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/99.0.4844.88 Mobile Safari/537.36 V1_AND_SQ_8.9.13_3350_YYB_D A_8091300 QQ/8.9.13.9280 NetType/WIFI WebP/0.4.1 Pixel/1080 StatusBarHeight/75 SimpleUISwitch/0 QQTheme/1000 InMagicWin/0 StudyMode/0 CurrentMode/0 CurrentFontScale/1.0 GlobalDensityScale/0.96000004 AppId/537137213 AllowLandscape/false return fmt.Sprintf("Mozilla/5.0 (Linux; Android %s; %s; wv) AppleWebKit/%s (KHTML, like Gecko) Version/4.0 Chrome/%s Mobile Safari/%s V1_AND_SQ_8.9.13_3350_YYB_D A_8091300 QQ/8.9.13.9280 NetType/%s WebP/0.4.1 Pixel/1080 StatusBarHeight/75 SimpleUISwitch/0 QQTheme/1000 InMagicWin/0 StudyMode/0 CurrentMode/0 CurrentFontScale/1.0 GlobalDensityScale/%s AppId/537137213 AllowLandscape/false", androidVersion, androidPhone, Safari, Chrome, Safari, NetType, GlobalDensityScale, ) } func QQIphone() string { mac_version := rand_mac_version() Safari := rand_safari() j_Mobile := yu_rand.S0AZ(6) Apple := rand_iphone_phone() NetType := rand_nettype() // Mozilla/5.0 (iPhone; CPU iPhone OS 15_0_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/19A404 QQ/8.5.5.648 V1_IPH_SQ_8.5.5_1_APP_A Pixel/1170 MiniAppEnable SimpleUISwitch/0 QQTheme/1000 Core/WKWebView Device/Apple(iPhone 12 Pro) NetType/WIFI QBWebViewType/1 WKType/1 return fmt.Sprintf("Mozilla/5.0 (iPhone; CPU iPhone OS %s like Mac OS X) AppleWebKit/%s (KHTML, like Gecko) Mobile/%s QQ/8.9.13.9280 V1_IPH_SQ_8.9.13_3350_APP_A Pixel/1170 MiniAppEnable SimpleUISwitch/0 QQTheme/1000 Core/WKWebView Device/Apple(%s) NetType/%s QBWebViewType/1 WKType/1", mac_version, Safari, j_Mobile, Apple, NetType, ) } // QQ QQ func QQ() string { num := yu_rand.Uint31n(2) if num == 0 { return QQAndroid() } else { return QQIphone() } } // ************************************************************************************************************************************ Android // MobileAndroid android手机无线端 func MobileAndroid() string { num := yu_rand.Uint31n(2) if num == 0 { return WechatAndroid() } else { return QQAndroid() } } // ************************************************************************************************************************************ Iphone // MobileIphone iphone手机无线端 func MobileIphone() string { num := yu_rand.Uint31n(2) if num == 0 { return WechatIphone() } else { return QQIphone() } } // ************************************************************************************************************************************ Wap // Mobile 手机端 func Mobile() string { num := yu_rand.Uint31n(2) if num == 0 { return MobileAndroid() } else { return MobileIphone() } } // ************************************************************************************************************************************ Rand // Rand 随机 func Rand() string { num := yu_rand.Uint31n(2) if num == 0 { return Pc() } else { return Mobile() } }