glv2 / bruteforce-luks

Try to find the password of a LUKS encrypted volume.
GNU General Public License v3.0
237 stars 35 forks source link

output and other usage issues #2

Closed srulikuk closed 6 years ago

srulikuk commented 8 years ago

Hi, I ran into the following issues while trying to use.

  1. when trying to run with more than 1 thread i get an error "bruteforce-luks: ath.c:193: _gcry_ath_mutex_lock: Assertion `*lock == ((ath_mutex_t) 0)' failed." I googled this error and found it's got something to do with how the script is handling multi-thread.

I tried with 1 thread and as a test gave it a volume with a 8 character password i gave it the first 3 and last 4 characters so it only needed to bruteforce 1 character, the process finished after 73 seconds however I had the following issues.

  1. how do i find the result? it does not display it. (does it write it to a file?)
  2. "sudo pkill -USR1 -f bruteforce-luks" just kills the process

this is my output: user@user:~$ sudo bruteforce-luks -t 1 -l 8 -m 8 -b "xxx" -e "xxxx" /dev/sdi1 | pv -tpreb 0B 0:01:13 [ 0B/s] [<=> user@user:~$

glv2 commented 8 years ago

I tried the program on Ubuntu 14.04, and I reproduced the _gcry_ath_mutex_lock issue when using several threads. It may mean that the libcryptsetup version of Ubuntu 14.04 doesn't initialize libgcrypt for multi-threading correctly... On my Gentoo system (which has more recent libraries) I don't see this issue.

I don't reproduce your issue with SIGUSR1. When I send a USR1 signal to the process, it doesn't terminate it, it prints:

Tried passwords: xxx
Total space searched: yyy%

When the program finds a valid password, it prints:

Password found: xxxx
srulikuk commented 8 years ago

do you run the command as sudo or root? and how do you send the SIGUSR1 command? in a different terminal window?

glv2 commented 8 years ago

I don't see any difference when running the program as root or with sudo.

I open two terminal windows. In the first terminal I run the program:

bruteforce-luks -t 1 -l 8 -m 8 -b xxx -e yyyy path/to/luks/volume

In the second terminal I send the USR1 signal from times to times:

pkill -USR1 -f bruteforce-luks

If you know the pid number of the bruteforce-luks process, you can also send the signal with:

kill -USR1 pid
srulikuk commented 8 years ago

maybe its not installed correctly (i did get errors first time during install) , how do i completely remove it from my system? i will re-install

glv2 commented 8 years ago

To uninstall, go to the directory containing the sources and enter:

make uninstall

It should work, but if it doesn't then just delete the file '/usr/local/bin/bruteforce-luks' by hand.

Then try to recompile everything from scratch:

make distclean
./autogen.sh
./configure
make
make install
srulikuk commented 8 years ago

does it need to be installed as root? or sudo good?

glv2 commented 8 years ago

Both should work.

srulikuk commented 8 years ago

i removed and reinstalled, no change with the result, it still does not show the password, however SIGUSR1 does show status, here is the complete output from the install http://pastebin.com/q1cyp9xZ the second last line "make[1]: Nothing to be done for `install-data-am'." is that a problem?

glv2 commented 8 years ago

The install-data-am message is not a problem. I looked at your log file and everything is ok.

So if the program doesn't show the password, it means it didn't find it.

Maybe the password contains characters that are not in the default character set (that is "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"). If this is the case, the character set to use can be specified with the -s option.

Or maybe the password length is bigger or shorter than the lengths specified on the command line with the -m and -l options...

srulikuk commented 8 years ago

Solved - you made me recount the password! I though it was 8 but it was 9 characters! maybe you can put a message "password not found" if it doesn't find it.

Regarding special characters, what do I need to specify for all symbols on qwerty keyboard? in the instructions I see for Chinese characters.

After the task completed is there a way to see how many passwords were tried? (if not can you implement it)

Can you try to resolve the multi-thread issue on ubuntu 14.04 (maybe try to find which packages need to be updated?)

I am gonna get some bitcoins in the next few days, some definitely coming your way.

glv2 commented 8 years ago

To test all the ASCII printable characters, you can use the following charset option:

-s ' !"#$%&()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_\`abcdefghijklmnopqrstuvwxyz{|}~'"'"
glv2 commented 8 years ago

I added some code to print a message indicating how many passwords were tried before exiting the program. It also print "Password not found" if necessary.

srulikuk commented 8 years ago

i don't have much experience with github, how do i update the app?

glv2 commented 8 years ago

Go to the directory containing the sources and enter the command:

git pull

It should fetch the new code commits from github and integrate them in your local repository.

If for some reason it doesn't work (i.e. some conflict is detected), you can try these commands:

git fetch origin
git reset --hard origin/master

And then you have to recompile and reinstall:

make uninstall
make
make install
srulikuk commented 8 years ago

thanks, i dont get teh number off passwords. i get; Tried passwords: 51B/s] [<=>] Total space searched: 82.258065% Password found: xxxxxxxxx

glv2 commented 8 years ago

Apparently you're using a pipe to pv, and the outputs of the program and pv are mixed. I think "Tried passwords: 51" comes from bruteforce-luks, and "B/s] [<=>]" comes from pv. Do you really need pv?

If you only want to know how long the program has been running, you can use the time command:

time brutefoce-luks [options] path/to/luks/volume
srulikuk commented 8 years ago

Just tried it with time instead of pv you are correct the B/s comes from pv, problem with time is it does not display elapsed time throughout, now that i know what the B/s is i can continue using pv,

many thanks

srulikuk commented 8 years ago

Would you be able to look into the multi-thread issue?

glv2 commented 8 years ago

If you use pv with only the -t option, the "B/s" and progress bar should not appear:

bruteforce-luks [options] path/to/luks/volume | pv -t

I'll try to see if the multi-thread issue on Ubuntu 14.04 can be fixed...

glv2 commented 8 years ago

I found a way to make multi-threading work in Ubuntu 14.04. The idea is to install the cryptsetup packages of Ubuntu 15.04 (vivid) into Ubuntu 14.04 (trusty).

To do that, log in as root and enter the commands:

cd /etc/apt/sources.list.d
echo "deb http://mirrors.kernel.org/ubuntu vivid main" > vivid.list
apt-get update
apt-get install libcryptsetup-dev
rm vivid.list
apt-get update

Then you have to reconfigure/recompile/reinstall bruteforce-luks:

make clean
./configure
make
make install

And multi-threading should work. However, I don't know if the cryptsetup packages from vivid can cause instabilities in trusty's system...

francoisprunier commented 8 years ago

This might help others: the threading issue exists on CentOS 7.2.1511 as well. Debian 8 is fine though, Ubuntu 15.10 is working as well.