From 9d31f7eb5987f4776eb263054f846c1f1c335746 Mon Sep 17 00:00:00 2001 From: Kevin Pham Date: Tue, 28 Nov 2023 07:37:28 -0600 Subject: [PATCH] improve token rewriting --- handlers/proxy.go | 14 ++++++++++---- .../rewriters/html_token_url_rewriter.go | 1 + 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/handlers/proxy.go b/handlers/proxy.go index 8e3d5c5..4f60ef0 100644 --- a/handlers/proxy.go +++ b/handlers/proxy.go @@ -24,6 +24,10 @@ func NewProxySiteHandler(opts *ProxyOptions) fiber.Handler { rs = r } */ + const botUA string = "Mozilla/5.0 (compatible; Yahoo! Slurp; http://help.yahoo.com/help/us/ysearch/slurp)" + // 5.255.250.0/24, 37.9.87.0/24, 67.195.37.0/24, 67.195.50.0/24, 67.195.110.0/24, 67.195.111.0/24, 67.195.112.0/23, 67.195.114.0/24, 67.195.115.0/24, 68.180.224.0/21, 72.30.132.0/24, 72.30.142.0/24, 72.30.161.0/24, 72.30.196.0/24, 72.30.198.0/24, 74.6.254.0/24, 74.6.8.0/24, 74.6.13.0/24, 74.6.17.0/24, 74.6.18.0/24, 74.6.22.0/24, 74.6.27.0/24, 74.6.168.0/24, 77.88.5.0/24, 77.88.47.0/24, 93.158.161.0/24, 98.137.72.0/24, 98.137.206.0/24, 98.137.207.0/24, 98.139.168.0/24, 114.111.95.0/24, 124.83.159.0/24, 124.83.179.0/24, 124.83.223.0/24, 141.8.144.0/24, 183.79.63.0/24, 183.79.92.0/24, 203.216.255.0/24, 211.14.11.0/24 + //const ja3 string = "769,49195-49199-49200-49161-49171-49162-49172-156-157-47-10-53-51-57,65281-0-23-35-13-13172-11-10,29-23-24,0" + const ja3 string = "771,49199-49195-49171-49161-49200-49196-49172-49162-51-57-50-49169-49159-47-53-10-5-4-255,0-11-10-13-13172-16,23-25-28-27-24-26-22-14-13-11-12-9-10,0-1-2" return func(c *fiber.Ctx) error { proxychain := proxychain. @@ -31,6 +35,7 @@ func NewProxySiteHandler(opts *ProxyOptions) fiber.Handler { SetFiberCtx(c). SetDebugLogging(opts.Verbose). SetRequestModifications( + rx.SpoofJA3fingerprint(ja3, botUA), //rx.MasqueradeAsFacebookBot(), //rx.MasqueradeAsGoogleBot(), //rx.DeleteOutgoingCookies(), @@ -45,13 +50,14 @@ func NewProxySiteHandler(opts *ProxyOptions) fiber.Handler { //rx.RequestArchiveIs(), ). AddResponseModifications( - tx.ForwardResponseHeaders(), - //tx.BypassCORS(), - //tx.BypassContentSecurityPolicy(), + + //tx.ForwardResponseHeaders(), + tx.BypassCORS(), + tx.BypassContentSecurityPolicy(), //tx.DeleteIncomingCookies(), tx.RewriteHTMLResourceURLs(), tx.PatchDynamicResourceURLs(), - //tx.SetContentSecurityPolicy("default-src * 'unsafe-inline' 'unsafe-eval' data: blob:;"), + //tx.SetContentSecurityPolicy("default-src * 'unsafe-inline' 'unsafe-eval' data: blob:;"), ). Execute() diff --git a/proxychain/responsemodifers/rewriters/html_token_url_rewriter.go b/proxychain/responsemodifers/rewriters/html_token_url_rewriter.go index f52569b..8d748b4 100644 --- a/proxychain/responsemodifers/rewriters/html_token_url_rewriter.go +++ b/proxychain/responsemodifers/rewriters/html_token_url_rewriter.go @@ -196,6 +196,7 @@ func handleDocumentRelativePath(attr *html.Attribute, baseURL *url.URL) { relativePath, ) attr.Val = escape(attr.Val) + attr.Val = fmt.Sprintf("/%s", attr.Val) log.Printf("doc rel url rewritten-> '%s'='%s'", attr.Key, attr.Val) }