-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
优化代码结构, 将 Runner 和 Worker 分离, 使用 Runner 统一调度 Worker
- Loading branch information
Showing
7 changed files
with
97 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,5 @@ | ||
package lib | ||
|
||
import "time" | ||
|
||
func KerberosBruteWorker(u string, domain string, task chan []string, limiter <-chan time.Time) { | ||
|
||
} | ||
|
||
func KerberosBruteRun(targetUrl string, mode string, domain string, userDict []string, passDict []string, n int, delay int) { | ||
func KerberosBruteWorker(info *TaskInfo) { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package lib | ||
|
||
import ( | ||
"net/url" | ||
"sync" | ||
"time" | ||
) | ||
|
||
type TaskInfo struct { | ||
targetUrl string | ||
mode string | ||
u string | ||
domain string | ||
task chan []string | ||
delay int | ||
} | ||
|
||
type BruteWorker func(info *TaskInfo) | ||
|
||
func BruteRunner(targetUrl string, mode string, domain string, userDict []string, passDict []string, n int, delay int, worker BruteWorker) { | ||
|
||
authPath := ExchangeUrls[mode] | ||
u, _ := url.JoinPath(targetUrl, authPath) | ||
Log.Info("[*] 使用 %v 接口爆破: %v", mode, targetUrl) | ||
|
||
task := make(chan []string, len(userDict)*len(passDict)) | ||
|
||
info := &TaskInfo{ | ||
targetUrl: targetUrl, | ||
mode: mode, | ||
u: u, | ||
domain: domain, | ||
task: task, | ||
delay: delay, | ||
} | ||
|
||
t1 := time.Now() | ||
|
||
for _, username := range userDict { | ||
for _, password := range passDict { | ||
data := []string{username, password} | ||
task <- data | ||
} | ||
} | ||
close(task) | ||
|
||
var wg sync.WaitGroup | ||
|
||
for i := 0; i < n; i++ { | ||
wg.Add(1) | ||
go func() { | ||
defer wg.Done() | ||
worker(info) | ||
}() | ||
} | ||
|
||
wg.Wait() | ||
|
||
t2 := time.Now() | ||
Log.Info("[*] 耗时: %v", t2.Sub(t1)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters