Skip to content

Instantly share code, notes, and snippets.

@blissjaspis
Created June 10, 2022 07:27
Show Gist options
  • Save blissjaspis/c6523f779b4d61e59afe348470d6ca1a to your computer and use it in GitHub Desktop.
Save blissjaspis/c6523f779b4d61e59afe348470d6ca1a to your computer and use it in GitHub Desktop.
Get and Parse Common Credentials Password from SecList With More Custom Parsing
package main
import (
"fmt"
"io"
"io/ioutil"
"net/http"
"os"
"strings"
)
func main() {
fileUrl := "https://raw.githubusercontent.com/danielmiessler/SecLists/master/Passwords/Common-Credentials/10-million-password-list-top-10000.txt"
DownloadFile("password.txt", fileUrl)
fmt.Println("Finish download the file")
ReadFileText("password.txt", "new-password.txt")
fmt.Println("All Finish")
}
func ReadFileText(filepath string, output string) {
read, _ := ioutil.ReadFile(filepath)
hitung := 0
pass, _ := os.OpenFile(output, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
defer pass.Close()
for _, v := range strings.Split(string(read), "\n") {
// Filter that word greater than 8
if strings.Count(v, "") >= 8 {
pass.WriteString(v + "\n")
fmt.Println(v)
hitung++
}
}
fmt.Println(hitung)
}
func DownloadFile(filepath string, url string) error {
resp, err := http.Get(url)
if err != nil {
return err
}
defer resp.Body.Close()
result, err := os.Create(filepath)
if err != nil {
return err
}
io.Copy(result, resp.Body)
return err
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment