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

UnboundLocalError: local variable 'hashes_cracked' referenced before assignment #2

Closed
FelSec opened this issue Nov 14, 2019 · 1 comment

Comments

@FelSec
Copy link

FelSec commented Nov 14, 2019

I have noticed a small bug in the tool.

When I am trying to use the tool with a new hash list or file, I am getting the following error:

 Percentage Cracked:
Traceback (most recent call last):
  File "./hat.py", line 1131, in <module>
    main_menu()
  File "./hat.py", line 1124, in main_menu
    options[task]()
  File "./hat.py", line 1096, in hash_from_file
    crack_menu()
  File "./hat.py", line 961, in crack_menu
    percent_cracked = (hashes_cracked * 100 / HASHES_LOADED)
UnboundLocalError: local variable 'hashes_cracked' referenced before assignment

I amended the hat.py file to include hashes_cracked = 0 at line 960, to arbitrarily set the variable if the pot file does not exist (shown below):

POT = POT + '.pot'
pot_absolute = os.path.join(L00T_POT_DIR, POT)
if os.path.exists(pot_absolute):
    with open(pot_absolute) as lines:
    hashes_cracked = len(lines.readlines())
    prGreen(hashes_cracked)
else:
    prRed("0")
    hashes_cracked = 0
print" " + "Percentage Cracked:",
percent_cracked = (hashes_cracked * 100 / HASHES_LOADED)
@sp00ks-git
Copy link
Owner

Please pull the latest version. This is now fixed.

Repository owner deleted a comment from no1deer Nov 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants