pyHashcat
#1
If anyone is interested I created a Python wrapper to interface with oclHashcat. It's in beta currently so I'm sure there are bugs. Please let me know if/when you find them. I hope this helps with building GUIs, distributed solutions, and other interesting programs integrated with hashcat. I hope someone finds the wrapper useful.

My blog post about it can be found here:
http://www.sploitmonkey.com/2014/06/intr...shcat.html

The source can be found here:
https://github.com/Rich5/pyHashcat

List of features:

-Interface with oclHashcat as a Python object

-Run oclHashcat as a background process

-Automatically builds command line arguments based on Python object variable assignment

-Support for stdout stream gobbling

-Support for stderr stream gobbling

-Parse output from oclHashcat files and return data as a Python
dictionary data structure with user defined fields

-Parse restore files and return data as a Python dictionary data structure

-Wrapper class has context manager (i.e. with) that will automatically
clean-up oclHashcat background process on object termination

- Look-up function for mapping hash types to oclHashcat type codes
Reply
#2
Very interesting. Thank you man.
Reply
#3
Awesome! Many thanks! I've tweeted about here: https://twitter.com/hashcat/status/478814218209480704

This should help developers to rapidly integrate oclHashcat into their projects.

If not already doing, I'd recommend to parse the logfile for more useful information during the context run
Reply
#4
(06-17-2014, 10:23 AM)atom Wrote: Awesome! Many thanks! I've tweeted about here: https://twitter.com/hashcat/status/478814218209480704

This should help developers to rapidly integrate oclHashcat into their projects.

If not already doing, I'd recommend to parse the logfile for more useful information during the context run

Hope it's useful. Thanks for the tweet and of course for making hashcat!
Reply
#5
Bug Fix:
Fixed an error with parsing the restore file. I fat fingered a variable name.

To parse the restore file you can either call the get_restore_stats() function without arguments or specific a file name. If you don't specify a file path/name the wrapper will look for a restore file in the hashcat directory with the same name as the session variable. I added an example to the readme file on GitHub.

Code:
with pyHashcat.oclHashcatWrapper(path_to_exe) as hashcat:
    
    hashcat.get_restore_stats(restore_file_path="/mysession.restore")
    print hashcat.stats
Reply
#6
I twitted it as well Smile cool stuff
Reply
#7
(06-17-2014, 04:09 PM)NBZ Wrote: I twitted it as well Smile cool stuff

Great! Thanks! If you getting around to trying it out let know if you find bugs. Parsing the restore file is tricky and it's hard for me to test all the features in oclHashcat.
Reply
#8
Really great work! Thank's for this wrapper Big Grin
Reply
#9
(06-17-2014, 05:16 PM)hypn0s Wrote: Really great work! Thank's for this wrapper Big Grin

Thanks!

Atom, I'll take a look at parsing out the log file too. The more information available to the users the better.
Reply
#10
I just pushed a major update to pyHashcat. It now has support for Hashcat and not just oclHashcat through the HashcatWrapper class. It is very similar to the oclHashcatWrapper.

One major difference is that the stdout function in HashcatWrapper is g_stdout() instead of just stdout(). The way track how the variables are changed created this requirement for me.

I'm sure there are bugs. Please let me know if/when you find them, and I'll work fixing it as soon as I can.
Reply