Merge pull request #68 from everywall/fix/proxy_v2/add-package-urls

#65 use full URL in package line
This commit is contained in:
Kevin Pham
2023-12-08 07:19:30 -06:00
committed by GitHub
58 changed files with 104 additions and 86 deletions

View File

@@ -7,10 +7,11 @@ import (
"log"
"os"
"ladder/handlers"
"ladder/internal/cli"
"ladder/proxychain/requestmodifiers/bot"
"ladder/proxychain/ruleset"
"github.com/everywall/ladder/handlers"
"github.com/everywall/ladder/internal/cli"
"github.com/everywall/ladder/proxychain/requestmodifiers/bot"
ruleset_v2 "github.com/everywall/ladder/proxychain/ruleset"
"github.com/akamensky/argparse"
"github.com/gofiber/fiber/v2"

2
go.mod
View File

@@ -1,4 +1,4 @@
module ladder
module github.com/everywall/ladder
go 1.21.1

View File

@@ -1,9 +1,10 @@
package handlers
import (
"ladder/proxychain"
rx "ladder/proxychain/requestmodifiers"
tx "ladder/proxychain/responsemodifiers"
rx "github.com/everywall/ladder/proxychain/requestmodifiers"
tx "github.com/everywall/ladder/proxychain/responsemodifiers"
"github.com/everywall/ladder/proxychain"
"github.com/gofiber/fiber/v2"
)

View File

@@ -2,8 +2,9 @@ package handlers
import (
"encoding/json"
"github.com/everywall/ladder/proxychain/responsemodifiers/api"
"github.com/gofiber/fiber/v2"
"ladder/proxychain/responsemodifiers/api"
)
func NewAPIModifersListHandler(opts *ProxyOptions) fiber.Handler {

View File

@@ -146,7 +146,7 @@ package handlers
// for use in proxychains.
import (
"ladder/proxychain/responsemodifiers/api"
"github.com/everywall/ladder/proxychain/responsemodifiers/api"
)
type ModifiersAPIResponse struct {

View File

@@ -5,7 +5,7 @@ package handlers
// for use in proxychains.
import (
"ladder/proxychain/responsemodifiers/api"
"github.com/everywall/ladder/proxychain/responsemodifiers/api"
)
type ModifiersAPIResponse struct {

View File

@@ -1,9 +1,10 @@
package handlers
import (
"ladder/proxychain"
rx "ladder/proxychain/requestmodifiers"
tx "ladder/proxychain/responsemodifiers"
rx "github.com/everywall/ladder/proxychain/requestmodifiers"
tx "github.com/everywall/ladder/proxychain/responsemodifiers"
"github.com/everywall/ladder/proxychain"
"github.com/gofiber/fiber/v2"
)

View File

@@ -1,9 +1,10 @@
package handlers
import (
"ladder/proxychain"
rx "ladder/proxychain/requestmodifiers"
tx "ladder/proxychain/responsemodifiers"
rx "github.com/everywall/ladder/proxychain/requestmodifiers"
tx "github.com/everywall/ladder/proxychain/responsemodifiers"
"github.com/everywall/ladder/proxychain"
"github.com/gofiber/fiber/v2"
)

View File

@@ -1,10 +1,11 @@
package handlers
import (
"ladder/proxychain"
rx "ladder/proxychain/requestmodifiers"
tx "ladder/proxychain/responsemodifiers"
"ladder/proxychain/ruleset"
rx "github.com/everywall/ladder/proxychain/requestmodifiers"
tx "github.com/everywall/ladder/proxychain/responsemodifiers"
"github.com/everywall/ladder/proxychain"
ruleset_v2 "github.com/everywall/ladder/proxychain/ruleset"
"github.com/gofiber/fiber/v2"
)

View File

@@ -5,7 +5,7 @@ import (
"io"
"os"
"ladder/proxychain/ruleset"
ruleset_v2 "github.com/everywall/ladder/proxychain/ruleset"
)
// HandleRulesetMerge merges a set of ruleset files, specified by the rulesetPath or RULESET env variable, into either YAML or Gzip format.

View File

@@ -70,8 +70,8 @@ package ruleset_v2
// for use in proxychains.
import (
"ladder/proxychain"
tx "ladder/proxychain/responsemodifiers"
"github.com/everywall/ladder/proxychain"
tx "github.com/everywall/ladder/proxychain/responsemodifiers"
)
type ResponseModifierFactory func(params ...string) proxychain.ResponseModification
@@ -142,8 +142,8 @@ package ruleset_v2
// for use in proxychains.
import (
"ladder/proxychain"
rx "ladder/proxychain/requestmodifiers"
"github.com/everywall/ladder/proxychain"
rx "github.com/everywall/ladder/proxychain/requestmodifiers"
)
type RequestModifierFactory func(params ...string) proxychain.RequestModification

View File

@@ -1,8 +1,9 @@
package requestmodifiers
import (
"ladder/proxychain"
"math/rand"
"github.com/everywall/ladder/proxychain"
)
// AddCacheBusterQuery modifies query params to add a random parameter key

View File

@@ -3,7 +3,7 @@ package requestmodifiers
import (
"strings"
//"fmt"
"ladder/proxychain"
"github.com/everywall/ladder/proxychain"
)
var forwardBlacklist map[string]bool

View File

@@ -1,8 +1,9 @@
package requestmodifiers
import (
"ladder/proxychain"
"ladder/proxychain/requestmodifiers/bot"
"github.com/everywall/ladder/proxychain/requestmodifiers/bot"
"github.com/everywall/ladder/proxychain"
)
// MasqueradeAsGoogleBot modifies user agent and x-forwarded for

View File

@@ -4,7 +4,7 @@ import (
"fmt"
"regexp"
"ladder/proxychain"
"github.com/everywall/ladder/proxychain"
)
func ModifyDomainWithRegex(matchRegex string, replacement string) proxychain.RequestModification {

View File

@@ -5,7 +5,7 @@ import (
//http "github.com/Danny-Dasilva/fhttp"
http "github.com/bogdanfinn/fhttp"
"ladder/proxychain"
"github.com/everywall/ladder/proxychain"
)
// SetOutgoingCookie modifes a specific cookie name

View File

@@ -4,7 +4,7 @@ import (
"fmt"
"regexp"
"ladder/proxychain"
"github.com/everywall/ladder/proxychain"
)
func ModifyPathWithRegex(matchRegex string, replacement string) proxychain.RequestModification {

View File

@@ -4,7 +4,7 @@ import (
//"fmt"
"net/url"
"ladder/proxychain"
"github.com/everywall/ladder/proxychain"
)
// ModifyQueryParams replaces query parameter values in URL's query params in a ProxyChain's URL.

View File

@@ -1,7 +1,7 @@
package requestmodifiers
import (
"ladder/proxychain"
"github.com/everywall/ladder/proxychain"
)
// SetRequestHeader modifies a specific outgoing header

View File

@@ -5,8 +5,9 @@ import (
"net/url"
"regexp"
"ladder/proxychain"
tx "ladder/proxychain/responsemodifiers"
tx "github.com/everywall/ladder/proxychain/responsemodifiers"
"github.com/everywall/ladder/proxychain"
)
const archivistUrl string = "https://archive.is/latest"

View File

@@ -3,7 +3,7 @@ package requestmodifiers
import (
"net/url"
"ladder/proxychain"
"github.com/everywall/ladder/proxychain"
)
const googleCacheUrl string = "https://webcache.googleusercontent.com/search?q=cache:"

View File

@@ -4,8 +4,9 @@ import (
"net/url"
"regexp"
"ladder/proxychain"
tx "ladder/proxychain/responsemodifiers"
tx "github.com/everywall/ladder/proxychain/responsemodifiers"
"github.com/everywall/ladder/proxychain"
)
const waybackUrl string = "https://web.archive.org/web/"

View File

@@ -14,7 +14,7 @@ import (
//"net/http"
*/
"ladder/proxychain"
"github.com/everywall/ladder/proxychain"
)
// resolveWithGoogleDoH resolves DNS using Google's DNS-over-HTTPS

View File

@@ -1,7 +1,7 @@
package requestmodifiers
import (
"ladder/proxychain"
"github.com/everywall/ladder/proxychain"
)
// SpoofOrigin modifies the origin header

View File

@@ -3,8 +3,9 @@ package requestmodifiers
import (
"fmt"
"ladder/proxychain"
tx "ladder/proxychain/responsemodifiers"
tx "github.com/everywall/ladder/proxychain/responsemodifiers"
"github.com/everywall/ladder/proxychain"
)
// SpoofReferrer modifies the referrer header.

View File

@@ -6,7 +6,7 @@ import (
"strings"
"time"
"ladder/proxychain"
"github.com/everywall/ladder/proxychain"
)
// SpoofReferrerFromBaiduSearch modifies the referrer header

View File

@@ -1,7 +1,7 @@
package requestmodifiers
import (
"ladder/proxychain"
"github.com/everywall/ladder/proxychain"
)
// SpoofReferrerFromBingSearch modifies the referrer header

View File

@@ -1,7 +1,7 @@
package requestmodifiers
import (
"ladder/proxychain"
"github.com/everywall/ladder/proxychain"
)
// SpoofReferrerFromGoogleSearch modifies the referrer header

View File

@@ -1,7 +1,7 @@
package requestmodifiers
import (
"ladder/proxychain"
"github.com/everywall/ladder/proxychain"
)
// SpoofReferrerFromLinkedInPost modifies the referrer header

View File

@@ -3,7 +3,7 @@ package requestmodifiers
import (
"fmt"
"ladder/proxychain"
"github.com/everywall/ladder/proxychain"
)
// SpoofReferrerFromNaverSearch modifies the referrer header

View File

@@ -1,7 +1,7 @@
package requestmodifiers
import (
"ladder/proxychain"
"github.com/everywall/ladder/proxychain"
)
// SpoofReferrerFromPinterestPost modifies the referrer header

View File

@@ -1,7 +1,7 @@
package requestmodifiers
import (
"ladder/proxychain"
"github.com/everywall/ladder/proxychain"
)
// SpoofReferrerFromQQPost modifies the referrer header

View File

@@ -1,7 +1,7 @@
package requestmodifiers
import (
"ladder/proxychain"
"github.com/everywall/ladder/proxychain"
)
// SpoofReferrerFromRedditPost modifies the referrer header

View File

@@ -1,7 +1,7 @@
package requestmodifiers
import (
"ladder/proxychain"
"github.com/everywall/ladder/proxychain"
)
// SpoofReferrerFromTumblrPost modifies the referrer header

View File

@@ -1,7 +1,7 @@
package requestmodifiers
import (
"ladder/proxychain"
"github.com/everywall/ladder/proxychain"
)
// SpoofReferrerFromTwitterPost modifies the referrer header

View File

@@ -1,7 +1,7 @@
package requestmodifiers
import (
"ladder/proxychain"
"github.com/everywall/ladder/proxychain"
)
// SpoofReferrerFromVkontaktePost modifies the referrer header

View File

@@ -4,7 +4,7 @@ import (
"fmt"
"math/rand"
"ladder/proxychain"
"github.com/everywall/ladder/proxychain"
)
// SpoofReferrerFromWeiboPost modifies the referrer header

View File

@@ -4,8 +4,9 @@ import (
_ "embed"
"strings"
"ladder/proxychain"
tx "ladder/proxychain/responsemodifiers"
tx "github.com/everywall/ladder/proxychain/responsemodifiers"
"github.com/everywall/ladder/proxychain"
)
// https://github.com/faisalman/ua-parser-js/tree/master

View File

@@ -1,7 +1,7 @@
package requestmodifiers
import (
"ladder/proxychain"
"github.com/everywall/ladder/proxychain"
)
// SpoofXForwardedFor modifies the X-Forwarded-For header

View File

@@ -7,8 +7,9 @@ import (
"github.com/markusmobius/go-trafilatura"
"ladder/proxychain"
"ladder/proxychain/responsemodifiers/api"
"github.com/everywall/ladder/proxychain/responsemodifiers/api"
"github.com/everywall/ladder/proxychain"
)
// APIContent creates an JSON representation of the article and returns it as an API response.

View File

@@ -7,7 +7,7 @@ import (
"net/url"
"testing"
"ladder/proxychain/responsemodifiers/api"
"github.com/everywall/ladder/proxychain/responsemodifiers/api"
)
func TestCreateAPIErrReader(t *testing.T) {

View File

@@ -4,8 +4,9 @@ import (
_ "embed"
"strings"
"ladder/proxychain"
"ladder/proxychain/responsemodifiers/rewriters"
"github.com/everywall/ladder/proxychain/responsemodifiers/rewriters"
"github.com/everywall/ladder/proxychain"
)
//go:embed vendor/block_element_removal.js

View File

@@ -5,8 +5,9 @@ import (
"fmt"
"strings"
"ladder/proxychain"
"ladder/proxychain/responsemodifiers/rewriters"
"github.com/everywall/ladder/proxychain/responsemodifiers/rewriters"
"github.com/everywall/ladder/proxychain"
)
// BlockThirdPartyScripts rewrites HTML and injects JS to block all third party JS from loading.

View File

@@ -1,7 +1,7 @@
package responsemodifiers
import (
"ladder/proxychain"
"github.com/everywall/ladder/proxychain"
)
// BypassCORS modifies response headers to prevent the browser

View File

@@ -1,7 +1,7 @@
package responsemodifiers
import (
"ladder/proxychain"
"github.com/everywall/ladder/proxychain"
)
// TODO: handle edge case where CSP is specified in meta tag:

View File

@@ -4,7 +4,7 @@ import (
_ "embed"
"strings"
"ladder/proxychain"
"github.com/everywall/ladder/proxychain"
)
// DeleteLocalStorageData deletes localstorage cookies.

View File

@@ -4,7 +4,7 @@ import (
_ "embed"
"strings"
"ladder/proxychain"
"github.com/everywall/ladder/proxychain"
)
// DeleteSessionStorageData deletes localstorage cookies.

View File

@@ -5,7 +5,7 @@ import (
"net/url"
"strings"
"ladder/proxychain"
"github.com/everywall/ladder/proxychain"
)
var forwardBlacklist map[string]bool

View File

@@ -10,7 +10,7 @@ import (
"net/url"
"strings"
"ladder/proxychain"
"github.com/everywall/ladder/proxychain"
"golang.org/x/net/html"
"golang.org/x/net/html/atom"

View File

@@ -4,8 +4,9 @@ import (
_ "embed"
"strings"
"ladder/proxychain"
"ladder/proxychain/responsemodifiers/rewriters"
"github.com/everywall/ladder/proxychain/responsemodifiers/rewriters"
"github.com/everywall/ladder/proxychain"
)
// injectScript modifies HTTP responses

View File

@@ -7,7 +7,7 @@ import (
//"net/http"
//http "github.com/Danny-Dasilva/fhttp"
"ladder/proxychain"
"github.com/everywall/ladder/proxychain"
)
// DeleteIncomingCookies prevents ALL cookies from being sent from the proxy server

View File

@@ -1,7 +1,7 @@
package responsemodifiers
import (
"ladder/proxychain"
"github.com/everywall/ladder/proxychain"
)
// SetResponseHeader modifies response headers from the upstream server

View File

@@ -5,8 +5,9 @@ import (
"fmt"
"strings"
"ladder/proxychain"
"ladder/proxychain/responsemodifiers/rewriters"
"github.com/everywall/ladder/proxychain/responsemodifiers/rewriters"
"github.com/everywall/ladder/proxychain"
)
//go:embed vendor/patch_dynamic_resource_urls.js

View File

@@ -7,7 +7,7 @@ import (
"log"
"regexp"
"ladder/proxychain"
"github.com/everywall/ladder/proxychain"
)
//go:embed vendor/ddg-tracker-surrogates/mapping.json

View File

@@ -5,8 +5,9 @@ import (
"fmt"
"strings"
"ladder/proxychain"
"ladder/proxychain/responsemodifiers/rewriters"
"github.com/everywall/ladder/proxychain/responsemodifiers/rewriters"
"github.com/everywall/ladder/proxychain"
)
// RewriteHTMLResourceURLs modifies HTTP responses

View File

@@ -6,7 +6,7 @@ import (
"fmt"
//"gopkg.in/yaml.v3"
"ladder/proxychain"
"github.com/everywall/ladder/proxychain"
)
type Rule struct {

View File

@@ -5,8 +5,8 @@ package ruleset_v2
// for use in proxychains.
import (
"ladder/proxychain"
rx "ladder/proxychain/requestmodifiers"
"github.com/everywall/ladder/proxychain"
rx "github.com/everywall/ladder/proxychain/requestmodifiers"
)
type RequestModifierFactory func(params ...string) proxychain.RequestModification

View File

@@ -5,8 +5,8 @@ package ruleset_v2
// for use in proxychains.
import (
"ladder/proxychain"
tx "ladder/proxychain/responsemodifiers"
"github.com/everywall/ladder/proxychain"
tx "github.com/everywall/ladder/proxychain/responsemodifiers"
)
type ResponseModifierFactory func(params ...string) proxychain.ResponseModification