Skip to content

Commit

Permalink
🎉 v1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
wjlin0 committed Oct 17, 2024
1 parent e72fdf4 commit beaaa52
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 91 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,17 @@ go install -v github.com/wjlin0/riverPass/cmd/riverPass@latest
riverPass -h
```
```yaml
riverPass 1.0.0 数瑞WAF绕过工具
riverPass v1.0.0 数瑞WAF绕过工具

Usage:
./riverPass [flags]
riverPass [flags]

Flags:
输入:
-pp, -proxy-port int 代理监听端口 (default 8001)
-wp, -websocket-port int websocket监听端口 (default 10001)
-wt, -websocket-token string websocket通信密钥 (default "123456")
-pp, -proxy-port int 代理监听端口 (default 8001)
-wp, -websocket-port int websocket监听端口 (default 10001)
-wt, -websocket-token string websocket通信密钥 (default "123456")
-dw, -domain-whitelist string[] 域名白名单,只允许指定域名进行代理重放

代理:
-p, -proxy string[] 下游代理
Expand All @@ -69,9 +70,8 @@ EXAMPLES:
$ riverPass -pp 8081
运行 riverPass 设置下游代理:
$ riverPass -proxy http://127.0.0.1:7890



运行 riverPass 设置白名单只允许指定的域名列表进行代理重放:
$ riverPass -dw www.189.cn,www.example.com
```
**注意**:在此之前你必须导入`mitmproxy`的证书(若没有 可随意运行一次 `riverPass`,它位于你主机的 `$HOME/.mitmproxy` 目录下)
Expand Down
82 changes: 0 additions & 82 deletions index.html

This file was deleted.

6 changes: 5 additions & 1 deletion pkg/runner/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ import (
func ParserOptions() *types.Options {
options := &types.Options{}
set := goflags.NewFlagSet()
set.SetDescription(fmt.Sprintf("riverPass %s 数瑞WAF绕过工具 ", Version))
set.SetDescription(fmt.Sprintf("riverPass v%s 数瑞WAF绕过工具 ", Version))
set.CreateGroup("Input", "输入",
set.IntVarP(&options.ProxyPort, "proxy-port", "pp", 8001, "代理监听端口"),
set.IntVarP(&options.WebSocketPort, "websocket-port", "wp", 10001, "websocket监听端口"),
set.StringVarP(&options.WebSocketToken, "websocket-token", "wt", "123456", "websocket通信密钥"),
set.StringSliceVarP(&options.DomainWhitelist, "domain-whitelist", "dw", nil, "域名白名单,只允许指定域名进行代理重放", goflags.FileCommaSeparatedStringSliceOptions),
)

set.CreateGroup("Proxy", "代理",
set.StringSliceVarP(&options.Proxy, "proxy", "p", nil, "下游代理", goflags.FileCommaSeparatedStringSliceOptions),
)
Expand All @@ -39,6 +41,8 @@ func ParserOptions() *types.Options {
$ riverPass -pp 8081
运行 riverPass 设置下游代理:
$ riverPass -proxy http://127.0.0.1:7890
运行 riverPass 设置白名单只允许指定的域名列表进行代理重放:
$ riverPass -dw www.189.cn,www.example.com
`)
set.SetConfigFilePath(filepath.Join(DefaultConfig))

Expand Down
49 changes: 49 additions & 0 deletions pkg/runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ import (
"github.com/wjlin0/riverPass/pkg/types"
"github.com/wjlin0/riverPass/pkg/websocketbody"
"github.com/wjlin0/riverPass/pkg/websocketserver"
proxyutils "github.com/wjlin0/utils/proxy"
updateutils "github.com/wjlin0/utils/update"
"net/http"
"net/url"
"strconv"
"strings"
)
Expand All @@ -24,6 +27,18 @@ type Runner struct {
}

func (r *Runner) Request(flow *proxy.Flow) {
// 判断是否在白名单中
u := flow.Request.URL
if len(r.Options.DomainWhitelist) > 0 && !func() bool {
for _, domain := range r.Options.DomainWhitelist {
if strings.Contains(u.Host, domain) {
return true
}
}
return false
}() {
return
}
// 得到所有的请求头
headers := flow.Request.Header
flag := headers.Get("Req-Flag")
Expand Down Expand Up @@ -118,6 +133,17 @@ func (r *Runner) HandleDelayedRequest(flow *proxy.Flow) {
}

func (r *Runner) Response(flow *proxy.Flow) {
u := flow.Request.URL
if len(r.Options.DomainWhitelist) > 0 && !func() bool {
for _, domain := range r.Options.DomainWhitelist {
if strings.Contains(u.Host, domain) {
return true
}
}
return false
}() {
return
}
flow.Response.ReplaceToDecodedBody()
// 得到所有的响应头
headers := flow.Request.Header
Expand Down Expand Up @@ -165,6 +191,29 @@ func NewRunner(opts *types.Options) (*Runner, error) {
Proxy: ps,
Options: opts,
}
if !opts.DisableUpdateCheck {
latestVersion, err := updateutils.GetToolVersionCallback(repoName, repoName)()
if err != nil {
gologger.Error().Msgf("Could not check for update: %s\n", err)
} else {
gologger.Info().Msgf("Current %s version v%v %v", repoName, Version, updateutils.GetVersionDescription(Version, latestVersion))
}
} else {
gologger.Info().Msgf("Current %s version v%v ", repoName, Version)
}

if types.ProxyURL != "" {
// 展示代理
parse, _ := url.Parse(types.ProxyURL)
if parse.Scheme == proxyutils.HTTPS || parse.Scheme == proxyutils.HTTP {
gologger.Info().Msgf("Using %s as proxy server", parse.String())
}

if parse.Scheme == proxyutils.SOCKS5 {
gologger.Info().Msgf("Using %s as socket proxy server", parse.String())
}
}

ps.AddAddon(run)
return run, nil

Expand Down
1 change: 1 addition & 0 deletions pkg/types/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ type Options struct {
ProxyPort int `json:"proxyPort"`
Proxy goflags.StringSlice `json:"proxy"`
DisableUpdateCheck bool `json:"disableUpdateCheck"`
DomainWhitelist goflags.StringSlice `json:"domainWhitelist"`
}

0 comments on commit beaaa52

Please sign in to comment.