Skip to content

Commit

Permalink
Unpatched (Probably)
Browse files Browse the repository at this point in the history
  • Loading branch information
V4NSH4J committed Jul 27, 2022
1 parent 879c2e2 commit 2e5f98e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 94 deletions.
23 changes: 18 additions & 5 deletions instance/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,21 @@ import (

func InitClient(proxy string, cfg Config) (*http.Client, error) {
// If proxy is empty, return a default client (if proxy from file is false)
unproxiedClient := &http.Client{
Timeout: time.Second * time.Duration(cfg.ProxySettings.Timeout),
Transport: &http.Transport{
TLSClientConfig: &tls.Config{
MinVersion: tls.VersionTLS13,
CipherSuites: []uint16{0x1301, 0x1302, 0x1303, 0xc02b, 0xc02f, 0xc02c, 0xc030, 0xcca9, 0xcca8, 0xc013, 0xc014, 0x009c, 0x009d, 0x002f, 0x0035},
InsecureSkipVerify: true,
CurvePreferences: []tls.CurveID{0x001d, 0x0017, 0x0018},
},
DisableKeepAlives: cfg.OtherSettings.DisableKL,
ForceAttemptHTTP2: true,
},
}
if proxy == "" {
return http.DefaultClient, nil
return unproxiedClient, nil
}
switch cfg.ProxySettings.ProxyProtocol {
case "http":
Expand All @@ -36,18 +49,18 @@ func InitClient(proxy string, cfg Config) (*http.Client, error) {
// Error while converting proxy string to url.url would result in default client being returned
proxyURL, err := url.Parse(proxy)
if err != nil {
return http.DefaultClient, err
return unproxiedClient, err
}
// Creating a client and modifying the transport.

Client := &http.Client{
Timeout: time.Second * time.Duration(cfg.ProxySettings.Timeout),
Transport: &http.Transport{
TLSClientConfig: &tls.Config{
MinVersion: tls.VersionTLS12,
CipherSuites: []uint16{0x1301, 0x1303, 0x1302, 0xc02b, 0xc02f, 0xcca9, 0xcca8, 0xc02c, 0xc030, 0xc00a, 0xc009, 0xc013, 0xc014, 0x009c, 0x009d, 0x002f, 0x0035},
MinVersion: tls.VersionTLS13,
CipherSuites: []uint16{0x1301, 0x1302, 0x1303, 0xc02b, 0xc02f, 0xc02c, 0xc030, 0xcca9, 0xcca8, 0xc013, 0xc014, 0x009c, 0x009d, 0x002f, 0x0035},
InsecureSkipVerify: true,
CurvePreferences: []tls.CurveID{tls.CurveID(0x001d), tls.CurveID(0x0017), tls.CurveID(0x0018), tls.CurveID(0x0019), tls.CurveID(0x0100), tls.CurveID(0x0101)},
CurvePreferences: []tls.CurveID{0x001d, 0x0017, 0x0018},
},
DisableKeepAlives: cfg.OtherSettings.DisableKL,
ForceAttemptHTTP2: true,
Expand Down
88 changes: 0 additions & 88 deletions instance/direct_messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,94 +112,6 @@ func (in *Instance) GetCookieString() (string, error) {

}

// func (in *Instance) GetCookieString() (string, error) {
// if in.Config.OtherSettings.ConstantCookies && in.Cookie != "" {
// return in.Cookie, nil
// }
// if in.Config.OtherSettings.Mode != 2 {
// url := "https://discord.com"

// req, err := http.NewRequest("GET", url, nil)

// if err != nil {
// utilities.LogErr("[%v] Error while making request to get cookies %v", time.Now().Format("15:04:05"), err)
// return "", fmt.Errorf("error while making request to get cookie %v", err)
// }
// req = in.cookieHeaders(req)
// resp, err := in.Client.Do(req)
// if err != nil {
// utilities.LogErr("[%v] Error while getting response from cookies request %v", time.Now().Format("15:04:05"), err)
// return "", fmt.Errorf("error while getting response from cookie request %v", err)
// }
// defer resp.Body.Close()

// if resp.Cookies() == nil {
// utilities.LogErr("[%v] Error while getting cookies from response %v", time.Now().Format("15:04:05"), err)
// return "", fmt.Errorf("there are no cookies in response")
// }
// cookies := ""
// for _, cookie := range resp.Cookies() {
// cookies += fmt.Sprintf(`%s=%s; `, cookie.Name, cookie.Value)
// }
// // CfRay := resp.Header.Get("cf-ray")
// // if strings.Contains(CfRay, "-BOM") {
// // CfRay = strings.ReplaceAll(CfRay, "-BOM", "")
// // }

// // if CfRay != "" {
// // body, err := ioutil.ReadAll(resp.Body)
// // if err != nil {
// // utilities.LogErr("[%v] Error while reading response body %v", time.Now().Format("15:04:05"), err)
// // return cookies + "locale:en-US", nil
// // }
// // m := regexp.MustCompile(`m:'(.+)'`)
// // match := m.FindStringSubmatch(string(body))
// // if match == nil {
// // return cookies + "locale:en-US", nil
// // }
// // finalCookies, err := in.GetCfBm(match[1], CfRay, cookies)
// // if err != nil {
// // return cookies + "locale:en-US", nil
// // }
// // finalCookies += "; locale:en-US"
// // return finalCookies, nil
// // }
// cookies += fmt.Sprintf("locale:%s", "en-US")
// if in.Config.OtherSettings.ConstantCookies {
// in.Cookie = cookies
// }
// return cookies, nil
// } else {
// site := "https://discord.com/ios/125.0/manifest.json"
// req, err := http.NewRequest("GET", site, nil)
// if err != nil {
// return "", fmt.Errorf("error while making request to get cookie %v", err)
// }
// req = in.cookieHeaders(req)
// resp, err := in.Client.Do(req)
// if err != nil {
// return "", fmt.Errorf("error while getting response from cookie request %v", err)
// }
// defer resp.Body.Close()
// if resp.Cookies() == nil {
// return "", fmt.Errorf("there are no cookies in response")
// }
// cookies := ""
// for i, cookie := range resp.Cookies() {
// if i != len(resp.Cookies())-1 {
// cookies += fmt.Sprintf(`%s=%s; `, cookie.Name, cookie.Value)
// } else {
// cookies += fmt.Sprintf(`%s=%s`, cookie.Name, cookie.Value)
// }
// }
// if in.Config.OtherSettings.ConstantCookies {
// in.Cookie = cookies
// }
// return cookies, nil
// }

// }

func (in *Instance) GetCfBm(m, r, cookies string) (string, error) {
site := fmt.Sprintf(`https://discord.com/cdn-cgi/bm/cv/result?req_id=%s`, r)
payload := fmt.Sprintf(
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
)

func main() {
version := "1.10.14"
version := "1.10.15"
rand.Seed(time.Now().UTC().UnixNano())
color.Blue.Printf(logo + " v" + version + "\n")
color.Green.Printf("Made by https://github.com/V4NSH4J\nStar repository on github for updates!\n")
Expand Down

0 comments on commit 2e5f98e

Please sign in to comment.