Finalize v1.25

This commit is contained in:
Evan Su 2022-04-13 21:32:11 -04:00 committed by GitHub
parent 58e0743dcb
commit ce523d49ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 62 additions and 65 deletions

View File

@ -35,16 +35,16 @@ import (
"time"
"github.com/HACKERALERT/clipboard"
"github.com/HACKERALERT/crypto/argon2"
"github.com/HACKERALERT/crypto/blake2b"
"github.com/HACKERALERT/crypto/chacha20"
"github.com/HACKERALERT/crypto/hkdf"
"github.com/HACKERALERT/crypto/sha3"
"github.com/HACKERALERT/dialog"
"github.com/HACKERALERT/giu"
"github.com/HACKERALERT/infectious"
"github.com/HACKERALERT/serpent"
"github.com/HACKERALERT/zxcvbn-go"
"golang.org/x/crypto/argon2"
"golang.org/x/crypto/blake2b"
"golang.org/x/crypto/chacha20"
"golang.org/x/crypto/hkdf"
"golang.org/x/crypto/sha3"
)
// Generic variables
@ -107,6 +107,7 @@ var keep bool
var kept bool
// Status variables
var startLabel = "Start"
var mainStatus = "Ready."
var mainStatusColor = color.RGBA{0xff, 0xff, 0xff, 0xff}
var popupStatus string
@ -193,7 +194,11 @@ func draw() {
giu.Row(
giu.Button("Clear").Size(100, 0).OnClick(func() {
keyfiles = nil
keyfilePrompt = "None selected."
if keyfile {
keyfilePrompt = "Keyfiles required."
} else {
keyfilePrompt = "None selected."
}
modalId++
}),
giu.Tooltip("Remove all keyfiles."),
@ -374,16 +379,16 @@ func draw() {
giu.Style().SetDisabled(mode == "decrypt").To(
giu.Button("Create").Size(54, 0).OnClick(func() {
f := dialog.File()
f.Title("Save keyfile as:")
f := dialog.File().Title("Choose where to save the keyfile.")
f.SetStartDir(func() string {
if len(onlyFiles) > 0 {
return filepath.Dir(onlyFiles[0])
}
return filepath.Dir(onlyFolders[0])
}())
file, _ := f.Save()
if file == "" {
f.SetInitFilename("Keyfile")
file, err := f.Save()
if file == "" || err != nil {
return
}
@ -396,7 +401,7 @@ func draw() {
giu.Tooltip("Generate a cryptographically secure keyfile."),
),
giu.Style().SetDisabled(true).To(
giu.InputText(&keyfilePrompt).Size(giu.Auto),
giu.Button(keyfilePrompt).Size(giu.Auto, 0),
),
),
),
@ -462,50 +467,44 @@ func draw() {
giu.Style().SetDisabled(true).To(
giu.InputText(&outputFile).Size(dw / dpi / dpi).Flags(16384),
).Build()
giu.SameLine()
giu.Button("Change").Size(bw/dpi, 0).OnClick(func() {
f := dialog.File()
f.Title("Save output as:")
f := dialog.File().Title("Choose where to save the output. Don't include extensions.")
f.SetStartDir(func() string {
if len(onlyFiles) > 0 {
return filepath.Dir(onlyFiles[0])
}
return filepath.Dir(onlyFolders[0])
}())
file, _ := f.Save()
if file == "" {
// Prefill the filename
tmp := strings.TrimSuffix(filepath.Base(outputFile), ".pcv")
f.SetInitFilename(strings.TrimSuffix(tmp, filepath.Ext(tmp)))
if mode == "encrypt" && (len(allFiles) > 1 || len(onlyFolders) > 0) {
f.SetInitFilename("Encrypted")
}
file, err := f.Save()
if file == "" || err != nil {
return
}
// Add the correct extensions
if mode == "encrypt" {
if len(allFiles) > 1 || len(onlyFolders) > 0 {
file = strings.TrimSuffix(file, ".zip.pcv")
file = strings.TrimSuffix(file, ".pcv")
if !strings.HasSuffix(file, ".zip.pcv") {
file += ".zip.pcv"
}
file += ".zip.pcv"
} else {
file = strings.TrimSuffix(file, ".pcv")
ind := strings.Index(inputFile, ".")
file += inputFile[ind:]
if !strings.HasSuffix(file, ".pcv") {
file += ".pcv"
}
file += filepath.Ext(inputFile) + ".pcv"
}
} else {
ind := strings.Index(file, ".")
if ind != -1 {
file = file[:ind]
}
if strings.HasSuffix(inputFile, ".zip.pcv") {
file += ".zip"
} else {
tmp := strings.TrimSuffix(filepath.Base(inputFile), ".pcv")
tmp = tmp[strings.Index(tmp, "."):]
file += tmp
file += filepath.Ext(tmp)
}
}
outputFile = file
}).Build()
giu.Tooltip("Save the output with a custom name and path.").Build()
@ -514,7 +513,7 @@ func draw() {
giu.Dummy(0, 0),
giu.Separator(),
giu.Dummy(0, 0),
giu.Button("Start").Size(giu.Auto, 34).OnClick(func() {
giu.Button(startLabel).Size(giu.Auto, 34).OnClick(func() {
if keyfile && keyfiles == nil {
mainStatus = "Please select your keyfiles."
mainStatusColor = color.RGBA{0xff, 0x00, 0x00, 0xff}
@ -597,6 +596,7 @@ func onDrop(names []string) {
folders++
mode = "encrypt"
inputLabel = "1 folder selected."
startLabel = "Encrypt"
onlyFolders = append(onlyFolders, names[0])
inputFile = filepath.Join(filepath.Dir(names[0]), "Encrypted") + ".zip"
outputFile = inputFile + ".pcv"
@ -617,7 +617,8 @@ func onDrop(names []string) {
// Decide if encrypting or decrypting
if strings.HasSuffix(names[0], ".pcv") || isSplit {
mode = "decrypt"
inputLabel = name + " (will decrypt)"
inputLabel = name
startLabel = "Decrypt"
commentsPrompt = "Comments (read-only):"
commentsDisabled = true
@ -722,7 +723,8 @@ func onDrop(names []string) {
}
} else { // One file that is not a Picocrypt volume was dropped
mode = "encrypt"
inputLabel = name + " (will encrypt)"
inputLabel = name
startLabel = "Encrypt"
inputFile = names[0]
outputFile = names[0] + ".pcv"
}
@ -751,7 +753,7 @@ func onDrop(names []string) {
if folders == 0 {
inputLabel = fmt.Sprintf("%d files selected.", files)
} else if files == 0 {
inputLabel = fmt.Sprintf("%d folders selected.", files)
inputLabel = fmt.Sprintf("%d folders selected.", folders)
} else {
if files == 1 && folders > 1 {
inputLabel = fmt.Sprintf("1 file and %d folders selected.", folders)
@ -763,6 +765,7 @@ func onDrop(names []string) {
inputLabel = fmt.Sprintf("%d files and %d folders selected.", files, folders)
}
}
startLabel = "Encrypt"
// Set the input and output paths
inputFile = filepath.Join(filepath.Dir(names[0]), "Encrypted") + ".zip"
@ -1601,6 +1604,7 @@ func resetUI() {
onlyFolders = nil
allFiles = nil
inputLabel = "Drop files and folders into this window."
startLabel = "Start"
password = ""
cpassword = ""
keyfiles = nil

View File

@ -4,19 +4,19 @@ go 1.17
require (
github.com/HACKERALERT/clipboard v0.1.5-0.20211215214929-7345ba96aeca
github.com/HACKERALERT/dialog v0.0.0-20220328212608-24c44f67b0e0
github.com/HACKERALERT/giu v0.5.7-0.20220328205809-0a3331212c4e
github.com/HACKERALERT/infectious v0.0.0-20220327020438-3073de4d0e0a
github.com/HACKERALERT/crypto v0.0.0-20220412024110-ba8732acd7e7
github.com/HACKERALERT/dialog v0.0.0-20220410221520-a9e6303eda42
github.com/HACKERALERT/giu v0.5.7-0.20220411212054-a37934efe9a9
github.com/HACKERALERT/infectious v0.0.0-20220412021528-bb1303403749
github.com/HACKERALERT/serpent v0.0.0-20210716182301-293b29869c66
github.com/HACKERALERT/zxcvbn-go v0.0.0-20210927200100-f131a4666ad5
golang.org/x/crypto v0.0.0-20220321153916-2c7772ba3064
)
require (
github.com/HACKERALERT/gl v0.0.0-20211216002416-e8bf2db61361 // indirect
github.com/HACKERALERT/gl v0.0.0-20220411210853-402fdd216609 // indirect
github.com/HACKERALERT/glfw/v3.3/glfw v0.0.0-20211216001154-d0da149b3bef // indirect
github.com/HACKERALERT/imgui-go v1.12.1-0.20220328205704-793c12595b34 // indirect
github.com/HACKERALERT/imgui-go v1.12.1-0.20220411211703-da7cd33ca753 // indirect
github.com/HACKERALERT/mainthread v0.0.0-20211027212305-2ec9e701cc14 // indirect
github.com/HACKERALERT/sys v0.0.0-20220412020404-2e09c491f471 // indirect
github.com/HACKERALERT/w32 v0.0.0-20211215215707-4b84c2675d8d // indirect
golang.org/x/sys v0.0.0-20220325203850-36772127a21f // indirect
)

View File

@ -1,33 +1,26 @@
github.com/HACKERALERT/clipboard v0.1.5-0.20211215214929-7345ba96aeca h1:yZj12M2feFkat7l0r7s7QnKjJ4Q6UZOwVHroR4kQ4Nk=
github.com/HACKERALERT/clipboard v0.1.5-0.20211215214929-7345ba96aeca/go.mod h1:kkjR9AGvIlIUJdjd/CBL1VfQvyPDE5kL31rAzY/r0s4=
github.com/HACKERALERT/dialog v0.0.0-20220328212608-24c44f67b0e0 h1:7sV1tRK6MnG0KOjllSxdUqNJrPt8rALIl2YRYun+i0w=
github.com/HACKERALERT/dialog v0.0.0-20220328212608-24c44f67b0e0/go.mod h1:GxPIEf2nKp6Gx+sdpjwTdFIGmW5kj6Jta7rRO50TgpU=
github.com/HACKERALERT/giu v0.5.7-0.20220328205809-0a3331212c4e h1:e4QFKc+4UAb2dp7owcKTBbONX5wKtMRaoFTGQuo+2w0=
github.com/HACKERALERT/giu v0.5.7-0.20220328205809-0a3331212c4e/go.mod h1:14TS/mXxDftq5keQiiYeEur3J5XLO31ti/aSjgg/z5s=
github.com/HACKERALERT/gl v0.0.0-20211216002416-e8bf2db61361 h1:NMPzcOu/LpfEUf0wRZlayjlU0345ujYOWZbVKsfL6g4=
github.com/HACKERALERT/gl v0.0.0-20211216002416-e8bf2db61361/go.mod h1:ZUosVzfEKNGLMLk6aj9yo0FSAhWWsbTMjuzeIUXniB0=
github.com/HACKERALERT/crypto v0.0.0-20220412024110-ba8732acd7e7 h1:vOy0zRm74+1hPiUJ6R2EQl+agZBo+KcGQR85OWCzEZQ=
github.com/HACKERALERT/crypto v0.0.0-20220412024110-ba8732acd7e7/go.mod h1:XjuRsuBwllqVRs7DqJrbpPeUsT3qebqANdKSBJnNn0s=
github.com/HACKERALERT/dialog v0.0.0-20220410221520-a9e6303eda42 h1:YdKzDcpjykZRSVQSah9gLMxY7H7DAbk+L/AHKypYwSI=
github.com/HACKERALERT/dialog v0.0.0-20220410221520-a9e6303eda42/go.mod h1:GxPIEf2nKp6Gx+sdpjwTdFIGmW5kj6Jta7rRO50TgpU=
github.com/HACKERALERT/giu v0.5.7-0.20220411212054-a37934efe9a9 h1:OkhEGzCEjVZ683etseTpDvewMXOjqkcnG6puAbX88hM=
github.com/HACKERALERT/giu v0.5.7-0.20220411212054-a37934efe9a9/go.mod h1:Mp6wVuSFEx2nI/XrHw7nce2aAh5nIbqIgozUbMVLlUs=
github.com/HACKERALERT/gl v0.0.0-20220411210853-402fdd216609 h1:AOJrzpVT3VYIpPH9BD0tXHBDMljK5FhORrz47Odc5/U=
github.com/HACKERALERT/gl v0.0.0-20220411210853-402fdd216609/go.mod h1:ZUosVzfEKNGLMLk6aj9yo0FSAhWWsbTMjuzeIUXniB0=
github.com/HACKERALERT/glfw/v3.3/glfw v0.0.0-20211216001154-d0da149b3bef h1:MWA48bM0uKSblAiB51YtMDWEBhJtX+s3HcjlUN7o8cE=
github.com/HACKERALERT/glfw/v3.3/glfw v0.0.0-20211216001154-d0da149b3bef/go.mod h1:aP+FSN9tk1W3UsQisFWxRLQ4WOF7T3niq68UYw0B150=
github.com/HACKERALERT/imgui-go v1.12.1-0.20220328205704-793c12595b34 h1:eyajQLApyaPWZHsJg4Cs2mRi4V1diQCytARGxTd/jD4=
github.com/HACKERALERT/imgui-go v1.12.1-0.20220328205704-793c12595b34/go.mod h1:Yo2L7QsU7d+Y6+Uput8+3AHYji0EFojRg4Sokun4Xb0=
github.com/HACKERALERT/infectious v0.0.0-20220327020438-3073de4d0e0a h1:Gqs+wdmHzVsT5HxrMfwNAWoDOnDQVlk/fNxtpsaQ+nw=
github.com/HACKERALERT/infectious v0.0.0-20220327020438-3073de4d0e0a/go.mod h1:xSuPEzKPGzUiAo1hlTjz/3e4iAjPzwGFGN7wyhy3CV8=
github.com/HACKERALERT/imgui-go v1.12.1-0.20220411211703-da7cd33ca753 h1:RfwDOJtKS2aQf4n5eGA3V8TGtmgmIwPuJThgkNa+p/o=
github.com/HACKERALERT/imgui-go v1.12.1-0.20220411211703-da7cd33ca753/go.mod h1:COMjMzefnK51DW+MwUfybQ/oCGv0zpGlP8fy6zr6oOs=
github.com/HACKERALERT/infectious v0.0.0-20220412021528-bb1303403749 h1:uZMOuYhLopMYH1E5JC4gMqWsp3aVhxUnOgvCH6cGMqo=
github.com/HACKERALERT/infectious v0.0.0-20220412021528-bb1303403749/go.mod h1:LInDG9bntPYtji6J+OLDZvv1OTWA5XpqXv19MBsWJrA=
github.com/HACKERALERT/mainthread v0.0.0-20211027212305-2ec9e701cc14 h1:DwWXverhu/dEsPM/GPykuHGh4SxW69DaGZL5t3fANG4=
github.com/HACKERALERT/mainthread v0.0.0-20211027212305-2ec9e701cc14/go.mod h1:jW534e7roGur9mmzAfPxZLQzKXZ+GE5+XeS7PSyqPbo=
github.com/HACKERALERT/serpent v0.0.0-20210716182301-293b29869c66 h1:YDpFq+y6mRcu97rn/rhYg8u8FdeO0wzTuLgM2gVkA+c=
github.com/HACKERALERT/serpent v0.0.0-20210716182301-293b29869c66/go.mod h1:d/+9q3sIxtIyOgHNgFGr3yGBKKVn5h3vL4hV1qlmoLs=
github.com/HACKERALERT/sys v0.0.0-20220412020404-2e09c491f471 h1:rs5CC+NDrugVI3SPqLafRNH6Ep1VFjOo9VOWtAV5++0=
github.com/HACKERALERT/sys v0.0.0-20220412020404-2e09c491f471/go.mod h1:I4esFWbCYc37CXVb+3qJHJiU43NGkLf66kNV/NDnXcU=
github.com/HACKERALERT/w32 v0.0.0-20211215215707-4b84c2675d8d h1:Ey0tgsr4MbX64pkl7Di26yUUQGG3mmZw8gUWqhQeW5g=
github.com/HACKERALERT/w32 v0.0.0-20211215215707-4b84c2675d8d/go.mod h1:S+3Ad2AEm5MhhuHJeAaXUmyAXON0qFDxcP/Chw8q7+Y=
github.com/HACKERALERT/zxcvbn-go v0.0.0-20210927200100-f131a4666ad5 h1:cIW3wwoeZ6zru8VhdoGlZAinG+6ObzHx7BgQxUfhF34=
github.com/HACKERALERT/zxcvbn-go v0.0.0-20210927200100-f131a4666ad5/go.mod h1:nykydiYjCDMkF/2vQXSPM38vR5N9W1DITHvupnN+eOk=
golang.org/x/crypto v0.0.0-20220321153916-2c7772ba3064 h1:S25/rfnfsMVgORT4/J61MJ7rdyseOZOyvLIrZEZ7s6s=
golang.org/x/crypto v0.0.0-20220321153916-2c7772ba3064/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220325203850-36772127a21f h1:TrmogKRsSOxRMJbLYGrB4SBbW+LJcEllYBLME5Zk5pU=
golang.org/x/sys v0.0.0-20220325203850-36772127a21f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=