Commit 23c968c7 authored by 王明明's avatar 王明明

nk 转换测试

0317 15:28
parent 41d7cad0
```shell ```shell
docker run -itd --name lcc-akm-api --privileged=true --restart=always -v /home/opt/lcc-akm/src:/root/src/ -p 59001:59001 --cpus=1 -m 1G golang /bin/sh "/root/src/run.sh" docker run -itd --name lcc-akm-api --privileged=true --restart=always -v /home/opt/lcc-akm/src:/root/src/ -p 59001:59001 --cpus=1 -m 1G --log-driver=json-file --log-opt max-size=50m --log-opt max-file=3 golang/goenv:1.1 /bin/sh "/root/src/run.sh"
``` ```
\ No newline at end of file
...@@ -135,6 +135,7 @@ func (akm *AkmClient) postSensor(times int) error { ...@@ -135,6 +135,7 @@ func (akm *AkmClient) postSensor(times int) error {
res := sensor.GenData(times, abck, bmsz, akm.ua, akm.postUrl) res := sensor.GenData(times, abck, bmsz, akm.ua, akm.postUrl)
t2 := time.Now() t2 := time.Now()
sensor_data := "{\"sensor_data\":\"" + res + "\"}" sensor_data := "{\"sensor_data\":\"" + res + "\"}"
akm.logger.Info("sensor", sensor_data)
statusCode, err := akm.PostJson(times, akm.SensorUrl, sensor_data) statusCode, err := akm.PostJson(times, akm.SensorUrl, sensor_data)
if err != nil { if err != nil {
return err return err
......
...@@ -161,17 +161,29 @@ type AkmEvent struct { ...@@ -161,17 +161,29 @@ type AkmEvent struct {
} }
func (akm *AkmEvent) ActivateRandomEvent() { func (akm *AkmEvent) ActivateRandomEvent() {
for i := 0; i < int(math.Floor(rand.Float64()*10+10)); i++ { if rand.Float64() > 0.4 {
akm.ActivateKeyEvent("a") for i := 0; i < int(math.Floor(rand.Float64()*10+rand.Float64()*10)); i++ {
akm.ActivateKeyEvent("a")
}
} }
for i := 0; i < int(math.Floor(rand.Float64()*5+2)); i++ { if rand.Float64() > 0.4 {
akm.ActivateDeviceMotionEvent()
for i := 0; i < int(math.Floor(rand.Float64()*5+rand.Float64()*10)); i++ {
akm.ActivateDeviceMotionEvent()
}
} }
for i := 0; i < int(math.Floor(rand.Float64()*5+2)); i++ { if rand.Float64() > 0.4 {
akm.ActivateOrientationEvent()
for i := 0; i < int(math.Floor(rand.Float64()*5+rand.Float64()*10)); i++ {
akm.ActivateOrientationEvent()
}
} }
for i := 0; i < int(math.Floor(rand.Float64()*5+3)); i++ { if rand.Float64() > 0.4 {
akm.ActivatePointerEvent()
for i := 0; i < int(math.Floor(rand.Float64()*5+rand.Float64()*10)); i++ {
akm.ActivatePointerEvent()
}
} }
} }
......
...@@ -5,6 +5,7 @@ import ( ...@@ -5,6 +5,7 @@ import (
"fmt" "fmt"
http "github.com/bogdanfinn/fhttp" http "github.com/bogdanfinn/fhttp"
tls_client "github.com/bogdanfinn/tls-client" tls_client "github.com/bogdanfinn/tls-client"
"io"
"io/ioutil" "io/ioutil"
"net/url" "net/url"
"strings" "strings"
...@@ -24,8 +25,8 @@ func query(data []byte) { ...@@ -24,8 +25,8 @@ func query(data []byte) {
tls_client.WithClientProfile(tls_client.Chrome_110), tls_client.WithClientProfile(tls_client.Chrome_110),
tls_client.WithNotFollowRedirects(), tls_client.WithNotFollowRedirects(),
tls_client.WithCookieJar(jar), // create cookieJar instance and pass it as argument tls_client.WithCookieJar(jar), // create cookieJar instance and pass it as argument
//tls_client.WithProxyUrl("http://127.0.0.1:8890"), tls_client.WithProxyUrl("http://127.0.0.1:8890"),
tls_client.WithProxyUrl("http://user-unifflcc-region-us:q39CEBTs5A5YQXor@pr.roxlabs.cn:4600"), //tls_client.WithProxyUrl("http://user-unifflcc-region-us:q39CEBTs5A5YQXor@pr.roxlabs.cn:4600"),
tls_client.WithInsecureSkipVerify(), tls_client.WithInsecureSkipVerify(),
} }
uri, _ := url.Parse("https://www.easyjet.com/") uri, _ := url.Parse("https://www.easyjet.com/")
...@@ -80,10 +81,11 @@ func actU2() { ...@@ -80,10 +81,11 @@ func actU2() {
query(body) query(body)
} }
func actVY() { func actVY() {
px := "http://user-unifflcc-region-us:q39CEBTs5A5YQXor@pr.roxlabs.cn:4600"
t1 := time.Now() t1 := time.Now()
//resp, err := http.Post("http://lcc.unififi.com/akamai/gen", //resp, err := http.Post("http://lcc.unififi.com/akamai/gen",
resp, err := http.Post("http://127.0.0.1:59001/akamai/gen", resp, err := http.Post("http://127.0.0.1:59001/akamai/gen",
"application/json", strings.NewReader("{\"type\": \"VY\", \"proxy\": \"http://user-unifflcc-region-us:q39CEBTs5A5YQXor@pr.roxlabs.cn:4600\"}")) "application/json", strings.NewReader("{\"type\": \"VY\", \"proxy\": \""+px+"\"}"))
//"application/json", strings.NewReader("{\"type\": \"VY\", \"proxy\": \"http://127.0.0.1:8890\"}")) //"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\"}")) //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 { if err != nil {
...@@ -93,7 +95,7 @@ func actVY() { ...@@ -93,7 +95,7 @@ func actVY() {
} }
body, _ := ioutil.ReadAll(resp.Body) body, _ := ioutil.ReadAll(resp.Body)
fmt.Println("abck cost", time.Since(t1).String()) fmt.Println("abck cost", time.Since(t1).String())
testVY(body) testVY(px, body)
} }
func main() { func main() {
for i := 0; i < 10; i++ { for i := 0; i < 10; i++ {
...@@ -117,8 +119,8 @@ func main() { ...@@ -117,8 +119,8 @@ func main() {
} }
func testVY(data []byte) { 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\": \"LON\",\n\t\t\"DepartureStation\": \"LCG\",\n\t\t\"MarketDateDeparture\": \"2023-03-16\"\n\t}],\n\t\"Language\": \"en-GB\"\n}" 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}"
v := model.Akm{} v := model.Akm{}
json.Unmarshal(data, &v) json.Unmarshal(data, &v)
...@@ -129,7 +131,7 @@ func testVY(data []byte) { ...@@ -129,7 +131,7 @@ func testVY(data []byte) {
tls_client.WithClientProfile(tls_client.Chrome_110), tls_client.WithClientProfile(tls_client.Chrome_110),
tls_client.WithCookieJar(jar), // create cookieJar instance and pass it as argument tls_client.WithCookieJar(jar), // create cookieJar instance and pass it as argument
//tls_client.WithProxyUrl("http://127.0.0.1:8890"), //tls_client.WithProxyUrl("http://127.0.0.1:8890"),
tls_client.WithProxyUrl("http://user-unifflcc-region-us:q39CEBTs5A5YQXor@pr.roxlabs.cn:4600"), tls_client.WithProxyUrl(px),
tls_client.WithInsecureSkipVerify(), tls_client.WithInsecureSkipVerify(),
} }
uri, _ := url.Parse("https://m.vueling.com/") uri, _ := url.Parse("https://m.vueling.com/")
...@@ -168,4 +170,6 @@ func testVY(data []byte) { ...@@ -168,4 +170,6 @@ func testVY(data []byte) {
} }
defer resp.Body.Close() defer resp.Body.Close()
fmt.Println("响应结果", resp.StatusCode) fmt.Println("响应结果", resp.StatusCode)
readBytes, _ := io.ReadAll(resp.Body)
fmt.Println(string(readBytes))
} }
package main
import (
"fmt"
"github.com/PuerkitoBio/goquery"
http "github.com/bogdanfinn/fhttp"
tls_client "github.com/bogdanfinn/tls-client"
"io"
"math/rand"
"net/url"
"strings"
"sync"
sensor2 "test/sensor"
)
func getCookie(client tls_client.HttpClient) (string, string) {
abck := ""
bm_sz := ""
uri, _ := url.Parse("https://www.spirit.com/")
for _, cookie := range client.GetCookies(uri) {
if cookie.Name == "_abck" {
abck = cookie.Value
}
if cookie.Name == "bm_sz" {
abck = cookie.Value
}
}
return abck, bm_sz
}
func abckSensor(client tls_client.HttpClient, sensorurl string) {
for i := 0; i < 5; i++ {
abck, bm_sz := getCookie(client)
//datas := fmt.Sprintf("times=%d&abck=%s&bm_sz=%s&url=%s", i, abck, bm_sz, "https://www.spirit.com/")
//
//r, _ := http.Post("http://127.0.0.1:3033/akm2t", "application/x-www-form-urlencoded", strings.NewReader(datas))
//rs, _ := io.ReadAll(r.Body)
rs := sensor2.GenData(i, abck, bm_sz, "Mozilla/5.0 (Linux; Android 9; SM-N9500) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Mobile Safari/537.36", "https://www.spirit.com/")
sensor := "{\"sensor_data\":\"" + string(rs) + "\"}"
req, _ := http.NewRequest("POST", "https://www.spirit.com"+sensorurl, strings.NewReader(sensor))
req.Header.Set("authority", "www.spirit.com")
req.Header.Set("accept", "*/*")
req.Header.Set("accept-language", "q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6")
req.Header.Set("cache-control", "no-cache")
req.Header.Set("content-type", "text/plain;charset=UTF-8")
req.Header.Set("origin", "https://www.spirit.com")
req.Header.Set("pragma", "no-cache")
req.Header.Set("referer", "https://www.spirit.com/")
req.Header.Set("user-agent", "Mozilla/5.0 (Linux; Android 9; SM-N9500) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Mobile Safari/537.36")
resp, _ := client.Do(req)
readBytes, _ := io.ReadAll(resp.Body)
fmt.Println(string(readBytes))
for _, cookie := range resp.Cookies() {
fmt.Println(cookie.Name, len(cookie.Value), cookie.Value)
}
}
}
func main() {
wg := sync.WaitGroup{}
for i := 0; i < 1; i++ {
wg.Add(1)
go func() {
jar := tls_client.NewCookieJar()
//uri, _ := url.Parse("https://www.spirit.com/")
//var cookies []*http.Cookie
//for key, value := range v.Cookies {
// cookies = append(cookies, &http.Cookie{
// Name: key,
// Value: value,
// })
//}
//jar.SetCookies(uri, cookies)
i := rand.Intn(149)
px := fmt.Sprintf("http://%s%d", "unfflcc:76cc14-47b8dd-1f8ace-827836-0c740e@usa.rotating.proxyrack.net:", 10000+i)
fmt.Println(px)
options := []tls_client.HttpClientOption{
tls_client.WithTimeoutSeconds(30),
tls_client.WithClientProfile(tls_client.Chrome_110),
tls_client.WithNotFollowRedirects(),
tls_client.WithCookieJar(jar), // create cookieJar instance and pass it as argument
//tls_client.WithProxyUrl("http://127.0.0.1:8890"),
tls_client.WithProxyUrl("http://user-unifflcc-region-us:q39CEBTs5A5YQXor@pr.roxlabs.cn:4600"),
//tls_client.WithProxyUrl(px),
tls_client.WithInsecureSkipVerify(),
}
client, err := tls_client.NewHttpClient(tls_client.NewNoopLogger(), options...)
if err != nil {
panic(err)
}
req, _ := http.NewRequest("GET", "https://www.spirit.com", nil)
req.Header.Set("Host", "www.spirit.com")
req.Header.Set("upgrade-insecure-requests", "1")
req.Header.Set("accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7")
req.Header.Set("sec-fetch-site", "none")
req.Header.Set("sec-fetch-mode", "navigate")
req.Header.Set("sec-fetch-user", "?1")
req.Header.Set("sec-fetch-dest", "document")
req.Header.Set("sec-ch-ua-mobile", "?0")
req.Header.Set("accept-language", "en-US,en;q=0.9")
req.Header.Set("User-Agent", "Mozilla/5.0 (Linux; Android 9; SM-N9500) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Mobile Safari/537.36")
resp, _ := client.Do(req)
doc, err := goquery.NewDocumentFromReader(resp.Body)
if err != nil {
panic(err)
}
scripts := doc.Find("script")
sensorurl, ok := scripts.Last().Attr("src")
if ok != true {
panic(err)
}
fmt.Println(sensorurl)
abckSensor(client, sensorurl)
nk(client)
wg.Done()
}()
}
wg.Wait()
}
func nk(client tls_client.HttpClient) {
//t1 := time.Now()
////resp, err := http.Post("http://lcc.unififi.com/akamai/gen",
//resp, err := http.Post("http://127.0.0.1:59001/akamai/gen",
// "application/json", strings.NewReader("{\"type\": \"VY\", \"proxy\": \"http://user-unifflcc-region-us:q39CEBTs5A5YQXor@pr.roxlabs.cn:4600\"}"))
////"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)
//v := model.Akm{}
//
//json.Unmarshal(body, &v)
//fmt.Println("abck cost", time.Since(t1).String())
req, _ := http.NewRequest("POST", "https://www.spirit.com/api/nk-token/api/v1/token", strings.NewReader("{\"applicationName\": \"dotRezWeb\"}"))
req.Header.Set("authority", "www.spirit.com")
req.Header.Set("accept", "application/json, text/plain, */*")
req.Header.Set("accept-language", "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6")
req.Header.Set("cache-control", "no-cache")
req.Header.Set("content-type", "application/json")
req.Header.Set("origin", "https://www.spirit.com")
req.Header.Set("pragma", "no-cache")
req.Header.Set("referer", "https://www.spirit.com/")
req.Header.Set("sec-ch-ua-mobile", "?0")
req.Header.Set("ocp-apim-subscription-key", "dc6844776fe84b1c8b68affe7deb7916")
req.Header.Set("x-dtpc", "4$572764892_654h11vJJGIVPCDDJUIBEMACTPMIGRSISICHWMU-0e0")
req.Header.Set("sec-fetch-dest", "empty")
req.Header.Set("sec-fetch-mode", "cors")
req.Header.Set("sec-fetch-site", "same-origin")
req.Header.Set("user-agent", "Mozilla/5.0 (Linux; Android 9; SM-N9500) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Mobile Safari/537.36")
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
readBytes, _ := io.ReadAll(resp.Body)
fmt.Println(string(readBytes))
}
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