hashcat Forum
pyHashcat - Printable Version

+- hashcat Forum (https://hashcat.net/forum)
+-- Forum: Misc (https://hashcat.net/forum/forum-15.html)
+--- Forum: User Contributions (https://hashcat.net/forum/forum-25.html)
+--- Thread: pyHashcat (/thread-3478.html)



pyHashcat - richk - 06-17-2014

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/introducing-pyhashcat.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


RE: pyHashcat - 2die4 - 06-17-2014

Very interesting. Thank you man.


RE: pyHashcat - atom - 06-17-2014

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


RE: pyHashcat - richk - 06-17-2014

(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!


RE: pyHashcat - richk - 06-17-2014

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



RE: pyHashcat - NBZ - 06-17-2014

I twitted it as well Smile cool stuff


RE: pyHashcat - richk - 06-17-2014

(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.


RE: pyHashcat - hypn0s - 06-17-2014

Really great work! Thank's for this wrapper Big Grin


RE: pyHashcat - richk - 06-17-2014

(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.


RE: pyHashcat - richk - 09-09-2014

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.