forked from nkeonkeo/MediaUnlockTest
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathMathsSpotRoblox.go
executable file
·119 lines (104 loc) · 4.13 KB
/
MathsSpotRoblox.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
package mediaunlocktest
import (
"encoding/json"
"io"
"net/http"
"regexp"
"strings"
)
func extractMathsSpotRobloxAPIPath(body string) string {
re := regexp.MustCompile(`fetch\("(/[^"]+)\/reportEvent"`)
matches := re.FindStringSubmatch(body)
if len(matches) > 1 {
return matches[1]
}
return ""
}
func extractMathsSpotRobloxRegion(body string) string {
re := regexp.MustCompile(`"countryCode"\s*:\s*"([^"]+)"`)
matches := re.FindStringSubmatch(body)
if len(matches) > 1 {
return matches[1]
}
return ""
}
func extractMathsSpotRobloxNggFeVersion(body string) string {
re := regexp.MustCompile(`"NEXT_PUBLIC_FE_VERSION"\s*:\s*"([^"]+)"`)
matches := re.FindStringSubmatch(body)
if len(matches) > 1 {
return matches[1]
}
return ""
}
func MathsSpotRoblox(c http.Client) Result {
resp1, err := GET(c, "https://mathsspot.com/")
if err != nil {
return Result{Status: StatusNetworkErr, Err: err}
}
defer resp1.Body.Close()
body1, err := io.ReadAll(resp1.Body)
bodyString1 := string(body1)
if err != nil {
return Result{Status: StatusFailed}
}
if strings.Contains(bodyString1, "FailureServiceNotInRegion") {
return Result{Status: StatusNo}
}
apiPath := extractMathsSpotRobloxAPIPath(bodyString1)
region := extractMathsSpotRobloxRegion(bodyString1)
nggFeVersion := extractMathsSpotRobloxNggFeVersion(bodyString1)
if nggFeVersion == "berlin-v1.34.800_redisexp-arm.1" {
nggFeVersion = "berlin-v1.34.810_redisexp-arm.1"
}
if apiPath == "" || region == "" || nggFeVersion == "" {
return Result{Status: StatusFailed}
}
fakeUAId := genRandomStr(21)
fakeSessId := genRandomStr(21)
fakeFesessId := genRandomStr(21)
fakeVisitId := genRandomStr(21)
resp2, err := GET(c, "https://mathsspot.com"+apiPath+"/startSession?appId=5349&uaId=ua-"+fakeUAId+"&uaSessionId=uasess-"+fakeSessId+"&feSessionId=fesess-"+fakeFesessId+"&visitId=visitid-"+fakeVisitId+"&initialOrientation=landscape&utmSource=NA&utmMedium=NA&utmCampaign=NA&deepLinkUrl=&accessCode=&ngReferrer=NA&pageReferrer=NA&ngEntryPoint=https%%3A%%2F%%2Fmathsspot.com%%2F&ntmSource=NA&customData=&appLaunchExtraData=&feSessionTags=nowgg&sdpType=&eVar=&isIframe=false&feDeviceType=desktop&feOsName=window&userSource=direct&visitSource=direct&userCampaign=NA&visitCampaign=NA",
H{"referer", "https://mathsspot.com/"},
H{"x-ngg-skip-evar-check", "true"},
H{"x-ngg-fe-version", nggFeVersion},
)
if err != nil {
return Result{Status: StatusNetworkErr, Err: err}
}
defer resp2.Body.Close()
body2, err := io.ReadAll(resp2.Body)
if err != nil {
return Result{Status: StatusNetworkErr, Err: err}
}
var res struct {
Status string `json:"status"`
}
if err := json.Unmarshal(body2, &res); err != nil {
nggFeVersion = string(body2)
resp3, err := GET(c, "https://mathsspot.com"+apiPath+"/startSession?appId=5349&uaId=ua-"+fakeUAId+"&uaSessionId=uasess-"+fakeSessId+"&feSessionId=fesess-"+fakeFesessId+"&visitId=visitid-"+fakeVisitId+"&initialOrientation=landscape&utmSource=NA&utmMedium=NA&utmCampaign=NA&deepLinkUrl=&accessCode=&ngReferrer=NA&pageReferrer=NA&ngEntryPoint=https%%3A%%2F%%2Fmathsspot.com%%2F&ntmSource=NA&customData=&appLaunchExtraData=&feSessionTags=nowgg&sdpType=&eVar=&isIframe=false&feDeviceType=desktop&feOsName=window&userSource=direct&visitSource=direct&userCampaign=NA&visitCampaign=NA",
H{"referer", "https://mathsspot.com/"},
H{"x-ngg-skip-evar-check", "true"},
H{"x-ngg-fe-version", nggFeVersion},
)
if err != nil {
return Result{Status: StatusNetworkErr, Err: err}
}
defer resp3.Body.Close()
body3, err := io.ReadAll(resp3.Body)
if err != nil {
return Result{Status: StatusNetworkErr, Err: err}
}
if err := json.Unmarshal(body3, &res); err != nil {
return Result{Status: StatusFailed, Err: err}
}
}
switch res.Status {
case "FailureServiceNotInRegion":
return Result{Status: StatusNo}
case "FailureProxyUserLimitExceeded":
return Result{Status: StatusNo, Info: "Proxy Detected"}
case "Success", "FailureUnauthorized":
return Result{Status: StatusOK, Region: strings.ToLower(region)}
}
return Result{Status: StatusFailed}
}