From f07400c892585765a9ab144a950a3cc15c1947eb Mon Sep 17 00:00:00 2001 From: Jesse Date: Sun, 25 Sep 2022 00:31:05 +0800 Subject: [PATCH 1/3] add key file option --- .gitignore | 2 ++ VeraCracker.py | 18 ++++++++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f4fae62 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +# Mac resource file +.DS_Store diff --git a/VeraCracker.py b/VeraCracker.py index 16e72d3..402c18c 100755 --- a/VeraCracker.py +++ b/VeraCracker.py @@ -23,7 +23,7 @@ VeraWinProcName = "veracrypt.exe" VeraMacPath = '/Applications/VeraCrypt.app/Contents/MacOS/VeraCrypt' VeraLinuxPath = 'veracrypt' -VeraLinuxAttributes = ' -t %s -p %s --non-interactive' +VeraLinuxAttributes = ' -t %s -p "%s" %s --non-interactive' # Functions @@ -75,8 +75,8 @@ def windowsCrack(p, veracryptPath): return False -def linuxCrack(p, veracryptPath): - cmd = veracryptPath + VeraLinuxAttributes % (args.v, p) +def linuxCrack(p, veracryptPath, keyFile): + cmd = veracryptPath + VeraLinuxAttributes % (args.v, p, keyFile) process = subprocess.Popen( cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) out, err = process.communicate() @@ -113,6 +113,8 @@ def printResults(startTime, tried): required=True, help='Path to volume') parser.add_argument('-p', metavar='list', type=str, nargs="?", help='Password list') + parser.add_argument('-k', metavar='file', type=str, + help='Path to the key file') if platform.system() == "Windows": parser.add_argument('-m', metavar='mountpoint', type=str, required=True, help='Mountpoint for the volume to be mounted') @@ -125,14 +127,21 @@ def printResults(startTime, tried): args = parser.parse_args() # Get VeraCypt binary path + keyFile = "" if platform.system() == "Linux": veracryptPath = VeraLinuxPath + if args.k: + keyFile = '-k "%s"' % args.k crack = linuxCrack elif platform.system() == "Windows": veracryptPath = VeraWinPath + if args.k: + keyFile = '/k "%s"' % args.k crack = windowsCrack elif platform.system() == "Darwin": veracryptPath = VeraMacPath + if args.k: + keyFile = '-k "%s"' % args.k crack = linuxCrack else: sys.exit("This script is not written for your platform") @@ -140,6 +149,7 @@ def printResults(startTime, tried): if args.b: veracryptPath = args.b + # Check script requirements checkRequirements() @@ -155,7 +165,7 @@ def printResults(startTime, tried): for p in progressbar(wordlist): if args.d: print("[-] Trying %s" % p) - if crack(p, veracryptPath): + if crack(p, veracryptPath, keyFile): print("[+] Password found! --> %s <--" % p) printResults(startTime, tried) sys.exit(0) From bbbb9e1d09f403b6b04c57afa6e0624158cb7e39 Mon Sep 17 00:00:00 2001 From: Jesse Date: Sun, 25 Sep 2022 00:42:22 +0800 Subject: [PATCH 2/3] add windows key file option --- VeraCracker.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/VeraCracker.py b/VeraCracker.py index 402c18c..bfa5ff1 100755 --- a/VeraCracker.py +++ b/VeraCracker.py @@ -61,8 +61,8 @@ def checkRequirements(): pass -def windowsCrack(p, veracryptPath): - os.popen(veracryptPath + VeraWinAttributes % (args.v, p, args.m)) +def windowsCrack(p, veracryptPath, keyFile): + os.popen(veracryptPath + VeraWinAttributes % (args.v, p, args.m, keyFile)) while True: if isVeraRunning(): time.sleep(0.1) From 76aa074b6899f3161646d072e7afd8a097ffc2f1 Mon Sep 17 00:00:00 2001 From: Jesse Date: Sun, 25 Sep 2022 15:46:47 +0800 Subject: [PATCH 3/3] modify VeraWinAttributes format string --- VeraCracker.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/VeraCracker.py b/VeraCracker.py index bfa5ff1..59e4c7e 100755 --- a/VeraCracker.py +++ b/VeraCracker.py @@ -18,7 +18,7 @@ # Constants VeraWinPath = '"c:\\Program Files\\VeraCrypt\\VeraCrypt.exe"' -VeraWinAttributes = ' /v "%s" /q /p "%s" /s /l %s' +VeraWinAttributes = ' /v "%s" /q /p "%s" %s /s /l %s' VeraWinProcList = "query process" VeraWinProcName = "veracrypt.exe" VeraMacPath = '/Applications/VeraCrypt.app/Contents/MacOS/VeraCrypt' @@ -62,7 +62,7 @@ def checkRequirements(): def windowsCrack(p, veracryptPath, keyFile): - os.popen(veracryptPath + VeraWinAttributes % (args.v, p, args.m, keyFile)) + os.popen(veracryptPath + VeraWinAttributes % (args.v, p, keyFile, args.m)) while True: if isVeraRunning(): time.sleep(0.1)