JPaulMora / Pyrit

The famous WPA precomputed cracker, Migrated from Google.
GNU General Public License v3.0
1.04k stars 271 forks source link

strace futex FUTEX_WAIT_PRIVATE #492

Open impakho opened 7 years ago

impakho commented 7 years ago

run cpu crack, it was a success, the password was came out. run gpu(opencl) crack, it will automatically stop. run cpu+gpu(opencl) crack(it's the fastest), it was okay, i got the password too.

When I run gpu crack, I also run strace and debug it. Here is the output info from strace:

write(1, "Picked AccessPoint 00:0b:86:c2:a"..., 64Picked AccessPoint 00:0b:86:c2:a4:85 ('linksys') automatically.
) = 64
open("dict.gz", O_RDONLY)               = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=40611, ...}) = 0
mmap(NULL, 8392704, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_STACK, -1, 0) = 0x7fba678f3000
mprotect(0x7fba678f3000, 4096, PROT_NONE) = 0
clone(child_stack=0x7fba680f2ff0, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID, parent_tidptr=0x7fba680f39d0, tls=0x7fba680f3700, child_tidptr=0x7fba680f39d0) = 22848
futex(0x2989500, FUTEX_WAKE_PRIVATE, 1) = 0
futex(0x2f0b4a0, FUTEX_WAKE_PRIVATE, 1) = 1
futex(0x2989500, FUTEX_WAKE_PRIVATE, 1) = 1
futex(0x3157550, FUTEX_WAIT_PRIVATE, 0, NULL) = -1 EAGAIN (Resource temporarily unavailable)
futex(0x2989500, FUTEX_WAIT_PRIVATE, 0, NULL) = -1 EAGAIN (Resource temporarily unavailable)
fstat(3, {st_mode=S_IFREG|0644, st_size=40611, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fba73941000
lseek(3, 0, SEEK_CUR)                   = 0
fstat(3, {st_mode=S_IFREG|0644, st_size=40611, ...}) = 0
lseek(3, 36864, SEEK_SET)               = 36864
read(3, "L\341]\31\316T\17,\26\205\241\325\204\10\330j\f\334DXc\200;!n\244G\216T\322\263\255"..., 3747) = 3747
lseek(3, 0, SEEK_SET)                   = 0
read(3, "\37\213\10\10&J\222K\0\3dict\0U\275]\223\344F\222$\370\216_q+\367\361\260\""..., 4096) = 4096
read(3, "p\246&\r\7*iT\305[&\246\314\36T\354\221r\2615`?m\347b\213\270o\273\271?\233"..., 4096) = 4096
futex(0x2989500, FUTEX_WAKE_PRIVATE, 1) = 1
read(3, "\3472$\227\371\350\244h\21\254\310\233\f\4^\03022y\204N\260$\244qCw\240\220\241\\\33"..., 4096) = 4096
read(3, "@0\262\355\273\216\6\322\355\311\242\260\205\31 |\377\216\211n\326\264r\365\35\17\33\325\305Y\r\213"..., 4096) = 4096
futex(0x2989500, FUTEX_WAKE_PRIVATE, 1) = 0
read(3, "2x\202\343\307\376\272\206\261&h\225\302\200\326\203R\206rSj\27\325\5\"5]\22e\235r\27"..., 4096) = 4096
mmap(NULL, 262144, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fba678b3000
read(3, "&\n >\222A\243\t\356\336g~\360r\325x\243\21\203Hs\240gw\324\6\274\340\263`\256\365"..., 4096) = 4096
read(3, "\216\350(\325\232\302+\17\341\302\241\217\231B\361\260\235h\312\3230E\235\337\332\36p\r\227\374k?"..., 4096) = 4096
read(3, "YO\fI\35\245L\262.\327T,\1\271\2529uF\323\36\321\255\371\311\246\325q\0\212=\275h"..., 4096) = 4096
read(3, "\204\25.\246\235\317'\221)\t;\253\3\3168\316\204a6\276\354@\274\240\301\263\25\242\301Z\264\370"..., 4096) = 4096
futex(0x2989500, FUTEX_WAKE_PRIVATE, 1) = 1
read(3, "L\341]\31\316T\17,\26\205\241\325\204\10\330j\f\334DXc\200;!n\244G\216T\322\263\255"..., 4096) = 3747
read(3, "", 4096)                       = 0
lseek(3, 36864, SEEK_SET)               = 36864
read(3, "L\341]\31\316T\17,\26\205\241\325\204\10\330j\f\334DXc\200;!n\244G\216T\322\263\255"..., 3747) = 3747
lseek(3, 40611, SEEK_SET)               = 40611
read(3, "", 4096)                       = 0
fstat(3, {st_mode=S_IFREG|0644, st_size=40611, ...}) = 0
lseek(3, 36864, SEEK_SET)               = 36864
read(3, "L\341]\31\316T\17,\26\205\241\325\204\10\330j\f\334DXc\200;!n\244G\216T\322\263\255"..., 3747) = 3747
select(0, NULL, NULL, NULL, {0, 1000})  = 0 (Timeout)
select(0, NULL, NULL, NULL, {0, 2000})  = 0 (Timeout)
select(0, NULL, NULL, NULL, {0, 4000})  = 0 (Timeout)
futex(0x2989500, FUTEX_WAIT_PRIVATE, 0, NULL) = 0
select(0, NULL, NULL, NULL, {0, 1000})  = 0 (Timeout)
select(0, NULL, NULL, NULL, {0, 2000})  = 0 (Timeout)
select(0, NULL, NULL, NULL, {0, 4000})  = 0 (Timeout)
select(0, NULL, NULL, NULL, {0, 8000})  = 0 (Timeout)
select(0, NULL, NULL, NULL, {0, 16000}) = 0 (Timeout)
select(0, NULL, NULL, NULL, {0, 32000}) = 0 (Timeout)
select(0, NULL, NULL, NULL, {0, 50000}) = 0 (Timeout)
select(0, NULL, NULL, NULL, {0, 50000}) = 0 (Timeout)
select(0, NULL, NULL, NULL, {0, 50000}) = 0 (Timeout)
select(0, NULL, NULL, NULL, {0, 50000}) = 0 (Timeout)
select(0, NULL, NULL, NULL, {0, 50000}) = 0 (Timeout)
select(0, NULL, NULL, NULL, {0, 50000}) = 0 (Timeout)
select(0, NULL, NULL, NULL, {0, 50000}) = 0 (Timeout)
select(0, NULL, NULL, NULL, {0, 50000}) = 0 (Timeout)
mmap(NULL, 262144, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fba67216000
write(1, "Tried 4094 PMKs so far; 1799 PMK"..., 46Tried 4094 PMKs so far; 1799 P) = 46r second.
fstat(3, {st_mode=S_IFREG|0644, st_size=40611, ...}) = 0
lseek(3, 36864, SEEK_SET)               = 36864
read(3, "L\341]\31\316T\17,\26\205\241\325\204\10\330j\f\334DXc\200;!n\244G\216T\322\263\255"..., 4096) = 3747
futex(0x3176350, FUTEX_WAIT_PRIVATE, 0, NULL) = 0
close(3)                                = 0
munmap(0x7fba73941000, 4096)            = 0
write(1, "Tried 4094 PMKs so far; 1799 PMK"..., 46Tried 4094 PMKs so far; 1799 PMKs per second.
) = 46
futex(0x2902b40, FUTEX_WAIT_PRIVATE, 0, NULL) = 

We can see in strace hang on FUTEX_WAIT_PRIVATE.

JPaulMora commented 7 years ago

Hello, did Pyrit show any error (traceback)? also, please post the contents of ~/.pyrit/config and pyrit list_cores thanks

impakho commented 7 years ago

Machine A:

root@nano:~# cat .pyrit/config 
default_storage = file://
limit_ncpus = -1
rpc_announce = true
rpc_announce_broadcast = false
rpc_knownclients = 
rpc_server = false
use_CUDA = false
use_OpenCL = true
workunit_size = 75000

root@nano:~# pyrit list_cores
Pyrit 0.5.1 (C) 2008-2011 Lukas Lueg - 2015 John Mora
https://github.com/JPaulMora/Pyrit
This code is distributed under the GNU General Public License v3+

CPUs disabled in config...

The following OpenCL GPUs seem aviable...
#1:  'OpenCL-Device 'Tahiti''
root@nano:~#

Machine B:

root@mini:~# cat .pyrit/config 
default_storage = file://
limit_ncpus = -1
rpc_announce = true
rpc_announce_broadcast = false
rpc_knownclients = 192.168.1.124
rpc_server = true
use_CUDA = false
use_OpenCL = true
workunit_size = 75000

root@mini:~# pyrit list_cores
Pyrit 0.5.1 (C) 2008-2011 Lukas Lueg - 2015 John Mora
https://github.com/JPaulMora/Pyrit
This code is distributed under the GNU General Public License v3+

CPUs disabled in config...
#1:  'Network-Clients'

The following OpenCL GPUs seem aviable...
#1:  'OpenCL-Device 'Tahiti''
root@mini:~#

No traceback or any error appear. When I run an example GPU crack on Machine B, it tells me something like "Tried 4091 PMKs so far; 935 PMKs per second". It seems like a normal situation. But several seconds later, the counting was just stopped. Is it a thread blocking?

JPaulMora commented 7 years ago

I see, well that's weird. still I'll see what I can do, I'm currently considering a rewrite of CUDA & OpenCL modules since they were made long ago, but that will probably take me a while. If you'd like, watch this repo so you get notified with new updates.

Slezhuk commented 7 years ago

Hello! Looks like i have same problem. I use pyrit 0.5.1, with CUDA. When i configure pyrit to use only GPU(via limit_ncpus) and use batch command- process run smoothly. But when i attack .pcap with attack_db command and disabled CPU, it hangs at start with something like:

Tried 374941 PMKs so far (3.9%); 268777394 PMKs per second

and in strace i see:

futex(0x555f783cab90, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 0, NULL, 0xffffffff

If i enable CPU, attack_db command works fine.

JPaulMora commented 7 years ago

Ok, I think I know whats happening. db lookup happens on the CPU so blocking CPU computing globally makes it hang. I think I can push a fix later today.