Compare commits
2 Commits
8889eccef6
...
8e68218be8
Author | SHA1 | Date | |
---|---|---|---|
8e68218be8 | |||
7291c3a19f |
27
README.md
Normal file
27
README.md
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
# Password generator
|
||||||
|
* can generate multiple passwords at once (separated by \n)
|
||||||
|
* can use Cyrillic/Japanese/Chinese character sets
|
||||||
|
* uses at least one character from each character set
|
||||||
|
|
||||||
|
## Build
|
||||||
|
|
||||||
|
```sh
|
||||||
|
go build .
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```sh
|
||||||
|
Usage of ./passgen:
|
||||||
|
-L int length of the generated password (default 16)
|
||||||
|
-S use spaces
|
||||||
|
-all use all character sets
|
||||||
|
-c int how many passwords to generate (default 1)
|
||||||
|
-l use lowercase ascii characters
|
||||||
|
-U use uppercase ascii characters
|
||||||
|
-n use numbers
|
||||||
|
-s use special characters
|
||||||
|
-unicode-cyrillic use unicode Cyrillic characters
|
||||||
|
-unicode-chinese use unicode Chinese characters
|
||||||
|
-unicode-japanese use unicode Japanese characters
|
||||||
|
```
|
12
main.go
12
main.go
@ -19,6 +19,7 @@ func main() {
|
|||||||
flagSetNumbers := flag.Bool("n", false, "use numbers")
|
flagSetNumbers := flag.Bool("n", false, "use numbers")
|
||||||
flagSetSpecialChars := flag.Bool("s", false, "use special characters")
|
flagSetSpecialChars := flag.Bool("s", false, "use special characters")
|
||||||
flagSetSpaces := flag.Bool("S", false, "use spaces")
|
flagSetSpaces := flag.Bool("S", false, "use spaces")
|
||||||
|
flagSetUnicodeCyrillic := flag.Bool("unicode-cyrillic", false, "use unicode cyrillic characters")
|
||||||
flagSetUnicodeJapanese := flag.Bool("unicode-japanese", false, "use unicode Japanese characters")
|
flagSetUnicodeJapanese := flag.Bool("unicode-japanese", false, "use unicode Japanese characters")
|
||||||
flagSetUnicodeChinese := flag.Bool("unicode-chinese", false, "use unicode Chinese characters")
|
flagSetUnicodeChinese := flag.Bool("unicode-chinese", false, "use unicode Chinese characters")
|
||||||
|
|
||||||
@ -42,12 +43,13 @@ func main() {
|
|||||||
*flagSetSpecialChars = true
|
*flagSetSpecialChars = true
|
||||||
*flagSetSpaces = true
|
*flagSetSpaces = true
|
||||||
|
|
||||||
|
*flagSetUnicodeCyrillic = true
|
||||||
*flagSetUnicodeJapanese = true
|
*flagSetUnicodeJapanese = true
|
||||||
*flagSetUnicodeChinese = true
|
*flagSetUnicodeChinese = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// use default password preset no sets were requested
|
// use default password preset no sets were requested
|
||||||
if !*flagSetAll && !*flagSetAsciiLowercase && !*flagSetAsciiUppercase && !*flagSetNumbers && !*flagSetSpecialChars && !*flagSetSpaces && !*flagSetUnicodeJapanese && !*flagSetUnicodeChinese {
|
if !*flagSetAll && !*flagSetAsciiLowercase && !*flagSetAsciiUppercase && !*flagSetNumbers && !*flagSetSpecialChars && !*flagSetSpaces && !*flagSetUnicodeCyrillic && !*flagSetUnicodeJapanese && !*flagSetUnicodeChinese {
|
||||||
*flagSetAsciiLowercase = true
|
*flagSetAsciiLowercase = true
|
||||||
*flagSetAsciiUppercase = true
|
*flagSetAsciiUppercase = true
|
||||||
*flagSetNumbers = true
|
*flagSetNumbers = true
|
||||||
@ -73,6 +75,9 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// unicode
|
// unicode
|
||||||
|
if *flagSetUnicodeCyrillic {
|
||||||
|
characterSets = append(characterSets, dictionary.ShuffleDictionarySet(sets.Cyrillic()))
|
||||||
|
}
|
||||||
if *flagSetUnicodeJapanese {
|
if *flagSetUnicodeJapanese {
|
||||||
characterSets = append(characterSets, dictionary.ShuffleDictionarySet(sets.Japanese()))
|
characterSets = append(characterSets, dictionary.ShuffleDictionarySet(sets.Japanese()))
|
||||||
}
|
}
|
||||||
@ -87,5 +92,10 @@ func main() {
|
|||||||
for _, i := range password {
|
for _, i := range password {
|
||||||
fmt.Printf("%c", i)
|
fmt.Printf("%c", i)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// new line
|
||||||
|
if i < *flagCount {
|
||||||
|
fmt.Print("\n")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user