Skip to content

Commit

Permalink
Randomized a part of the headers which was leading to patches
Browse files Browse the repository at this point in the history
randomized locale in x-super-properties and matched it with locale in other headers
  • Loading branch information
V4NSH4J committed Jul 12, 2022
1 parent 2e3386d commit d2990a9
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 49 deletions.
2 changes: 1 addition & 1 deletion instance/direct_messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func (in *Instance) GetCookieString() (string, error) {
// finalCookies += "; locale:en-US"
// return finalCookies, nil
// }
cookies += "locale:en-US"
cookies += fmt.Sprintf("locale:%s", in.Locale)
if in.Config.OtherSettings.ConstantCookies {
in.Cookie = cookies
}
Expand Down
2 changes: 1 addition & 1 deletion instance/extra.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ func (in *Instance) Invite(Code string) error {
return err
}
if resp.StatusCode == 200 {
utilities.LogSuccess("%v joint guild %v", in.CensorToken(), Code)
utilities.LogSuccess("%v joined guild %v", in.CensorToken(), Code)
if Join.VerificationForm {
if len(Join.GuildObj.ID) != 0 {
Bypass(in.Client, Join.GuildObj.ID, in.Token, Code)
Expand Down
44 changes: 22 additions & 22 deletions instance/headers.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func (in *Instance) cookieHeaders(req *http.Request) *http.Request {
for k, v := range map[string]string{
"Host": "discord.com",
"User-Agent": "Discord/125.0 (iPad; iOS 15.4.1; Scale/2.00)",
"Accept-Language": "en-IN;q=1",
"Accept-Language": "en-US;q=1",
"Accept": "*/*",
} {
req.Header.Set(k, v)
Expand Down Expand Up @@ -74,8 +74,8 @@ func (in *Instance) inviteHeaders(req *http.Request, cookie, xcontext string) *h
"X-Debug-Options": "bugReporterEnabled",
"Accept": "*/*",
"Authorization": in.Token,
"X-Discord-Locale": "en-US",
"Accept-Language": "en-IN",
"X-Discord-Locale": in.Locale,
"Accept-Language": "en-US",
"X-Context-Properties": xcontext,
"User-Agent": in.UserAgent,
"X-Super-Properties": in.XSuper,
Expand All @@ -93,7 +93,7 @@ func (in *Instance) inviteHeaders(req *http.Request, cookie, xcontext string) *h
"X-Context-Properties": xcontext,
"Authorization": in.Token,
"X-Super-Properties": in.XSuper,
"X-Discord-Locale": "en-US",
"X-Discord-Locale": in.Locale,
"X-Debug-Options": "bugReporterEnabled",
"Origin": "https://discord.com",
"sec-gpc": "1",
Expand All @@ -117,11 +117,11 @@ func (in *Instance) xContextPropertiesHeaders(req *http.Request, cookie string)
"Cookie": cookie,
"X-Debug-Options": "bugReporterEnabled",
"Accept": "*/*",
"X-Discord-Locale": "en-US",
"X-Discord-Locale": in.Locale,
"X-Super-Properties": in.XSuper,
"Authorization": in.Token,
"User-Agent": in.UserAgent,
"Accept-Language": "en-IN",
"Accept-Language": "en-US",
} {
req.Header.Set(k, v)
}
Expand All @@ -133,7 +133,7 @@ func (in *Instance) xContextPropertiesHeaders(req *http.Request, cookie string)
"Accept-Language": "en-US,en;q=0.5",
"Authorization": in.Token,
"X-Super-Properties": in.XSuper,
"X-Discord-Locale": "en-US",
"X-Discord-Locale": in.Locale,
"X-Debug-Options": "bugReporterEnabled",
"sec-gpc": "1",
"Referer": "https://discord.com/channels/@me",
Expand All @@ -158,8 +158,8 @@ func (in *Instance) OpenChannelHeaders(req *http.Request, cookie string) *http.R
"X-Debug-Options": "bugReporterEnabled",
"Accept": "*/*",
"Authorization": in.Token,
"X-Discord-Locale": "en-US",
"Accept-Language": "en-IN",
"X-Discord-Locale": in.Locale,
"Accept-Language": "en-US",
"X-Context-Properties": "e30=",
"User-Agent": in.UserAgent,
"X-Super-Properties": in.XSuper,
Expand All @@ -177,7 +177,7 @@ func (in *Instance) OpenChannelHeaders(req *http.Request, cookie string) *http.R
"X-Context-Properties": "e30=",
"Authorization": in.Token,
"X-Super-Properties": in.XSuper,
"X-Discord-Locale": "en-US",
"X-Discord-Locale": in.Locale,
"X-Debug-Options": "bugReporterEnabled",
"Origin": "https://discord.com",
"sec-gpc": "1",
Expand All @@ -202,8 +202,8 @@ func (in *Instance) SendMessageHeaders(req *http.Request, cookie, recipient stri
"X-Debug-Options": "bugReporterEnabled",
"Accept": "*/*",
"Authorization": in.Token,
"X-Discord-Locale": "en-US",
"Accept-Language": "en-IN",
"X-Discord-Locale": in.Locale,
"Accept-Language": "en-US",
"User-Agent": in.UserAgent,
"X-Super-Properties": in.XSuper,
} {
Expand All @@ -219,7 +219,7 @@ func (in *Instance) SendMessageHeaders(req *http.Request, cookie, recipient stri
"Content-Type": "application/json",
"Authorization": in.Token,
"X-Super-Properties": in.XSuper,
"X-Discord-Locale": "en-US",
"X-Discord-Locale": in.Locale,
"X-Debug-Options": "bugReporterEnabled",
"Origin": "https://discord.com",
"sec-gpc": "1",
Expand All @@ -244,7 +244,7 @@ func (in *Instance) TypingHeaders(req *http.Request, cookie, snowflake string) *
"Accept-Language": "en-US,en;q=0.5",
"Authorization": in.Token,
"X-Super-Properties": in.XSuper,
"X-Discord-Locale": "en-US",
"X-Discord-Locale": in.Locale,
"Cookie": cookie,
} {
req.Header.Set(k, v)
Expand All @@ -257,7 +257,7 @@ func (in *Instance) TypingHeaders(req *http.Request, cookie, snowflake string) *
"Accept-Language": "en-US,en;q=0.5",
"Authorization": in.Token,
"X-Super-Properties": in.XSuper,
"X-Discord-Locale": "en-US",
"X-Discord-Locale": in.Locale,
"X-Debug-Options": "bugReporterEnabled",
"Origin": "https://discord.com",
"Referer": fmt.Sprintf(`https://discord.com/channels/@me/%s`, snowflake),
Expand All @@ -282,8 +282,8 @@ func (in *Instance) AtMeHeaders(req *http.Request, cookie string) *http.Request
"X-Debug-Options": "bugReporterEnabled",
"Accept": "*/*",
"Authorization": in.Token,
"X-Discord-Locale": "en-US",
"Accept-Language": "en-IN",
"X-Discord-Locale": in.Locale,
"Accept-Language": "en-US",
"User-Agent": in.UserAgent,
"X-Super-Properties": in.XSuper,
} {
Expand All @@ -299,7 +299,7 @@ func (in *Instance) AtMeHeaders(req *http.Request, cookie string) *http.Request
"Accept-Language": "en-US,en;q=0.5",
"Authorization": in.Token,
"X-Super-Properties": in.XSuper,
"X-Discord-Locale": "en-US",
"X-Discord-Locale": in.Locale,
"X-Debug-Options": "bugReporterEnabled",
"sec-gpc": "1",
"Referer": "https://discord.com/login",
Expand All @@ -322,7 +322,7 @@ func CommonHeaders(req *http.Request) *http.Request {
"X-Debug-Options": "bugReporterEnabled",
"Accept": "*/*",
"X-Discord-Locale": "en-US",
"Accept-Language": "en-IN",
"Accept-Language": "en-US",
"User-Agent": "Discord/32114 CFNetwork/1331.0.7 Darwin/21.4.0",
"X-Super-Properties": "eyJvcyI6ImlPUyIsImJyb3dzZXIiOiJEaXNjb3JkIGlPUyIsImRldmljZSI6ImlQYWQxMywxNiIsInN5c3RlbV9sb2NhbGUiOiJlbi1JTiIsImNsaWVudF92ZXJzaW9uIjoiMTI0LjAiLCJyZWxlYXNlX2NoYW5uZWwiOiJzdGFibGUiLCJkZXZpY2VfYWR2ZXJ0aXNlcl9pZCI6IjAwMDAwMDAwLTAwMDAtMDAwMC0wMDAwLTAwMDAwMDAwMDAwMCIsImRldmljZV92ZW5kb3JfaWQiOiJBMTgzNkNFRC1BRDI5LTRGRTAtQjVDNC0zODQ0NDU0MEFFQTciLCJicm93c2VyX3VzZXJfYWdlbnQiOiIiLCJicm93c2VyX3ZlcnNpb24iOiIiLCJvc192ZXJzaW9uIjoiMTUuNC4xIiwiY2xpZW50X2J1aWxkX251bWJlciI6MzIyNDcsImNsaWVudF9ldmVudF9zb3VyY2UiOm51bGx9",
} {
Expand All @@ -340,8 +340,8 @@ func (in *Instance) UserInfoHeaders(req *http.Request, cookie string) *http.Requ
"X-Debug-Options": "bugReporterEnabled",
"Accept": "*/*",
"Authorization": in.Token,
"X-Discord-Locale": "en-US",
"Accept-Language": "en-IN",
"X-Discord-Locale": in.Locale,
"Accept-Language": "en-US",
"User-Agent": in.UserAgent,
"X-Super-Properties": in.XSuper,
} {
Expand All @@ -357,7 +357,7 @@ func (in *Instance) UserInfoHeaders(req *http.Request, cookie string) *http.Requ
"Accept-Encoding": "gzip, deflate",
"Authorization": in.Token,
"X-Super-Properties": in.XSuper,
"X-Discord-Locale": "en-US",
"X-Discord-Locale": in.Locale,
"X-Debug-Options": "bugReporterEnabled",
"sec-gpc": "1",
"Referer": "https://discord.com/channels/@me",
Expand Down
39 changes: 14 additions & 25 deletions instance/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@
package instance

import (
"encoding/json"
"encoding/base64"
"fmt"
"io/ioutil"
"math/rand"
"net/http"
"os"
Expand Down Expand Up @@ -57,6 +56,7 @@ type Instance struct {
Reacted []ReactInfo
ReactChannel chan (ReactInfo)
MessageNumber int
Locale string
}

func (in *Instance) StartWS() error {
Expand Down Expand Up @@ -121,27 +121,8 @@ func GetEverything() (Config, []Instance, error) {
cfg.ProxySettings.ProxyForCaptcha = false
}
cfg.OtherSettings.Mode = 0
req, err := http.NewRequest("GET", "https://pastebin.com/raw/Q9N21vuR", nil)
if err != nil {
return cfg, instances, fmt.Errorf("error while creating request to get vital headers: %s", err)
}
resp, err := http.DefaultClient.Do(req)
if err != nil {
return cfg, instances, fmt.Errorf("error while getting vital headers: %s", err)
}
defer resp.Body.Close()
if resp.StatusCode != 200 && resp.StatusCode != 204 {
return cfg, instances, fmt.Errorf("error while getting vital headers: %s", resp.Status)
}
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return cfg, instances, fmt.Errorf("error while getting vital headers: %s", err)
}
var x Head
err = json.Unmarshal(body, &x)
if err != nil {
return cfg, instances, fmt.Errorf("error while getting vital headers: %s", err)
}
locales := []string{"de-AT", "de-DE", "de-IT", "de-LI", "de-LU", "en-AG", "en-AI", "en-AT", "en-AU", "en-BB", "en-CA", "en-BS", "en-CH", "en-DE", "en-FI", "en-GB", "en-HK", "en-IN", "en-MY", "en-SG", "en-US", "fr-CA", "fr-FR"}
locale := locales[rand.Intn(len(locales))]
if cfg.OtherSettings.Mode == 1 {
// Discord App
ua, xsuper = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) discord/0.0.267 Chrome/91.0.4472.164 Electron/13.6.6 Safari/537.36", "eyJvcyI6Ik1hYyBPUyBYIiwiYnJvd3NlciI6IkRpc2NvcmQgQ2xpZW50IiwicmVsZWFzZV9jaGFubmVsIjoic3RhYmxlIiwiY2xpZW50X3ZlcnNpb24iOiIwLjAuMjY3Iiwib3NfdmVyc2lvbiI6IjIxLjUuMCIsIm9zX2FyY2giOiJhcm02NCIsInN5c3RlbV9sb2NhbGUiOiJlbi1VUyIsImNsaWVudF9idWlsZF9udW1iZXIiOjEzNTQwMiwiY2xpZW50X2V2ZW50X3NvdXJjZSI6bnVsbH0="
Expand All @@ -150,7 +131,7 @@ func GetEverything() (Config, []Instance, error) {
// ua, xsuper = "Discord/32249 CFNetwork/1331.0.7 Darwin/21.4.0", "eyJvcyI6ImlPUyIsImJyb3dzZXIiOiJEaXNjb3JkIGlPUyIsImRldmljZSI6ImlQYWQxMywxNiIsInN5c3RlbV9sb2NhbGUiOiJlbi1JTiIsImNsaWVudF92ZXJzaW9uIjoiMTI0LjAiLCJyZWxlYXNlX2NoYW5uZWwiOiJzdGFibGUiLCJkZXZpY2VfYWR2ZXJ0aXNlcl9pZCI6IjAwMDAwMDAwLTAwMDAtMDAwMC0wMDAwLTAwMDAwMDAwMDAwMCIsImRldmljZV92ZW5kb3JfaWQiOiJBMTgzNkNFRC1BRDI5LTRGRTAtQjVDNC0zODQ0NDU0MEFFQTciLCJicm93c2VyX3VzZXJfYWdlbnQiOiIiLCJicm93c2VyX3ZlcnNpb24iOiIiLCJvc192ZXJzaW9uIjoiMTUuNC4xIiwiY2xpZW50X2J1aWxkX251bWJlciI6MzIyNDcsImNsaWVudF9ldmVudF9zb3VyY2UiOm51bGx9"
} else {
// Browser
ua, xsuper = x.Useragent, x.XSuperProperties
ua, xsuper = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.114 Safari/537.36", XSuper(locale)
//
}

Expand Down Expand Up @@ -203,7 +184,7 @@ func GetEverything() (Config, []Instance, error) {
if !cfg.ProxySettings.GatewayProxy {
Gproxy = ""
}
instances = append(instances, Instance{Client: client, Token: instanceToken, Proxy: proxy, Config: cfg, GatewayProxy: Gproxy, Email: email, Password: password, UserAgent: ua, XSuper: xsuper})
instances = append(instances, Instance{Client: client, Token: instanceToken, Proxy: proxy, Config: cfg, GatewayProxy: Gproxy, Email: email, Password: password, UserAgent: ua, XSuper: xsuper, Locale: locale})
}
if len(instances) == 0 {
utilities.LogErr(" You may be using 0 tokens")
Expand Down Expand Up @@ -271,3 +252,11 @@ type Head struct {
XSuperProperties string `json:"x-super-properties"`
Useragent string `json:"useragent"`
}

func XSuper(locale string) string {
dec := `{"os":"Mac OS X","browser":"Chrome","device":"","system_locale":"xyzabc","browser_user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.114 Safari/537.36","browser_version":"103.0.5060.114","os_version":"10.15.7","referrer":"","referring_domain":"","referrer_current":"","referring_domain_current":"","release_channel":"stable","client_build_number":136100,"client_event_source":null}`
new := strings.Replace(dec, "xyzabc", locale, -1)
// encode to base64
return base64.StdEncoding.EncodeToString([]byte(new))

}

0 comments on commit d2990a9

Please sign in to comment.