22 Commits

Author SHA1 Message Date
87fa1107d7 Update binaries to the latest version 2022-12-19 18:12:53 -06:00
max
3915761477 Update 'README.md'
Fixed formatting
2022-12-20 00:01:13 +00:00
5ba592db21 Update README.md to include install instructions and expanded usage instructions 2022-12-19 17:57:53 -06:00
b81783b470 New version update that supports disallowed characters, cleaned up comments 2022-12-19 17:41:54 -06:00
cebcbc2823 Merge remote-tracking branch 'origin/master' 2022-12-19 17:25:50 -06:00
b5b7c208f2 (Old binaries were broken) Rebuilt all binaries properly this time also included are the new error handling changes, and smaller overall binary sizes (built with -w and -s flags + UPX compression) 2022-12-19 17:25:17 -06:00
8aa2f61b3c (Old binaries were broken) Rebuilt all binaries properly this time also included are the new error handling changes, and smaller overall binary sizes (built with -w and -s flags + UTX compression) 2022-12-19 17:17:11 -06:00
f2a9cdd216 Added better error handling 2022-12-19 10:21:06 -06:00
c99539c0a9 Add 32 bit binaries for Linux and Windows, recompile Windows, Linux, and osx (Darwin) with new Go version (1.19.4) 2022-12-14 16:37:52 -06:00
33cf6cde39 Update README.md 2022-12-14 15:09:43 -06:00
8114d2a6c9 Remove .exe file extension, it false flags on Windows 10 antivirus 2022-10-21 10:05:31 -05:00
7b36f39de6 Update gitignore to allow for .exe and show Windows binary with updated file extension 2022-10-21 10:01:11 -05:00
564da340d5 Include .exe extension for Windows, this is required for the binary to be recognized 2022-10-21 09:58:04 -05:00
Max
9e3549f57d Merge remote-tracking branch 'origin/master' 2022-10-09 16:17:54 -05:00
max
e72f27f80c Update 'README.md' 2022-10-09 21:17:41 +00:00
Max
1bc20536b5 Update to V1.1 and compile with Go 1.19 2022-10-09 16:15:45 -05:00
Max
03b6ac8375 Update to securely seed math/rand V1.1 2022-10-09 15:57:01 -05:00
Max
388d56b697 Switch to the latest Go version 2022-10-09 15:28:28 -05:00
Max
0c3198536f Update gitignore 2022-10-09 15:28:04 -05:00
max
b1ddefb847 Fix osx binary name 2022-08-12 16:07:52 -05:00
max
bbfcf4d5f0 Release Version 1.0 binaries 2022-08-02 18:08:57 -05:00
max
4dd661572b Fixed package name 2022-08-02 18:07:28 -05:00
9 changed files with 75 additions and 18 deletions

1
.gitignore vendored
View File

@ -21,3 +21,4 @@
# Go workspace file
go.work
/.idea/

View File

@ -1,9 +1,36 @@
# GoPass
An easy to use command-line password generator that creates secure passwords
An easy to use command-line password generator that creates secure passwords (Version 1.1 adds proper cryptographic
seeding of math/rand)
# Usage:
<code>./gopass [number of characters]</code><br>
`./gopass [number of characters]`<br>
or <br>
`./gopass [number of characters] "[excluded characters]"`
<hr>
eg:
<code>./gopass 32</code><br>
output: <code>E$bGOiiPASS*,ISl{!MJ&<\[COOL0eVw</code>
eg: `./gopass 32` <br>
output: `E$bGOiiPASS*,ISl{!MJ&<\[COOL0eVw` <br>
eg (with excluded characters): `./gopass 32 "$,!"` <br>
output: `EYbGOiiPASS*2ISl{?MJ&<\[COOL0eVw` <- note the excluded characters are not present in the output
# How to install/use for Windows:
1. Download Windows binary, it may be helpful to simply rename it to "gopass.exe" (make sure to add .exe, this won't
need to
be typed to execute the file from the CLI, but it is required for Windows to recognize the binary) to keep
commands shorter.
2. Move the file to your `C:\Users\[Username]` directory
3. Opening the console *without* Administrator privileges will put you in the directory mentioned above by default
4. Now type `gopass [number of characters]` (Ex. `gopass 64`) to generate a new password!
# How to install/use for Linux:
1. Download Linux binary, it may be helpful to simply rename it to "gopass" to keep commands shorter.
2. Move the file to your home directory.
3. `chmod +x gopass` if necessary
3. Opening your terminal should put you in your home directory by default, if not, just type `cd` to get sent back to
home.
4. Now type `./gopass [number of characters]` (Ex. `./gopass 64`) to generate a new password!

Binary file not shown.

BIN
bin/gopass-linux-386-v1.2.0 Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

2
go.mod
View File

@ -1,3 +1,3 @@
module GoPass
go 1.18
go 1.19

53
main.go
View File

@ -1,36 +1,65 @@
package GoPass
// GoPass
// Author: Maximilian Patterson
// Version: 1.2.0
package main
import (
cryptorand "crypto/rand"
"encoding/binary"
"fmt"
"math/rand"
mathrand "math/rand"
"os"
"strconv"
"time"
)
var runes = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890`~!@#$%^&*()_+[]\\{}|;':,./<>?")
var allowedCharacters = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890`~!@#$%^&*()_+[]\\{}|;':,./<>?")
func main() {
// Take OS arg (only accepts one arg)
arg := os.Args[1]
// Take in all OS arg
args := os.Args[1:]
if len(args) < 1 {
panic("No password length specified! (ex: ./gopass 16)")
}
// Convert String arg to int
size, err := strconv.Atoi(arg)
size, err := strconv.Atoi(args[0])
if err != nil {
panic(err)
panic("First argument supplied must be an integer! (ex: 16)")
}
// Grab second argument (if it exists) and use it as a disallowed character(s)
var disallowed []rune
if len(args) == 2 {
// Break apart the string into a slice of runes
disallowed = []rune(args[1])
// Remove all disallowed characters from the allowedCharacters slice
for _, r := range disallowed {
for i, v := range allowedCharacters {
if v == r {
allowedCharacters = append(allowedCharacters[:i], allowedCharacters[i+1:]...)
}
}
}
}
// Make empty array of runes with size of size
pass := make([]rune, size)
// Seed rand with time
rand.Seed(time.Now().UTC().UnixNano())
var b [8]byte
_, err = cryptorand.Read(b[:])
if err != nil {
panic("Error securely seeding crypto/rand!")
}
mathrand.Seed(int64(binary.LittleEndian.Uint64(b[:])))
// Assign every slot of pass to a random rune (generate rand int of length runes to select)
// Assign every slot of pass to a random allowedCharacter
for i := range pass {
pass[i] = runes[rand.Intn(len(runes))]
// Generate a random int greater than 0 and not to exceed the length of allowedCharacters
pass[i] = allowedCharacters[mathrand.Intn(len(allowedCharacters))]
}
// Print the pass :D
// Print the password
fmt.Println(string(pass))
}