Skip to content

Commit 0d56797

Browse files
committed
[Add] ✨ Support Latest Bypass
1 parent 4b98da1 commit 0d56797

File tree

11 files changed

+31
-57
lines changed

11 files changed

+31
-57
lines changed

.devcontainer/supervisor.conf

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,6 @@ supervisor.rpcinterface_factory=supervisor.rpcinterface:make_main_rpcinterface
1616
[supervisorctl]
1717
serverurl=http://127.0.0.1:9005
1818

19-
[program:xvfb]
20-
priority=0
21-
environment=START_XVFB=true
22-
command=/opt/bin/start-xvfb.sh
23-
autostart=true
24-
autorestart=true
25-
26-
;Logs
27-
redirect_stderr=false
28-
stdout_logfile=/var/log/supervisor/xvfb-stdout.log
29-
stderr_logfile=/var/log/supervisor/xvfb-stderr.log
30-
stdout_logfile_maxbytes=50MB
31-
stderr_logfile_maxbytes=50MB
32-
stdout_logfile_backups=5
33-
stderr_logfile_backups=5
34-
stdout_capture_maxbytes=50MB
35-
stderr_capture_maxbytes=50MB
36-
3719
[program:go-bingai-pass]
3820
command=/app/go-bingai-pass
3921
environment=PORT=45678

api/bypass.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ func BypassHandler(w http.ResponseWriter, r *http.Request) {
7979
}
8080
}
8181

82-
resp, status, err := binglib.Bypass(bypassServer, strings.Join(reqCookies, "; "), "local-gen-"+hex.NewUUID(), request.IG, "", "", request.T)
82+
resp, status, err := binglib.Bypass(bypassServer, strings.Join(reqCookies, "; "), "local-gen-"+hex.NewUUID(), request.IG, "", "", request.T, r.Host)
8383
if err != nil {
8484
helper.ErrorResult(w, http.StatusInternalServerError, err.Error())
8585
common.Logger.Error("Bypass Error: %v", err)

api/challenge.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package api
22

33
import (
4+
"adams549659584/go-proxy-bingai/common"
45
"adams549659584/go-proxy-bingai/common/helper"
56
"fmt"
67
"net/http"
@@ -96,6 +97,15 @@ func ChallengeHandler(w http.ResponseWriter, r *http.Request) {
9697
return
9798
}
9899

100+
if r.URL.Query().Get("h") != "" {
101+
tmpReq := r.URL.Query()
102+
tmpReq.Del("h")
103+
r.URL.RawQuery = tmpReq.Encode()
104+
105+
common.NewSingleHostReverseProxy(common.BING_URL).ServeHTTP(w, r)
106+
return
107+
}
108+
99109
w.Header().Set("Content-Type", "text/html; charset=utf-8")
100110
w.Write([]byte(fmt.Sprintf(respChallengeHtml, r.URL.Query().Get("iframeid"))))
101111
}

api/verify.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ func VerifyHandler(w http.ResponseWriter, r *http.Request) {
6363
iframeid, _ := url.QueryUnescape(queryRaw.Get("iframeid"))
6464
convId, _ := url.QueryUnescape(queryRaw.Get("convId"))
6565
rid, _ := url.QueryUnescape(queryRaw.Get("rid"))
66-
resp, status, err := binglib.Bypass(bypassServer, strings.Join(reqCookies, "; "), iframeid, IG, convId, rid, T)
66+
resp, status, err := binglib.Bypass(bypassServer, strings.Join(reqCookies, "; "), iframeid, IG, convId, rid, T, r.Host)
6767
if err != nil {
6868
helper.ErrorResult(w, http.StatusInternalServerError, err.Error())
6969
common.Logger.Error("VerifyHandler Bypass Error: %v", err)

cloudflare/worker.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,7 @@ const verify = async (request, cookie) => {
282282
'convId': currentUrl.searchParams.get('convId'),
283283
'rid': currentUrl.searchParams.get('rid'),
284284
'T': currentUrl.searchParams.get('T'),
285+
'host': WEB_CONFIG.WORKER_URL.replace("http://", "").replace("https://", ""),
285286
}
286287
const newReq = new Request(bypassServer, {
287288
method: 'POST',
@@ -531,7 +532,12 @@ export default {
531532
}
532533

533534
if (currentUrl.pathname === '/turing/captcha/challenge') {
534-
return challenge(request);
535+
if (currentUrl.searchParams.get('h') != '') {
536+
let params = currentUrl.searchParams.delete('h');
537+
targetUrl = new URL(BING_ORIGIN + '/turing/captcha/challenge' + params.search);
538+
} else {
539+
return challenge(request);
540+
}
535541
}
536542
if (currentUrl.pathname === '/challenge/verify') {
537543
return verify(request, cookies);

common/api/v1/func.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ func getCookie(reqCookie, convId, rid string) (cookie string, err error) {
5656
if err != nil {
5757
return
5858
}
59-
resp, status, err := binglib.Bypass(common.BypassServer, reqCookie, "local-gen-"+hex.NewUUID(), IG, convId, rid, T)
59+
resp, status, err := binglib.Bypass(common.BypassServer, reqCookie, "local-gen-"+hex.NewUUID(), IG, convId, rid, T, "")
6060
if err != nil || status != http.StatusOK {
6161
common.Logger.Error("Bypass Error: %v", err)
6262
return

docker/Dockerfile-nightly-with-pass

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ WORKDIR /app
77

88
USER root
99

10-
RUN apt-get update && apt-get install -y --no-install-recommends curl
10+
RUN apt-get update && apt-get install -y --no-install-recommends curl supervisor
1111

1212
RUN curl -L https://github.com/Harry-zklcdc/go-proxy-bingai/releases/download/nightly/go-proxy-bingai-linux-amd64.tar.gz -o go-proxy-bingai-linux-amd64.tar.gz && \
1313
tar -zxvf go-proxy-bingai-linux-amd64.tar.gz && \
@@ -22,6 +22,9 @@ RUN apt-get remove -y curl && \
2222
rm go-proxy-bingai-linux-amd64.tar.gz
2323

2424
COPY docker/supervisor.conf /etc/supervisor/conf.d/supervisor.conf
25+
RUN mkdir -p /tmp/edge /var/run/supervisor /var/log/supervisor
26+
RUN chown "${GBP_USER_ID}:${GBP_USER_ID}" /var/run/supervisor /var/log/supervisor
27+
RUN chmod 777 /tmp
2528

2629
USER $GBP_USER
2730

docker/Dockerfile-with-pass

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ WORKDIR /app
77

88
USER root
99

10-
RUN apt-get update && apt-get install -y --no-install-recommends curl
10+
RUN apt-get update && apt-get install -y --no-install-recommends curl supervisor
1111

1212
RUN curl -L https://github.com/Harry-zklcdc/go-proxy-bingai/releases/latest/download/go-proxy-bingai-linux-amd64.tar.gz -o go-proxy-bingai-linux-amd64.tar.gz && \
1313
tar -zxvf go-proxy-bingai-linux-amd64.tar.gz && \
@@ -22,6 +22,9 @@ RUN apt-get remove -y curl && \
2222
rm go-proxy-bingai-linux-amd64.tar.gz
2323

2424
COPY docker/supervisor.conf /etc/supervisor/conf.d/supervisor.conf
25+
RUN mkdir -p /tmp/edge /var/run/supervisor /var/log/supervisor
26+
RUN chown "${GBP_USER_ID}:${GBP_USER_ID}" /var/run/supervisor /var/log/supervisor
27+
RUN chmod 777 /tmp
2528

2629
USER $GBP_USER
2730

docker/supervisor.conf

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,6 @@ supervisor.rpcinterface_factory=supervisor.rpcinterface:make_main_rpcinterface
1616
[supervisorctl]
1717
serverurl=http://127.0.0.1:9005
1818

19-
[program:xvfb]
20-
priority=0
21-
environment=START_XVFB=true
22-
command=/opt/bin/start-xvfb.sh
23-
autostart=true
24-
autorestart=true
25-
26-
;Logs
27-
redirect_stderr=false
28-
stdout_logfile=/var/log/supervisor/xvfb-stdout.log
29-
stderr_logfile=/var/log/supervisor/xvfb-stderr.log
30-
stdout_logfile_maxbytes=50MB
31-
stderr_logfile_maxbytes=50MB
32-
stdout_logfile_backups=5
33-
stderr_logfile_backups=5
34-
stdout_capture_maxbytes=50MB
35-
stderr_capture_maxbytes=50MB
36-
3719
[program:go-bingai-pass]
3820
command=/app/go-bingai-pass
3921
environment=PORT=45678

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ go 1.21.4
55
toolchain go1.21.6
66

77
require (
8-
github.com/Harry-zklcdc/bing-lib v1.7.0
8+
github.com/Harry-zklcdc/bing-lib v1.8.0
99
github.com/Harry-zklcdc/ms-auth v1.1.6
1010
github.com/andybalholm/brotli v1.1.0
1111
github.com/refraction-networking/utls v1.6.6

0 commit comments

Comments
 (0)