Update to v1.12.1 with bug fixes
This commit is contained in:
parent
8a8e9c046c
commit
3dbb0622fd
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
Picocrypt v1.12
|
Picocrypt v1.12.1
|
||||||
Copyright (c) Evan Su (https://evansu.cc)
|
Copyright (c) Evan Su (https://evansu.cc)
|
||||||
Released under a GNU GPL v3 License
|
Released under a GNU GPL v3 License
|
||||||
https://github.com/HACKERALERT/Picocrypt
|
https://github.com/HACKERALERT/Picocrypt
|
||||||
|
@ -28,6 +28,7 @@ from os.path import basename,dirname,abspath,realpath
|
||||||
from os.path import join as pathJoin,split as pathSplit
|
from os.path import join as pathJoin,split as pathSplit
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from zipfile import ZipFile
|
from zipfile import ZipFile
|
||||||
|
from shutil import rmtree
|
||||||
from tkinterdnd2 import TkinterDnD,DND_FILES
|
from tkinterdnd2 import TkinterDnD,DND_FILES
|
||||||
from tkinter.filedialog import asksaveasfilename
|
from tkinter.filedialog import asksaveasfilename
|
||||||
from ttkthemes import ThemedStyle
|
from ttkthemes import ThemedStyle
|
||||||
|
@ -523,6 +524,7 @@ startBtn["state"] = "disabled"
|
||||||
def cancel():
|
def cancel():
|
||||||
global working
|
global working
|
||||||
working = False
|
working = False
|
||||||
|
dummy.focus()
|
||||||
|
|
||||||
# Cancel button
|
# Cancel button
|
||||||
cancelBtn = tkinter.ttk.Button(
|
cancelBtn = tkinter.ttk.Button(
|
||||||
|
@ -571,7 +573,7 @@ creditsLabel["state"] = "disabled"
|
||||||
|
|
||||||
# Version
|
# Version
|
||||||
versionString = tkinter.StringVar(tk)
|
versionString = tkinter.StringVar(tk)
|
||||||
versionString.set("v1.12")
|
versionString.set("v1.12.1")
|
||||||
version = tkinter.ttk.Label(
|
version = tkinter.ttk.Label(
|
||||||
tk,
|
tk,
|
||||||
textvariable=versionString
|
textvariable=versionString
|
||||||
|
@ -1143,10 +1145,14 @@ def work():
|
||||||
if shouldErase:
|
if shouldErase:
|
||||||
if onlyFolders:
|
if onlyFolders:
|
||||||
for i in onlyFolders:
|
for i in onlyFolders:
|
||||||
|
if not working:
|
||||||
|
break
|
||||||
secureWipe(i)
|
secureWipe(i)
|
||||||
if onlyFiles:
|
if onlyFiles:
|
||||||
for i in range(len(onlyFiles)):
|
for i in range(len(onlyFiles)):
|
||||||
statusString.set(strings[12]+f" ({i}/{len(onlyFiles)}")
|
if not working:
|
||||||
|
break
|
||||||
|
statusString.set(strings[12]+f" ({i}/{len(onlyFiles)})")
|
||||||
progress["value"] = i/len(onlyFiles)
|
progress["value"] = i/len(onlyFiles)
|
||||||
secureWipe(onlyFiles[i])
|
secureWipe(onlyFiles[i])
|
||||||
secureWipe(inputFile)
|
secureWipe(inputFile)
|
||||||
|
@ -1157,24 +1163,34 @@ def work():
|
||||||
if allFiles or onlyFiles:
|
if allFiles or onlyFiles:
|
||||||
remove(inputFile)
|
remove(inputFile)
|
||||||
|
|
||||||
# Show appropriate notice if file corrupted or modified
|
# Prevent Unicode nonsense on MacOS
|
||||||
arrow = "" if platform.system()=="Darwin" else "🡪"
|
arrow = "" if platform.system()=="Darwin" else "🡪"
|
||||||
if not kept:
|
|
||||||
statusString.set(f"Completed. (Click here to show output {arrow})")
|
# If user hit 'Cancel' during secure wiping...
|
||||||
# Show Reed-Solomon stats if it fixed corrupted bytes
|
if not working:
|
||||||
if mode=="decrypt" and reedsoloFixed:
|
fin.close()
|
||||||
tmp = "s" if reedsoloFixed!=1 else ""
|
fout.close()
|
||||||
statusString.set(
|
resetUI()
|
||||||
f"Completed with {reedsoloFixed} byte{tmp}"+
|
statusString.set(f"Secure wipe canceled, but encryption was successful. (Output {arrow})")
|
||||||
f" fixed. (Click here to show output {arrow})"
|
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
if kept=="modified":
|
# Show appropriate notice if file corrupted or modified
|
||||||
statusString.set(strings[7])
|
|
||||||
elif kept=="corrupted":
|
if not kept:
|
||||||
statusString.set(strings[6])
|
statusString.set(f"Completed. (Click here to show output {arrow})")
|
||||||
|
# Show Reed-Solomon stats if it fixed corrupted bytes
|
||||||
|
if mode=="decrypt" and reedsoloFixed:
|
||||||
|
tmp = "s" if reedsoloFixed!=1 else ""
|
||||||
|
statusString.set(
|
||||||
|
f"Completed with {reedsoloFixed} byte{tmp}"+
|
||||||
|
f" fixed. (Click here to show output {arrow})"
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
statusString.set(strings[8])
|
if kept=="modified":
|
||||||
|
statusString.set(strings[7])
|
||||||
|
elif kept=="corrupted":
|
||||||
|
statusString.set(strings[6])
|
||||||
|
else:
|
||||||
|
statusString.set(strings[8])
|
||||||
|
|
||||||
status.config(cursor="hand2")
|
status.config(cursor="hand2")
|
||||||
|
|
||||||
|
@ -1262,8 +1278,9 @@ def updateStats(total):
|
||||||
|
|
||||||
# Securely wipe file(s) via system internals
|
# Securely wipe file(s) via system internals
|
||||||
def secureWipe(fin):
|
def secureWipe(fin):
|
||||||
|
global working
|
||||||
statusString.set(strings[12])
|
statusString.set(strings[12])
|
||||||
|
progress["value"] = 100
|
||||||
# Check platform, erase accordingly
|
# Check platform, erase accordingly
|
||||||
if platform.system()=="Windows":
|
if platform.system()=="Windows":
|
||||||
# Recursively delete folders
|
# Recursively delete folders
|
||||||
|
@ -1273,14 +1290,14 @@ def secureWipe(fin):
|
||||||
if dirname(i) not in paths:
|
if dirname(i) not in paths:
|
||||||
paths.append(dirname(i))
|
paths.append(dirname(i))
|
||||||
for i in range(len(paths)):
|
for i in range(len(paths)):
|
||||||
|
if not working:
|
||||||
|
return
|
||||||
statusString.set(strings[12]+f" ({i}/{len(paths)})")
|
statusString.set(strings[12]+f" ({i}/{len(paths)})")
|
||||||
progress["value"] = 100*i/len(paths)
|
progress["value"] = 100*i/len(paths)
|
||||||
system(f'cd "{paths[i]}" && "{rootDir}/sdelete64.exe" * -p 4 -s -nobanner')
|
system(f'cd "{paths[i]}" && "{rootDir}/sdelete64.exe" * -p 4 -nobanner')
|
||||||
system(f'cd "{rootDir}"')
|
system(f'cd "{rootDir}"')
|
||||||
rmtree(fin)
|
rmtree(fin)
|
||||||
else:
|
else:
|
||||||
statusString.set(strings[12])
|
|
||||||
progress["value"] = 100
|
|
||||||
system(f'sdelete64.exe "{fin}" -p 4 -nobanner')
|
system(f'sdelete64.exe "{fin}" -p 4 -nobanner')
|
||||||
|
|
||||||
# MacOS
|
# MacOS
|
||||||
|
|
Loading…
Reference in New Issue