From 95ee00dd6b10ba9ed13f797d30aaa27923e1e8e6 Mon Sep 17 00:00:00 2001 From: Evan Su <48808396+HACKERALERT@users.noreply.github.com> Date: Sat, 12 Apr 2025 20:27:55 -0400 Subject: [PATCH] do a scan for possibly missed temp zip files and del if they exist --- picocrypt/main.go | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/picocrypt/main.go b/picocrypt/main.go index c4eedda..b2811be 100644 --- a/picocrypt/main.go +++ b/picocrypt/main.go @@ -185,7 +185,7 @@ func compress() int { return 1 } dir = filepath.ToSlash(dir) - file, err = os.CreateTemp("", "picocrypt-cli-v2-*.tmp") + file, err = os.CreateTemp("", "picocrypt-cli-v2-*.zip.tmp") if err != nil { fmt.Println("Cannot create temporary file!") return 1 @@ -193,6 +193,8 @@ func compress() int { pzip = file.Name() writer = zip.NewWriter(file) + fmt.Println("Info: creating temporary zip file " + pzip) + for i, path := range files { stat, err := os.Stat(path) if err != nil { @@ -344,7 +346,7 @@ func work() int { hkdfSalt = make([]byte, 32) serpentIV = make([]byte, 16) nonce = make([]byte, 24) - _, errs[0] = fout.Write(rsEncode(rs5, []byte("v1.46"))) + _, errs[0] = fout.Write(rsEncode(rs5, []byte("v1.48"))) _, errs[1] = fout.Write(rsEncode(rs5, []byte("00000"))) flags := make([]byte, 5) if *p { @@ -685,4 +687,13 @@ func main() { } os.Exit(1) } + + td := os.TempDir() + matches, err := filepath.Glob(filepath.Join(td, "picocrypt-cli-v2-*.zip.tmp")) + if err != nil { + panic(err) + } + for _, v := range matches { + os.Remove(v) + } }