Skip to content

Commit

Permalink
Merge pull request #7 from wneessen/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
wneessen authored Mar 28, 2021
2 parents ca6c85f + 0c37156 commit 092fa3b
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 72 deletions.
101 changes: 30 additions & 71 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 24 additions & 1 deletion apg.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
package main

import (
"flag"
"fmt"
"log"
"os"
)

// Constants
const DefaultPwLenght int = 20
const VersionString string = "0.2.8"
const VersionString string = "0.2.9"

type Config struct {
minPassLen int
Expand All @@ -28,12 +29,34 @@ type Config struct {
outputMode int
}

// Help text
const usage = `Usage:
apg [-m <length>] [-x <length>] -L -U -N -S -H
apg [-m <length>] [-x <length>] -M LUNsh -E <list of chars>
Options:
-m LENGTH Minimum length of the password to be generated (Default: 20)
-x LENGTH Maximum length of the password to be generated (Default: 20)
-n NUMBER Amount of password to be generated (Default: 1)
-E CHARS List of characters to be excluded in the generated password
-M [LUNSHClunshc] New style password parameters (upper case: on, lower case: off)
-L Use lower case characters in passwords (Default: on)
-U Use upper case characters in passwords (Default: on)
-N Use numeric characters in passwords (Default: on)
-S Use special characters in passwords (Default: on)
-H Avoid ambiguous characters in passwords (i. e.: 1, l, I, O, 0) (Default: off)
-C Enable complex password mode (implies -L -U -N -S and disables -H) (Default: off)
-l Spell generated passwords in phonetic alphabet (Default: off)
-h Show this help text
-v Show version string`

// Main function that generated the passwords and returns them
func main() {
// Log config
log.SetFlags(log.Ltime | log.Ldate | log.Lshortfile)

// Read and parse flags
flag.Usage = func() { _, _ = fmt.Fprintf(os.Stderr, "%s\n", usage) }
var config = parseFlags()

// Show version and exit
Expand Down

0 comments on commit 092fa3b

Please sign in to comment.