0

I need to run this program:

Luis@Windu /cygdrive/c/Temporal/Expect$ oclhashcat64 ../Test.hccap -m 2500 -a 3 ?d?d?d?d?d?d?d?d
oclHashcat v1.31 starting...

Device #1: Bonaire, 1024MB, 1050Mhz, 12MCU
Device #2: Tahiti, 3072MB, 900Mhz, 28MCU

Hashes: 1 hashes; 1 unique digests, 1 unique salts
Bitmaps: 8 bits, 256 entries, 0x000000ff mask, 1024 bytes
Applicable Optimizers:
* Zero-Byte
* Single-Hash
* Single-Salt
* Brute-Force
Watchdog: Temperature abort trigger set to 90c
Watchdog: Temperature retain trigger set to 80c
Device #1: Kernel D:\Programas\HashCat\OCLHashCat/kernels/4098/m02500.Bonaire_1573.4_1573.4 (VM).kernel (259320 bytes)
Device #1: Kernel D:\Programas\HashCat\OCLHashCat/kernels/4098/markov_le_v1.Bonaire_1573.4_1573.4 (VM).kernel (92404 bytes)
Device #1: Kernel D:\Programas\HashCat\OCLHashCat/kernels/4098/bzero.Bonaire_1573.4_1573.4 (VM).kernel (30496 bytes)
Device #2: Kernel D:\Programas\HashCat\OCLHashCat/kernels/4098/m02500.Tahiti_1573.4_1573.4 (VM).kernel (259428 bytes)
Device #2: Kernel D:\Programas\HashCat\OCLHashCat/kernels/4098/markov_le_v1.Tahiti_1573.4_1573.4 (VM).kernel (92388 bytes)
Device #2: Kernel D:\Programas\HashCat\OCLHashCat/kernels/4098/bzero.Tahiti_1573.4_1573.4 (VM).kernel (30492 bytes)

[s]tatus [p]ause [r]esume [b]ypass [q]uit =>

When this last line appears, I need some automated way to send the q key, so I will receive results like:

Session.Name...: oclHashcat
Status.........: Aborted
Input.Mode.....: Mask (?d?d?d?d?d?d?d?d) [8]
Hash.Target....: 101 (00:1f:5b:c2:fb:0c <-> 30:87:30:e0:0b:cd)
Hash.Type......: WPA/WPA2
Time.Started...: Sun Nov 16 06:41:17 2014 (11 secs)
Time.Estimated.: Sun Nov 16 06:54:56 2014 (13 mins, 28 secs)
Speed.GPU.#1...:    26537 H/s
Speed.GPU.#2...:    99510 H/s
Speed.GPU.#*...:   126.0 kH/s
Recovered......: 0/1 (0.00%) Digests, 0/1 (0.00%) Salts
Progress.......: 1413120/100000000 (1.41%)
Skipped........: 0/1413120 (0.00%)
Rejected.......: 0/1413120 (0.00%)
HWMon.GPU.#1...:  0% Util, 38c Temp, N/A Fan
HWMon.GPU.#2...: 98% Util, 44c Temp, 49% Fan

WARNING: Failed to restore default fan speed for gpu number: 1:
Started: Sun Nov 16 06:41:17 2014
Stopped: Sun Nov 16 06:41:28 2014

I am trying to to this using expect. This is the code:

spawn oclHashcat64.exe ../Test.hccap -m 2500 -a 3 ?d?d?d?d?d?d?d?d
expect "*tatus"
send "q\r"
close
exit

But it seems not to be working. This is the result:

Luis@Windu /cygdrive/c/Temporal/Expect
$ expect.exe Prueba02.expect
spawn oclHashcat64.exe ../Test.hccap -m 2500 -a 3 ?d?d?d?d?d?d?d?d
oclHashcat v1.31 starting...

Device #1: Bonaire, 1024MB, 1050Mhz, 12MCU
Device #2: Tahiti, 3072MB, 900Mhz, 28MCU

Hashes: 1 hashes; 1 unique digests, 1 unique salts
Bitmaps: 8 bits, 256 entries, 0x000000ff mask, 1024 bytes
Applicable Optimizers:
* Zero-Byte
* Single-Hash
* Single-Salt
* Brute-Force
Watchdog: Temperature abort trigger set to 90c
Watchdog: Temperature retain trigger set to 80c
Device #1: Kernel D:\Programas\HashCat\OCLHashCat/kernels/4098/m02500.Bonaire_1573.4_1573.4 (VM).kernel (259320 bytes)
Device #1: Kernel D:\Programas\HashCat\OCLHashCat/kernels/4098/markov_le_v1.Bonaire_1573.4_1573.4 (VM).kernel (92404 bytes)
Device #1: Kernel D:\Programas\HashCat\OCLHashCat/kernels/4098/bzero.Bonaire_1573.4_1573.4 (VM).kernel (30496 bytes)
Device #2: Kernel D:\Programas\HashCat\OCLHashCat/kernels/4098/m02500.Tahiti_1573.4_1573.4 (VM).kernel (259428 bytes)
Device #2: Kernel D:\Programas\HashCat\OCLHashCat/kernels/4098/markov_le_v1.Tahiti_1573.4_1573.4 (VM).kernel (92388 bytes)
Device #2: Kernel D:\Programas\HashCat\OCLHashCat/kernels/4098/bzero.Tahiti_1573.4_1573.4 (VM).kernel (30492 bytes)

[s]tatus [p]ause [r]esume [b]ypass [q]uit =>
Luis@Windu /cygdrive/c/Temporal/Expect$

As you can see, the expected line appears, but the second part does not, and the q is not sent, because the main process keeps alive:

Luis@Windu /cygdrive/c/Temporal/Expect$ ps -e | grep "hashcat" -i
     1180       1    1180       6976  pty0    1000 07:51:13 /cygdrive/d/Programas/HashCat/OCLHashCat/oclHashcat64

Could someone tell me what am I doing wrong, please?

  • does echo "q" | expect.exe Prueba02.expect not work? – Rinzwind Nov 16 '14 at 07:18
  • It doesn't work, @Rinzwind . The program keeps running in the background. – Sopalajo de Arrierez Nov 16 '14 at 07:33
  • do you need it be q or q ? – Jacob Nov 16 '14 at 08:17
  • Just q should work. At least I don't need to pres Return when executing the program directly. – Sopalajo de Arrierez Nov 16 '14 at 08:30
  • I can think of a (really dirty) workaround, but: [1] is the terminal window running this the only one? [2] is the terminal window in front all the time? (I assume not) – Jacob Nov 16 '14 at 21:46
  • I fear the answer is no to both questions, @JacobVlijm. It is even possible that this program will be started in remote SSH console. – Sopalajo de Arrierez Nov 16 '14 at 22:29
  • Try adding exp_internal 1 to your expect script. This will turn on verbose mode. Warning: it is very verbose. You may find something in the verbose output that explains what is happening. ... ... ... But also, have you tried changing expect "*tatus" to expect "tatus"? It shouldn't make a difference, but I believe that you don't need the *. – G-Man Says 'Reinstate Monica' Nov 17 '14 at 21:54
  • Here it is, @G-Man, thanks you : http://pastebin.com/CS80x617 . There is, in fact, much info. I am not very experienced in reading that, but it seems to me that the last line sends the q key. Maybe it some sort of flaw with OCLHashCat. – Sopalajo de Arrierez Nov 17 '14 at 23:24
  • And yes, same results with tatus instead of *tatus. – Sopalajo de Arrierez Nov 17 '14 at 23:31
  • (1) I agree; it looks like it is sending the q\r. (2) It doesn’t make any sense that the verbose output comes to a dead stop after receiving [s]tatus. I wonder whether it would make a difference if you said expect "*tatus*>", to try to force it to read up to the > prompt. (3) It might also help to say expect "*tatus*>" send "q\r" (all on the same line). (4) It looks like you’re using Cygwin under Windows. Why are you posting on Ask Ubuntu? – G-Man Says 'Reinstate Monica' Nov 18 '14 at 00:12
  • Same results with expect "tatus*>, @G-Man. – Sopalajo de Arrierez Nov 18 '14 at 00:40
  • The second expect line you suggest fails with usage: send [args] string message, @G-Man – Sopalajo de Arrierez Nov 18 '14 at 00:40
  • Well, OCLHashCat has version for Windows and Linux. I was planning to install Linux, but GPU drivers is a bit complex to make it work with HashCat (it requires OpenCL, CUDA... etc), so I only have a Windows 7 SP1 for now. But I hope CygWin can simulate a Linux environment. UnixStackExchange would have been my other site to publish, but for some kind of questions I prefer AskUbuntu; I would say the other site is more appropriate for more technical questions. – Sopalajo de Arrierez Nov 18 '14 at 00:42
  • Oops; rather than expect "*tatus*>" send "q\r" I meant expect "*tatus*>" { send "q\r" }. – G-Man Says 'Reinstate Monica' Nov 18 '14 at 02:27
  • Nope, @G-Man. I think this should be a problem with OCLHashCat. It is prepared to work with pipes |, but, maybe for that same reason, the external inputs don't work as they must. I mean: the program expects to fin data to process incoming through the pipe, not control keys. – Sopalajo de Arrierez Nov 18 '14 at 04:01
  • New info discovered: https://hashcat.net/trac/ticket/535 . Resume: OCLHashCat seems not to work with CygWin for keys control :-( . But this is not exactly true: my keys control works fine in CygWin, so the problem must be some sort of combination between CygWin and Expect. – Sopalajo de Arrierez Nov 18 '14 at 04:03
  • Well, @G-Man, if the main problem comes from CygWin, we should move this thread to another forum, as long as it could not be a Ubuntu problem. I must admit I did not test all this stuff in Ubuntu, only on CygWin. What do you think? – Sopalajo de Arrierez Nov 18 '14 at 04:05
  • Given that you're using expect.exe' to spawnoclHashcat64.exe`, AU seems to be a bad fit. You've given it over two days; it may be time to try Super User (or Unix & Linux, if you believe that's appropriate). – G-Man Says 'Reinstate Monica' Nov 18 '14 at 16:24

0 Answers0