Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added local hashcat support in macOS #16

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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
9 changes: 9 additions & 0 deletions htpclient/hashcat_cracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@ def __init__(self, cracker_id, binary_download):
if Initialize.get_os() != 1:
self.callPath = "./" + self.callPath

# Symlink hashcat.osx in macOS
if not os.path.isfile(self.cracker_path + "hashcat.osx"): # in case it's not the
if Initialize.get_os() == 2: # macOS
try:
output = subprocess.check_output("ln -s $(which hashcat) hashcat.osx", shell=True, cwd=self.cracker_path)
except subprocess.CalledProcessError as e:
logging.error("Error during version detection: " + str(e))
sleep(5)

if not os.path.isfile(self.cracker_path + self.callPath): # in case it's not the new hashcat filename, try the old one (hashcat<bit>.<ext>)
self.executable_name = binary_download.get_version()['executable']
k = self.executable_name.rfind(".")
Expand Down
16 changes: 16 additions & 0 deletions htpclient/initialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,22 @@ def __update_information(self):
devices.append(line)

else: # OS X
logging.info("Check if Homebrew is installed...")
output = subprocess.check_output("type brew", shell=True)
output = output.decode(encoding='utf-8').replace("\r\n", "\n").split("\n")
for line in output:
line = line.rstrip("\r\n ")
if "not found" in line:
log_error_and_exit("Please install Homebrew first. Visit https://brew.sh for instructions.")

logging.info("Check if hashcat is installed via Homebrew...")
output = subprocess.check_output("brew info hashcat", shell=True)
output = output.decode(encoding='utf-8').replace("\r\n", "\n").split("\n")
for line in output:
line = line.rstrip("\r\n ")
if line == "Not installed":
log_error_and_exit("Please install hashcat via Homebrew first: brew install hashcat")

output = subprocess.check_output("system_profiler -detaillevel mini", shell=True)
output = output.decode(encoding='utf-8').replace("\r\n", "\n").split("\n")
for line in output:
Expand Down