Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Mac resource file
.DS_Store
24 changes: 17 additions & 7 deletions VeraCracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@

# 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'
VeraLinuxPath = 'veracrypt'
VeraLinuxAttributes = ' -t %s -p %s --non-interactive'
VeraLinuxAttributes = ' -t %s -p "%s" %s --non-interactive'

# Functions

Expand Down Expand Up @@ -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, keyFile, args.m))
while True:
if isVeraRunning():
time.sleep(0.1)
Expand All @@ -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()
Expand Down Expand Up @@ -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')
Expand All @@ -125,21 +127,29 @@ 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")

if args.b:
veracryptPath = args.b


# Check script requirements
checkRequirements()

Expand All @@ -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)
Expand Down