hashcat Forum

Full Version: Cannot commuincate with oclHashcat process
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello everyone,

I am trying to run oclHashcat as a subprocess in Python. I can start it up just fine, but I cannot pass the usual commands ([s]tatus, [q]uit, etc) by simply writing that character to STDIN.

Code:
import time
import shlex
from subprocess import Popen, PIPE

command = "\"cudaHashcat64.exe\" --quiet -m 0 -a 3 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
proc = Popen(shlex.split(command), stdout=PIPE, stdin=PIPE, stderr=PIPE)

time.sleep(1)

proc.stdin.write("s")

time.sleep(1)

for line in iter(proc.stdout.readline, b''):
    if line:
        if line != "\r\n" and line != "\n":
            print(line)
            proc.stdout.flush()
    else:
        break

proc.terminate()

I should be getting a status response (that will be shown if I remove "--quiet"), but I want to be able to send commands to it. Is oclHashcat not using STDIN and/or only expecting a single character?

I have been googling this for some time, found others that have had a similar issue, and can't view the source to figure it out myself, I would really appreciate any feedback you may have.

Thank you in advanced for any help or ideas!
To read the status it is recommended to parse the restore file.
reading the restore file is one possibility, the other one would be (and afaik most "wrappers" choose this way) to use --status --status-automat (see also https://hashcat.net/trac/ticket/406 ).

Btw. also next version of cpu hashcat will ship with the --status-automat feature (see https://hashcat.net/trac/ticket/534 ).
Thanks for those tips!

But, what about pausing and resuming? I would like to have full functionality over oclHashcat if possible.

With some further research I would guess that in linux that it will read keypresses from TTY directly, and does not use STDIN, is that true?