From c9f1089f6500521f0e0229d08aa8c431d4403c93 Mon Sep 17 00:00:00 2001 From: X1r0z Date: Tue, 8 Aug 2023 11:03:12 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E5=8D=95=E7=8B=AC?= =?UTF-8?q?=E6=8C=87=E5=AE=9A=E7=94=A8=E6=88=B7=E5=90=8D/=E5=AF=86?= =?UTF-8?q?=E7=A0=81=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 增加单独指定用户名/密码参数 --- lib/run.go | 1 + main.go | 41 +++++++++++++++++++++++++++++------------ 2 files changed, 30 insertions(+), 12 deletions(-) diff --git a/lib/run.go b/lib/run.go index 4c9b2ad..e6af71d 100644 --- a/lib/run.go +++ b/lib/run.go @@ -22,6 +22,7 @@ func BruteRunner(targetUrl string, mode string, domain string, userDict []string authPath := ExchangeUrls[mode] u, _ := url.JoinPath(targetUrl, authPath) Log.Info("[*] 使用 %v 接口爆破: %v", mode, targetUrl) + Log.Info("[*] 用户名:%v 密码:%v 共计:%v", len(userDict), len(passDict), len(userDict)*len(passDict)) task := make(chan []string, len(userDict)*len(passDict)) diff --git a/main.go b/main.go index 94247ab..869e65b 100644 --- a/main.go +++ b/main.go @@ -17,6 +17,8 @@ func main() { domain string user string pass string + userf string + passf string n int v bool delay int @@ -26,8 +28,10 @@ func main() { flag.StringVar(&mode, "mode", "", "指定 Exchange Web 接口") flag.BoolVar(&check, "check", false, "检测目标 Exchange 可用接口") flag.StringVar(&domain, "domain", "", "AD 域名") - flag.StringVar(&user, "user", "", "用户名字典") - flag.StringVar(&pass, "pass", "", "密码字典") + flag.StringVar(&user, "user", "", "指定用户名") + flag.StringVar(&pass, "pass", "", "指定密码") + flag.StringVar(&userf, "userf", "", "用户名字典") + flag.StringVar(&passf, "passf", "", "密码字典") flag.IntVar(&n, "thread", 2, "协程数量") flag.IntVar(&delay, "delay", 0, "请求延时") flag.BoolVar(&v, "verbose", false, "显示详细信息") @@ -50,19 +54,32 @@ func main() { lib.Check(targetUrl) } else { - userFp, _ := os.Open(user) - passFp, _ := os.Open(pass) + var userDict []string + var passDict []string - defer userFp.Close() - defer passFp.Close() + if user != "" { + userDict = []string{user} + } - userBytes, _ := io.ReadAll(userFp) - passBytes, _ := io.ReadAll(passFp) + if pass != "" { + passDict = []string{pass} + } - userDict := strings.Split(string(userBytes), "\n") - passDict := strings.Split(string(passBytes), "\n") - userDict = userDict[:len(userDict)-1] - passDict = passDict[:len(passDict)-1] + if userf != "" { + fp, _ := os.Open(userf) + defer fp.Close() + b, _ := io.ReadAll(fp) + userDict = strings.Split(string(b), "\n") + userDict = userDict[:len(userDict)-1] + } + + if passf != "" { + fp, _ := os.Open(passf) + defer fp.Close() + b, _ := io.ReadAll(fp) + passDict = strings.Split(string(b), "\n") + passDict = passDict[:len(passDict)-1] + } var worker lib.BruteWorker