Compare commits
No commits in common. "8e68218be8d94511ccaddde546bcd35e3641390c" and "8889eccef6d43bc2cd17a7448dfbf39fde8090d6" have entirely different histories.
8e68218be8
...
8889eccef6
27
README.md
27
README.md
@ -1,27 +0,0 @@
|
|||||||
# 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,7 +19,6 @@ 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")
|
||||||
|
|
||||||
@ -43,13 +42,12 @@ 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 && !*flagSetUnicodeCyrillic && !*flagSetUnicodeJapanese && !*flagSetUnicodeChinese {
|
if !*flagSetAll && !*flagSetAsciiLowercase && !*flagSetAsciiUppercase && !*flagSetNumbers && !*flagSetSpecialChars && !*flagSetSpaces && !*flagSetUnicodeJapanese && !*flagSetUnicodeChinese {
|
||||||
*flagSetAsciiLowercase = true
|
*flagSetAsciiLowercase = true
|
||||||
*flagSetAsciiUppercase = true
|
*flagSetAsciiUppercase = true
|
||||||
*flagSetNumbers = true
|
*flagSetNumbers = true
|
||||||
@ -75,9 +73,6 @@ 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()))
|
||||||
}
|
}
|
||||||
@ -92,10 +87,5 @@ 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