Commit e6aa0da8 authored by 王明明's avatar 王明明

使用app端

parent eed0ac4a
package app
import "test/sensor"
type DeviceInfo struct {
brand string
model string
androidVersion string
manufacturer string
cputype string
SDKINT string
screenSize string
}
func randomScreenSize() string {
return ANDROID_SCREEN_SIZE[sensor.RandRandom(int64(len(ANDROID_SCREEN_SIZE)))]
}
func NewDeviceInfo() *DeviceInfo {
cpu := RandomCPU()
androidVersion := RandomANDROIDVERSION()
return &DeviceInfo{
brand: RandomANDROIDBRAND(),
model: RandomANDROIDMODEL(),
androidVersion: androidVersion,
manufacturer: RandomMANUFACTURER(),
cputype: cpu,
SDKINT: ANDROID_VERSION[androidVersion],
screenSize: randomScreenSize(),
}
}
var (
ANDROID_BRAND = []string{"Acer", "ARCHOS", "ASUS", "Casio", "Dell", "Garmin-ASUS", "HTC", "Huawei", "Kyocera", "Lenovo", "LG", "Motorola", "Panasonic", "Philips", "Samsung", "Sony", "Sony Ericsson", "Toshiba", "ZTE"}
ANDROID_MODEL = []string{"SCH-I535", "DROIDRAZR", "SAMSUNG-SGH-I747", "SGH-T999", "SPH-L710", "PC36100", "DROIDBIONIC", "ADR6400L", "SGH-T989", "SPH-D710", "ADR6300", "GT-I9300", "DROIDX", "ADR6350", "HTCOneX", "DROIDRAZRHD", "XT910", "Nexus4", "DROID4", "NexusS", "HTCVLE_U", "EVO", "SAMSUNG-SGH-I727", "SCH-I510", "Nexus7", "XT907", "PG86100", "HTCSensation4G", "NexusS4G", "SPH-D720", "HTCGlacier", "SCH-I500", "GT-I9100", "LG-P999", "ADR6425LVW", "SPH-D700", "SAMSUNG-SGH-I317", "SAMSUNG-SGH-I777", "SGH-T959V", "SCH-I405", "SCH-I415", "DROID2GLOBAL", "T-MobileG2", "DROIDPro", "SAMSUNG-SGH-I717", "SGH-I747M", "DROID3", "MB860", "ADR6410LVW", "NexusOne", "SGH-T769", "DROIDX2", "SAMSUNG-SGH-I997", "GT-I9100", "GT-I9001", "GT-I9000", "GT-I8150", "D700", "GT-S5660", "GT-5830L", "S5360", "GT-S5570", "I200", "XT894", "LG-P500", "GT-N7100", "Zio", "DesireHD", "HTCEVODesign4G", "5860E", "A100", "A200", "A500", "ADR6330VW", "ADR8995", "ADR910L", "HTCOneS", "GT-I9100P", "LG-E971", "GT-I9300T", "GT-N7000", "HTCDesireS", "HTCAmaze4G", "GT-I8190", "GT-I8190N", "GT-I9305", "SGH-I747", "HTCVision", "HTCDesire", "HTC6435LVW", "EK-GC100", "HTCIncredibleS", "HTCOneV", "GT-S5830", "SGH-T989D", "SGH-I717D", "GT-N7105", "GT-I9100M", "SGH-I317M", "XT615", "HTCChaChaA810e", "LG-E973", "ST26i", "LT26i", "GT-S5839i", "MT15i", "LG-E400", "GT-P1000", "HTCWildfireSA510e", "GT-I9100T", "LG-C555", "SAMSUNG-SGH-I896", "XT905", "HTCDesireHDA9191", "HTCDesireX", "GT-I9210T", "HTCLegend", "HTCSensationZ710e", "U9202L-1", "GT-P3100", "GT-P5100", "GT-P5110", "LT25i", "SGH-T959D", "DROIDPRO", "GT-I9305T", "HTCDesireC", "LG-P880", "LT30at", "XT603", "C5303", "GT-I9210", "GT-N7105T", "GT-N8000", "GT-P3110", "GT-P7500", "GT-S7560M", "Garmin-AsusA50", "LT29i", "MB525", "SCH-I605", "SGH-I717R", "SGH-T589W", "SGH-T999V", "T-MobileVivacity", "WIKO-CINKSLIM", "SHW-M250S1", "SHV-E250S1", "SHV-E210S", "SHV-E250K", "SHV-E210K", "SHV-E160K", "SHV-E160S", "SCH-I545", "SAMSUNG-SGH-I337", "HTCOne", "SGH-M919", "SPH-L720", "SCH-I605", "GT-I9505", "SGH-T889", "HTCONE", "HTC6435LVW", "SPH-L900", "SAMSUNG-SGH-I537", "GT-N7100", "HTC6500LVW", "LG-P769", "XT1080", "GT-I9305", "GT-I9505G", "GT-I9500", "SGH-I337M", "XT1058", "VS8404G", "GT-N7105", "C6603", "LG-MS770", "GT-N7000", "HTCOneX+", "DesireHD", "LG-LS970", "MB855", "XT1060", "MB886", "HTC_PN071", "SGH-T999L", "HTCEVOV4G", "MB865", "SCH-R530U", "SGH-T679", "SGH-T679", "HTCPH39100", "HTC_Amaze_4G", "myTouch_4G_Slide", "SPH-L300", "SCH-I200", "SPH-D710VMUB", "HTCOne801e", "SPH-D710BST", "LG-E970", "SHV-E250S", "SGH-T699", "SCH-R530M", "C6606", "XT897", "LG-E980", "LG-VM696", "PH44100", "VS9204G", "SM-N900V"}
CPU_MANUFACTURER = []string{"amd", "allwinner", "amlogic", "apple", "broadcom", "cyrix", "freescale", "fujitsu", "hisilicon", "hitachi", "hygon", "ibm", "intel", "mcst", "marvell", "mediatek", "motorola", "nexgen", "nvidia", "oracle", "qualcomm", "rise technology", "rockchip", "samsung", "sifive", "sigmatel", "texas instruments", "tilera", "transmeta", "via", "wave computing", "winchip", "zhaoxin"}
CPU_TYPE = []string{"qcom", "mtk", "intel", "amd", "exynos", "unisoc"}
ANDROID_SCREEN_SIZE = []string{"128,72", "256,144", "384,216", "512,288", "640,360", "768,432", "896,504", "1024,576", "1152,648", "1280,720", "1408,792", "1536,864", "1664,936", "1792,1008", "1920,1080", "2048,1152", "2176,1224", "2304,1296", "2432,1368", "2560,1440", "2688,1512", "2816,1584", "2944,1656", "3072,1728", "3200,1800", "3328,1872", "3456,1944", "3584,2016", "3712,2088", "3840,2160", "3968,2232", "4096,2304", "4224,2376", "4352,2448", "4480,2520", "4608,2592", "4736,2664", "4864,2736", "4992,2808", "5120,2880", "5248,2952", "5376,3024", "5504,3096", "5632,3168", "5760,3240", "5888,3312", "6016,3384", "6144,3456", "6272,3528", "6400,3600", "6528,3672", "6656,3744", "6784,3816", "6912,3888", "7040,3960", "7168,4032", "7296,4104", "7424,4176", "7552,4248", "7680,4320"}
ANDROID_VERSION = map[string]string{
"5.1": "22",
"6.0": "23",
"7.0": "24",
"7.1": "25",
"8.0.0": "26",
"8.1.0": "27",
"9.0": "28",
"10.0": "29",
"11.0": "30",
}
)
func RandomANDROIDBRAND() string {
return ANDROID_BRAND[sensor.RandRandom(int64(len(ANDROID_BRAND)))]
}
func RandomANDROIDMODEL() string {
return ANDROID_MODEL[sensor.RandRandom(int64(len(ANDROID_MODEL)))]
}
func RandomANDROIDVERSION() string {
var list []string
for key, _ := range ANDROID_VERSION {
list = append(list, key)
}
selectKey := list[sensor.RandRandom(int64(len(list)))]
//version := ANDROID_VERSION[selectKey]
return selectKey
}
func RandomMANUFACTURER() string {
return CPU_MANUFACTURER[sensor.RandRandom(int64(len(CPU_MANUFACTURER)))]
}
func RandomCPU() string {
return CPU_TYPE[sensor.RandRandom(int64(len(CPU_TYPE)))]
}
package app
import (
"bytes"
"crypto/aes"
"crypto/cipher"
"crypto/rand"
"crypto/rsa"
"crypto/x509"
"encoding/base64"
"fmt"
"io"
)
func RsaEncrypt(keys string, text []byte) []byte {
publicKeyBytes, err := base64.StdEncoding.DecodeString(keys)
if err != nil {
panic(err)
}
//publicKeyBytes := []byte
publicKey, err := x509.ParsePKIXPublicKey(publicKeyBytes)
if err != nil {
panic(err)
}
msg := []byte(text)
ciphertext, err := rsa.EncryptPKCS1v15(rand.Reader, publicKey.(*rsa.PublicKey), msg)
if err != nil {
panic(err)
}
//fmt.Println(base64.StdEncoding.EncodeToString(ciphertext))
return ciphertext
}
func RsaDecrypt() {
}
func main() {
publicKeyBase64 := "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC7zgZ0bUDZ9fjG4+Mg7z0fHwYKj6y+1Sg7nJm" +
"9zjK4a4+TkG4LhMwF7sMnq3f8v1Nqj1uE9VZjWQ/8TtTQ1yJY0d6aWj8aRvRi35Z6O9XbXq3j8i" +
"f5M5c5pWUg8vU0jZ2dH9X6XeU6xjv6hJY1yBDMN0o8WjRvGvBk/9oX9Xj8WqBp1v5i5F5p5c6rC" +
"v6DQIDAQAB"
publicKeyBytes, err := base64.StdEncoding.DecodeString(publicKeyBase64)
if err != nil {
panic(err)
}
publicKey, err := x509.ParsePKCS1PublicKey(publicKeyBytes)
if err != nil {
panic(err)
}
msg := []byte("hello, world!")
ciphertext, err := rsa.EncryptPKCS1v15(rand.Reader, publicKey, msg)
if err != nil {
panic(err)
}
fmt.Println(base64.StdEncoding.EncodeToString(ciphertext))
}
func AesEncrypt(key []byte, plaintext []byte) ([]byte, []byte, error) {
block, err := aes.NewCipher(key)
if err != nil {
panic(err)
return nil, nil, err
}
iv := make([]byte, aes.BlockSize)
if _, err := io.ReadFull(rand.Reader, iv); err != nil {
return nil, nil, err
}
blockSize := block.BlockSize()
padding := blockSize - len(plaintext)%blockSize
padtext := bytes.Repeat([]byte{byte(padding)}, padding)
plaintext = append(plaintext, padtext...)
mode := cipher.NewCBCEncrypter(block, iv)
ciphertext := make([]byte, aes.BlockSize+len(plaintext))
mode.CryptBlocks(ciphertext, plaintext)
return ciphertext, iv, nil
}
func getKeyBytes(key string) []byte {
keyBytes := []byte(key)
switch l := len(keyBytes); {
case l < 16:
keyBytes = append(keyBytes, make([]byte, 16-l)...)
case l > 16:
keyBytes = keyBytes[:16]
}
return keyBytes
}
func encrypt(key, iv []byte, origData []byte) ([]byte, error) {
keyBytes := key
block, err := aes.NewCipher(keyBytes)
if err != nil {
return nil, err
}
blockSize := block.BlockSize()
origData = PKCS5Padding(origData, blockSize)
blockMode := cipher.NewCBCEncrypter(block, iv[:blockSize])
crypted := make([]byte, len(origData))
blockMode.CryptBlocks(crypted, origData)
return crypted, nil
}
func decrpt(key []byte, crypted []byte) ([]byte, error) {
keyBytes := key
block, err := aes.NewCipher(keyBytes)
if err != nil {
return nil, err
}
blockSize := block.BlockSize()
blockMode := cipher.NewCBCDecrypter(block, keyBytes[:blockSize])
origData := make([]byte, len(crypted))
blockMode.CryptBlocks(origData, crypted)
origData = PKCS5UnPadding(origData)
return origData, nil
}
func PKCS5Padding(ciphertext []byte, blockSize int) []byte {
padding := blockSize - len(ciphertext)%blockSize
padtext := bytes.Repeat([]byte{byte(padding)}, padding)
return append(ciphertext, padtext...)
}
func PKCS5UnPadding(origData []byte) []byte {
length := len(origData)
unpadding := int(origData[length-1])
return origData[:(length - unpadding)]
}
func Encrypt(key, iv []byte, val string) ([]byte, error) {
origData := []byte(val)
crypted, err := encrypt(key, iv, origData)
if err != nil {
return nil, err
}
return crypted, nil
}
This diff is collapsed.
......@@ -20,6 +20,7 @@ require (
github.com/antchfx/xpath v1.2.3 // indirect
github.com/bogdanfinn/utls v1.5.14 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/klauspost/compress v1.15.12 // indirect
github.com/tam7t/hpkp v0.0.0-20160821193359-2b70b4024ed5 // indirect
golang.org/x/crypto v0.1.0 // indirect
......
......@@ -21,6 +21,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE=
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI=
github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
github.com/imroc/biu v0.0.0-20170329141542-0376ce6761c0 h1:pkyNAS9IQiZgseFrdhZC4cloBo2k2O2Son/k+3NquwY=
......
......@@ -11,6 +11,7 @@ import (
func Float64() float64 {
return float64(RandRandom(1000)) / float64(1000)
//return 0.22201
}
func GetRandomTime() int64 {
f := Float64()*100 + 30
......
......@@ -12,6 +12,7 @@ import (
"net/url"
"strings"
"sync"
"test/app"
"test/model"
"time"
)
......@@ -130,20 +131,20 @@ func actU2() {
}
func actVY() {
t1 := time.Now()
//resp, err := http.Post("http://lcc.unififi.com/akamai/gen",
resp, err := http.Post(akmUrl,
"application/json", strings.NewReader("{\"type\": \"VY\", \"proxy\": \""+px+"\"}"))
//"application/json", strings.NewReader("{\"type\": \"VY\", \"proxy\": \"http://127.0.0.1:8890\"}"))
//resp, err := http.Post("http://127.0.0.1:59001/akamai/gen", "application/json", strings.NewReader("{\"type\": \"u2\", \"proxy\": \"http://user-unifflcc-region-us:q39CEBTs5A5YQXor@pr.roxlabs.cn:4600\"}"))
if err != nil {
//panic(err)
fmt.Println(err)
return
}
body, _ := ioutil.ReadAll(resp.Body)
fmt.Println("abck cost", time.Since(t1).String())
testVY(px, body)
//t1 := time.Now()
////resp, err := http.Post("http://lcc.unififi.com/akamai/gen",
//resp, err := http.Post(akmUrl,
// "application/json", strings.NewReader("{\"type\": \"VY\", \"proxy\": \""+px+"\"}"))
////"application/json", strings.NewReader("{\"type\": \"VY\", \"proxy\": \"http://127.0.0.1:8890\"}"))
////resp, err := http.Post("http://127.0.0.1:59001/akamai/gen", "application/json", strings.NewReader("{\"type\": \"u2\", \"proxy\": \"http://user-unifflcc-region-us:q39CEBTs5A5YQXor@pr.roxlabs.cn:4600\"}"))
//if err != nil {
// //panic(err)
// fmt.Println(err)
// return
//}
//body, _ := ioutil.ReadAll(resp.Body)
//fmt.Println("abck cost", time.Since(t1).String())
testVY(px, []byte("sss"))
}
func actnk() {
t1 := time.Now()
......@@ -167,12 +168,12 @@ var px = "http://user-unifflcc-region-de:q39CEBTs5A5YQXor@pr.roxlabs.cn:4600"
var akmUrl = "http://lcc.unififi.com/akamai/gen"
func main() {
Debug = flag.Bool("debug", false, "本地调试")
Debug = flag.Bool("debug", true, "本地调试")
flag.Parse()
r := rand.Intn(1149) + 10000
px = fmt.Sprintf("http://user-unifflcc-region-de-sessid-%d-sesstime-5-keep-true:q39CEBTs5A5YQXor@pr.roxlabs.cn:4600", r)
if *Debug {
//px = "http://127.0.0.1:8890"
px = "http://127.0.0.1:8890"
akmUrl = "http://127.0.0.1:59001/akamai/gen"
}
fmt.Println(px)
......@@ -203,7 +204,8 @@ func main() {
}
func testVY(px string, data []byte) {
datas := "{\n\t\"DeviceType\": \"WEB\",\n\t\"UserAgent\": \"Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1\",\n\t\"Udid\": 'c4bf-275d-76b1-ff7f-83c3-cfcd',\n\t\"IP\": \"235.231.34.152\",\n\t\"AppVersion\": \"17.2.0\",\n\t\"Domain\": \"https://m.vueling.com\",\n\t\"DiscountType\": 0,\n\t\"Paxs\": [{\n\t\t\"PaxType\": \"ADT\",\n\t\t\"Quantity\": \"1\"\n\t}, {\n\t\t\"PaxType\": \"CHD\",\n\t\t\"Quantity\": \"0\"\n\t}, {\n\t\t\"PaxType\": \"INF\",\n\t\t\"Quantity\": \"0\"\n\t}],\n\t\"CurrencyCode\": \"EUR\",\n\t\"AirportDateTimeList\": [{\n\t\t\"ArrivalStation\": \"BCN\",\n\t\t\"DepartureStation\": \"LCG\",\n\t\t\"MarketDateDeparture\": \"2023-03-20\"\n\t}],\n\t\"Language\": \"en-GB\"\n}"
datas := "{\n \"AirportDateTimeList\": [\n {\n \"ArrivalStation\": \"BCN\",\n \"DepartureStation\": \"LCG\",\n \"MarketDateDeparture\": \"2023-04-07\"\n }\n ],\n \"CurrencyCode\": \"EUR\",\n \"DiscountType\": 0,\n \"Paxs\": [\n {\n \"PaxType\": \"ADT\",\n \"Quantity\": 1\n },\n {\n \"PaxType\": \"CHD\",\n \"Quantity\": 0\n },\n {\n \"PaxType\": \"INF\",\n \"Quantity\": 0\n }\n ],\n \"PromoType\": 0,\n \"AppVersion\": \"12.6.0\",\n \"Coordinates\": \"\",\n \"DeviceType\": \"AND\",\n \"IP\": \"192.168.31.141\",\n \"InstallationID\": \"7c0a125bb127ce1a\",\n \"IsFenceAction\": False,\n \"IsPushAction\": False,\n \"Language\": \"EN\",\n \"OsVersion\": \"android : 9 : P : sdk=28\",\n \"TimeZone\": \"8\",\n \"TokenID\": \"\",\n}"
v := model.Akm{}
json.Unmarshal(data, &v)
......@@ -231,22 +233,26 @@ func testVY(px string, data []byte) {
if err != nil {
panic(err)
}
req.Header.Set("X-acf-sensor-data", app.NewSensorData().GetSensorData())
req.Header.Set("User-Agent", "Vueling/12.6.0 (Android 28; Release/9)")
req.Header.Set("appVersion", "12.6.0")
req.Header.Set("Content-Type", "application/json; charset=UTF-8")
req.Header.Set("Host", "apimobile.vueling.com")
req.Header.Set("Upgrade-Insecure-Requests", "1")
req.Header.Set("user-agent", "Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1")
req.Header.Set("accept", "application/json, text/plain, */*")
req.Header.Set("sec-fetch-site", "same-site")
req.Header.Set("sec-fetch-mode", "cors")
req.Header.Set("Sec-Fetch-User", "?1")
req.Header.Set("sec-fetch-dest", "empty")
req.Header.Set("accept-language", "en-US,en;q=0.9")
req.Header.Set("pragma", "no-cache")
req.Header.Set("cache-control", "no-cache")
req.Header.Set("content-type", "application/json")
req.Header.Set("origin", "https://m.vueling.com")
req.Header.Set("referer", "https://m.vueling.com/")
req.Header.Set("Content-Type", "application/json")
//req.Header.Set("Host", "apimobile.vueling.com")
//req.Header.Set("Upgrade-Insecure-Requests", "1")
//req.Header.Set("user-agent", "Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1")
//req.Header.Set("accept", "application/json, text/plain, */*")
//req.Header.Set("sec-fetch-site", "same-site")
//req.Header.Set("sec-fetch-mode", "cors")
//req.Header.Set("Sec-Fetch-User", "?1")
//req.Header.Set("sec-fetch-dest", "empty")
//req.Header.Set("accept-language", "en-US,en;q=0.9")
//req.Header.Set("pragma", "no-cache")
//req.Header.Set("cache-control", "no-cache")
//req.Header.Set("content-type", "application/json")
//req.Header.Set("origin", "https://m.vueling.com")
//req.Header.Set("referer", "https://m.vueling.com/")
//req.Header.Set("Content-Type", "application/json")
resp, err := Client.Do(req)
if err != nil {
panic(err)
......
package main
import (
"fmt"
"test/app"
)
func main() {
a := app.NewSensorData()
s := a.GetSensorData()
fmt.Println(s)
fmt.Println(len(s))
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment