diff --git a/main.go b/main.go index e7a1e3c..163b172 100644 --- a/main.go +++ b/main.go @@ -12,6 +12,7 @@ import ( "crypto/tls" "bufio" "sync" + // "runtime" // "encoding/json" // "iouti" ) @@ -187,6 +188,7 @@ func main() { fmt.Println("User -",user) options.bruteforce(user) + // runtime.GC() //TODO might a hack to free memory, need to learn more where it's allocated. My guess it's channel. P.S. Yep, it is } } else { @@ -204,18 +206,16 @@ func (options Options) bruteforce(user string) { passwords := bufio.NewScanner(passFile) passwords.Split(bufio.ScanLines) - pass := make(chan string, 1000000000) // rockyou - 14344391 + // pass := make(chan string, 15000001) // rockyou - 14,344,391 + pass := make(chan string, 1000) // primarly we need big enough buffer to prevent slowdown for workers, so we kinda expect less then 1000 workers/threads - for passwords.Scan() { - // fmt.Println("add pass - ",passwords.Text()) - pass <- string(passwords.Text()) - // fmt.Println("ASDASDAS") - } //TODO ERROR - close(pass) - - // fmt.Println("ASDASDAS") - - // fmt.Println(pass) + go func() { + for passwords.Scan() { //TODO BUG constantly rereads file to write it to channel. Better way would be to write it in string/[]string var and then from it write to channel. Doubles memory but we don't rely on reading file from HDD which might be busy slowing down burteforce + pass <- string(passwords.Text()) + } + close(pass) + }() + var foundPass = false // for _ := range options.Threads { for i:=0; i