Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
AAVision committed Jul 7, 2023
0 parents commit cc39bcb
Show file tree
Hide file tree
Showing 9 changed files with 400 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.exe
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@

![Munge passwords by aavision](https://github.com/aavision/munge-passwords/blob/main/favicon.png?raw=true)


# munge-passwords

A little mapped Go script to munge dictionary words into possible passwords.

## Usage

```bash
Usage: munge-passwords.exe --length LENGTH [--wordlist WORDLIST] --output OUTPUT [--r] [--input INPUT]

Options:
--level LENGTH, -l LENGTH
--wordlist WORDLIST
--output OUTPUT, -o OUTPUT
--d, -d
--input INPUT, -i INPUT
--help, -h display this help and exit
```

- `--level [1,9]` or `-l` : is the level of munge for the input or the word-list!
- `--wordlist` or `-w` : The path of the wordlist.
- `--output` or `-o` : Output file name example `munge-passwords.txt`
- `--d` : Remove the duplicated record before munge from the provided list!
- `-i` or `--input` : To enter string!

## License
Binary file added favicon.ico
Binary file not shown.
Binary file added favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module github.com/AAVISION/munge-passwords

go 1.17

require (
github.com/akavel/rsrc v0.10.2 // indirect
github.com/alexflint/go-arg v1.4.3 // indirect
github.com/alexflint/go-scalar v1.1.0 // indirect
github.com/fatih/color v1.7.0 // indirect
github.com/gookit/color v1.5.3 // indirect
github.com/josephspurrier/goversioninfo v1.4.0 // indirect
github.com/mattn/go-colorable v0.1.2 // indirect
github.com/mattn/go-isatty v0.0.8 // indirect
github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778 // indirect
golang.org/x/sys v0.6.0 // indirect
golang.org/x/term v0.1.0 // indirect
)
36 changes: 36 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
github.com/akavel/rsrc v0.10.2 h1:Zxm8V5eI1hW4gGaYsJQUhxpjkENuG91ki8B4zCrvEsw=
github.com/akavel/rsrc v0.10.2/go.mod h1:uLoCtb9J+EyAqh+26kdrTgmzRBFPGOolLWKpdxkKq+c=
github.com/alexflint/go-arg v1.4.3 h1:9rwwEBpMXfKQKceuZfYcwuc/7YY7tWJbFsgG5cAU/uo=
github.com/alexflint/go-arg v1.4.3/go.mod h1:3PZ/wp/8HuqRZMUUgu7I+e1qcpUbvmS258mRXkFH4IA=
github.com/alexflint/go-scalar v1.1.0 h1:aaAouLLzI9TChcPXotr6gUhq+Scr8rl0P9P4PnltbhM=
github.com/alexflint/go-scalar v1.1.0/go.mod h1:LoFvNMqS1CPrMVltza4LvnGKhaSpc3oyLEBUZVhhS2o=
github.com/briandowns/spinner v1.23.0 h1:alDF2guRWqa/FOZZYWjlMIx2L6H0wyewPxo/CH4Pt2A=
github.com/briandowns/spinner v1.23.0/go.mod h1:rPG4gmXeN3wQV/TsAY4w8lPdIM6RX3yqeBQJSrbXjuE=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys=
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/gookit/color v1.5.3 h1:twfIhZs4QLCtimkP7MOxlF3A0U/5cDPseRT9M/+2SCE=
github.com/gookit/color v1.5.3/go.mod h1:NUzwzeehUfl7GIb36pqId+UGmRfQcU/WiiyTTeNjHtE=
github.com/josephspurrier/goversioninfo v1.4.0 h1:Puhl12NSHUSALHSuzYwPYQkqa2E1+7SrtAPJorKK0C8=
github.com/josephspurrier/goversioninfo v1.4.0/go.mod h1:JWzv5rKQr+MmW+LvM412ToT/IkYDZjaclF2pKDss8IY=
github.com/mattn/go-colorable v0.1.2 h1:/bC9yWikZXAL9uJdulbSfyVNIR3n3trXl+v8+1sx8mU=
github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
github.com/mattn/go-isatty v0.0.8 h1:HLtExJ+uU2HOZ+wI0Tt5DtUDrx8yhUqDcp7fYERX4CE=
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778 h1:QldyIu/L63oPpyvQmHgvgickp1Yw510KJOqX7H24mg8=
github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778/go.mod h1:2MuV+tbUrU1zIOPMxZ5EncGwgmMJsa+9ucAQZXxsObs=
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 h1:SrN+KX8Art/Sf4HNj6Zcz06G7VEz+7w9tdXTPOZ7+l4=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.1.0 h1:g6Z6vPFA9dYBAF7DWcH6sCcOntplXsDKcliusYijMlw=
golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
22 changes: 22 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//go:generate goversioninfo -icon=favicon.ico -manifest=goversioninfo.exe.manifest

package main

import (
"github.com/alexflint/go-arg"
"github.com/gookit/color"
)

var args struct {
Level int `arg:"-l,required"`
Word string `arg:"--wordlist,-w"`
Output string `arg:"-o,required"`
D bool `arg:"-d"`
Input string `arg:"-i"`
}

func main() {
arg.MustParse(&args)
color.Yellowln("Processing...")
mungeInit(args.Level, args.Word, args.Output, args.D, args.Input)
}
205 changes: 205 additions & 0 deletions munge.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,205 @@
package main

import (
"bufio"
"os"
"strings"

"github.com/gookit/color"
)

var tmpWordList []string
var inputFileLines []string

func mungeInit(level int, wordlistPath string, fileName string, removeDuplicate bool, input string) {

if level < 0 {
level = 0
}

if level > 9 {
level = 9
}

if wordlistPath != "" && input == "" {

readWordList(wordlistPath)

if removeDuplicate {
inputFileLines = removeDuplication(inputFileLines)
}

for _, line := range inputFileLines {
mungeword(line, level)
}

} else if wordlistPath == "" && input != "" {
mungeword(input, level)
} else {
color.Error.Println("Input or wordlist required!")
}

writeMunge(fileName)

}

func readWordList(path string) {
readFile, err := os.Open(path)

if err != nil {
color.Error.Println("Error reading the file!")
}

fileScanner := bufio.NewScanner(readFile)
fileScanner.Split(bufio.ScanLines)

for fileScanner.Scan() {
inputFileLines = append(inputFileLines, fileScanner.Text())
}

readFile.Close()
}

func writeMunge(fileName string) {

if fileName == "" {
fileName = "munge-passwords.txt"
}

file, err := os.OpenFile(fileName, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)

if err != nil {
color.Error.Println("Failed creating file!")
}

datawriter := bufio.NewWriter(file)

for _, data := range tmpWordList {
_, _ = datawriter.WriteString(data + "\n")
}

color.Greenp("Saved to ", args.Output)
datawriter.Flush()
file.Close()
}

func removeDuplication(arr []string) []string {
map_var := map[string]bool{}
result := []string{}
for e := range arr {
if map_var[arr[e]] != true {
map_var[arr[e]] = true
result = append(result, arr[e])
}
}
return result
}

func munge(wrd string, level int) {
if level > 0 {
tmpWordList = append(tmpWordList, wrd)
tmpWordList = append(tmpWordList, strings.ToUpper(wrd))
tmpWordList = append(tmpWordList, strings.Title(wrd))
}
if level > 2 {
temp := strings.Title(wrd)
tmpWordList = append(tmpWordList, strings.ToLower(temp))
}
if level > 4 {
tmpWordList = append(tmpWordList, strings.ReplaceAll(wrd, "e", "3"))
tmpWordList = append(tmpWordList, strings.ReplaceAll(wrd, "a", "4"))
tmpWordList = append(tmpWordList, strings.ReplaceAll(wrd, "o", "0"))
tmpWordList = append(tmpWordList, strings.ReplaceAll(wrd, "i", "!"))
tmpWordList = append(tmpWordList, strings.ReplaceAll(wrd, "i", "1"))
tmpWordList = append(tmpWordList, strings.ReplaceAll(wrd, "l", "1"))
tmpWordList = append(tmpWordList, strings.ReplaceAll(wrd, "a", "@"))
tmpWordList = append(tmpWordList, strings.ReplaceAll(wrd, "s", "$"))
}
if level > 4 {
temp := wrd
temp = strings.ReplaceAll(temp, "e", "3")
temp = strings.ReplaceAll(temp, "a", "4")
temp = strings.ReplaceAll(temp, "o", "0")
temp = strings.ReplaceAll(temp, "i", "1")
temp = strings.ReplaceAll(temp, "s", "$")
tmpWordList = append(tmpWordList, temp)
}
if level > 4 {
temp := wrd
temp = strings.ReplaceAll(temp, "e", "3")
temp = strings.ReplaceAll(temp, "a", "@")
temp = strings.ReplaceAll(temp, "o", "0")
temp = strings.ReplaceAll(temp, "i", "1")
temp = strings.ReplaceAll(temp, "s", "$")
tmpWordList = append(tmpWordList, temp)
}
if level > 4 {
temp := wrd
temp = strings.ReplaceAll(temp, "e", "3")
temp = strings.ReplaceAll(temp, "a", "4")
temp = strings.ReplaceAll(temp, "o", "0")
temp = strings.ReplaceAll(temp, "i", "!")
temp = strings.ReplaceAll(temp, "s", "$")
tmpWordList = append(tmpWordList, temp)
}
if level > 4 {
temp := wrd
temp = strings.ReplaceAll(temp, "e", "3")
temp = strings.ReplaceAll(temp, "a", "4")
temp = strings.ReplaceAll(temp, "o", "0")
temp = strings.ReplaceAll(temp, "l", "1")
temp = strings.ReplaceAll(temp, "s", "$")
tmpWordList = append(tmpWordList, temp)
}
}

func mungeword(wrd string, level int) {
munge(wrd, level)
if level > 4 {
munge(wrd+"1", level)
munge(wrd+"123456", level)
munge(wrd+"12", level)
munge(wrd+"2", level)
munge(wrd+"123", level)
munge(wrd+"!", level)
munge(wrd+".", level)
}
if level > 6 {
munge(wrd+"?", level)
munge(wrd+"_", level)
munge(wrd+"0", level)
munge(wrd+"01", level)
munge(wrd+"69", level)
munge(wrd+"21", level)
munge(wrd+"22", level)
munge(wrd+"23", level)
munge(wrd+"1234", level)
munge(wrd+"8", level)
munge(wrd+"9", level)
munge(wrd+"10", level)
munge(wrd+"11", level)
munge(wrd+"13", level)
munge(wrd+"3", level)
munge(wrd+"4", level)
munge(wrd+"5", level)
munge(wrd+"6", level)
munge(wrd+"7", level)
}
if level > 7 {
munge(wrd+"07", level)
munge(wrd+"08", level)
munge(wrd+"09", level)
munge(wrd+"14", level)
munge(wrd+"15", level)
munge(wrd+"16", level)
munge(wrd+"17", level)
munge(wrd+"18", level)
munge(wrd+"19", level)
munge(wrd+"24", level)
munge(wrd+"77", level)
munge(wrd+"88", level)
munge(wrd+"99", level)
munge(wrd+"12345", level)
munge(wrd+"123456789", level)
}
}
Loading

0 comments on commit cc39bcb

Please sign in to comment.