diff --git a/proxychain/requestmodifers/forward_request_headers.go b/proxychain/requestmodifers/forward_request_headers.go index 40cc5c1..c329564 100644 --- a/proxychain/requestmodifers/forward_request_headers.go +++ b/proxychain/requestmodifers/forward_request_headers.go @@ -1,9 +1,9 @@ package requestmodifers import ( + "strings" //"fmt" "ladder/proxychain" - "strings" ) var forwardBlacklist map[string]bool @@ -27,7 +27,6 @@ func init() { // ForwardRequestHeaders forwards the requests headers sent from the client to the upstream server func ForwardRequestHeaders() proxychain.RequestModification { return func(chain *proxychain.ProxyChain) error { - forwardHeaders := func(key, value []byte) { k := strings.ToLower(string(key)) v := string(value) diff --git a/proxychain/requestmodifers/request_archive_is.go b/proxychain/requestmodifers/request_archive_is.go index b0f321a..d3ebc7d 100644 --- a/proxychain/requestmodifers/request_archive_is.go +++ b/proxychain/requestmodifers/request_archive_is.go @@ -3,10 +3,10 @@ package requestmodifers import ( "fmt" "net/url" + "regexp" "ladder/proxychain" tx "ladder/proxychain/responsemodifers" - "regexp" ) const archivistUrl string = "https://archive.is/latest" diff --git a/proxychain/requestmodifers/request_wayback_machine.go b/proxychain/requestmodifers/request_wayback_machine.go index 141becc..ecc4270 100644 --- a/proxychain/requestmodifers/request_wayback_machine.go +++ b/proxychain/requestmodifers/request_wayback_machine.go @@ -2,10 +2,10 @@ package requestmodifers import ( "net/url" + "regexp" "ladder/proxychain" tx "ladder/proxychain/responsemodifers" - "regexp" ) const waybackUrl string = "https://web.archive.org/web/" diff --git a/proxychain/requestmodifers/resolve_with_google_doh.go b/proxychain/requestmodifers/resolve_with_google_doh.go index 554e3ac..19560b7 100644 --- a/proxychain/requestmodifers/resolve_with_google_doh.go +++ b/proxychain/requestmodifers/resolve_with_google_doh.go @@ -4,15 +4,16 @@ import ( "context" "encoding/json" "fmt" - http "github.com/bogdanfinn/fhttp" "net" + "time" + + http "github.com/bogdanfinn/fhttp" + /* tls_client "github.com/bogdanfinn/tls-client" //"net/http" */ - "time" - "ladder/proxychain" ) @@ -71,7 +72,6 @@ func (cd *CustomDialer) DialContext(ctx context.Context, network, addr string) ( // ResolveWithGoogleDoH modifies a ProxyChain's client to make the request by resolving the URL // using Google's DNS over HTTPs service func ResolveWithGoogleDoH() proxychain.RequestModification { - ///customDialer := NewCustomDialer(10*time.Second, 10*time.Second) return func(chain *proxychain.ProxyChain) error { /* diff --git a/proxychain/requestmodifers/spoof_referrer.go b/proxychain/requestmodifers/spoof_referrer.go index 1ab8cf0..cc40801 100644 --- a/proxychain/requestmodifers/spoof_referrer.go +++ b/proxychain/requestmodifers/spoof_referrer.go @@ -2,6 +2,7 @@ package requestmodifers import ( "fmt" + "ladder/proxychain" tx "ladder/proxychain/responsemodifers" ) @@ -12,7 +13,6 @@ import ( // if url is "", then the referrer header is removed. func SpoofReferrer(url string) proxychain.RequestModification { return func(chain *proxychain.ProxyChain) error { - // change refer on client side js script := fmt.Sprintf(`document.referrer = "%s"`, url) chain.AddOnceResponseModifications( diff --git a/proxychain/requestmodifers/spoof_user_agent.go b/proxychain/requestmodifers/spoof_user_agent.go index cc706bc..8e2b3a7 100644 --- a/proxychain/requestmodifers/spoof_user_agent.go +++ b/proxychain/requestmodifers/spoof_user_agent.go @@ -2,9 +2,10 @@ package requestmodifers import ( _ "embed" + "strings" + "ladder/proxychain" tx "ladder/proxychain/responsemodifers" - "strings" ) // https://github.com/faisalman/ua-parser-js/tree/master diff --git a/proxychain/responsemodifers/forward_response_headers.go b/proxychain/responsemodifers/forward_response_headers.go index 763c7a9..a143d39 100644 --- a/proxychain/responsemodifers/forward_response_headers.go +++ b/proxychain/responsemodifers/forward_response_headers.go @@ -2,9 +2,10 @@ package responsemodifers import ( "fmt" - "ladder/proxychain" "net/url" "strings" + + "ladder/proxychain" ) var forwardBlacklist map[string]bool @@ -23,7 +24,6 @@ func init() { // ForwardResponseHeaders forwards the response headers from the upstream server to the client func ForwardResponseHeaders() proxychain.ResponseModification { return func(chain *proxychain.ProxyChain) error { - //fmt.Println(chain.Response.Header) for uname, headers := range chain.Response.Header { name := strings.ToLower(uname) diff --git a/proxychain/responsemodifers/outline.go b/proxychain/responsemodifers/outline.go index 13f60bb..be1f6cb 100644 --- a/proxychain/responsemodifers/outline.go +++ b/proxychain/responsemodifers/outline.go @@ -3,10 +3,12 @@ package responsemodifers import ( "bytes" "encoding/json" + "io" + //"github.com/go-shiori/dom" "github.com/markusmobius/go-trafilatura" //"golang.org/x/net/html" - "io" + "ladder/proxychain" "ladder/proxychain/responsemodifers/api" ) @@ -46,5 +48,4 @@ func APIOutline() proxychain.ResponseModification { chain.Response.Body = io.NopCloser(buf) return nil } - } diff --git a/proxychain/responsemodifers/rewriters/html_rewriter.go b/proxychain/responsemodifers/rewriters/html_rewriter.go index d14626f..aaa074a 100644 --- a/proxychain/responsemodifers/rewriters/html_rewriter.go +++ b/proxychain/responsemodifers/rewriters/html_rewriter.go @@ -66,6 +66,7 @@ func (r *HTMLRewriter) Close() error { r.tokenBuffer.Reset() r.currentToken = nil r.currentTokenProcessed = false + return nil } @@ -79,6 +80,7 @@ func (r *HTMLRewriter) Read(p []byte) (int, error) { if r.tokenizer.Err() == io.EOF { return 0, io.EOF } + return 0, r.tokenizer.Err() } @@ -96,6 +98,7 @@ func (r *HTMLRewriter) Read(p []byte) (int, error) { if !rewriter.ShouldModify(r.currentToken) { continue } + prepend, a := rewriter.ModifyToken(r.currentToken) appends = append(appends, a) // add to buffer @@ -125,5 +128,6 @@ func (r *HTMLRewriter) Read(p []byte) (int, error) { r.currentTokenProcessed = true err = nil // EOF in this context is expected and not an actual error } + return n, err }