[FreeBSD] add crossplatform script & pkg_base
[dotfiles_afify.git] / .scripts / luks_dic_attack.sh
blob6304919d217a38092696a63b80bb8806e302fef8
1 #!/usr/bin/env bash
3 #==============================================================================
4 # Name : luks_dic_attack
5 # GitHub : Afify
6 # Copyright : MIT
7 # Version : 0.0.1
8 # Description : Crack LUKS partion with hashcat with dictionary attack
9 #==============================================================================
11 chosen=$(\
12 # awk '$1~/[[:digit:]]/ && $3~/[[:alnum:]]/ && $4 == "";\
13 lsblk --noheadings --raw -o NAME,SIZE,FSTYPE,TYPE,MOUNTPOINT |\
14 awk '$4 == "part" && $5 == "" && $3 == "crypto_LUKS"'|\
15 dmenu -i -p "Mount volume" -l 10 )
17 partion=$(echo $chosen | awk '{print $1}')
19 if [ $partion ]; then
20 dev=/dev/sdb1
21 output_header_file=luks_header.001
22 # dictionary=/mnt/data/wordlist/rockyou.txt
23 dictionary=/home/hassan/dic.txt
24 cracked_password=cracked_password.txt
26 # Get LUKS header
27 luks_header=$(
28 dmenu -P -p "Get Partition header | sudo " |\
29 sudo -S dd if=$dev of=$output_header_file bs=512 count=4097 \
30 && notify-send "Success" "Got header file"\
31 || notify-send -u critical "Error" "Getting header file"
34 # Case got header file -> crack with hashcat
35 if [ $luks_header ];then
36 hashcat -m 14600 -a 0 -w 3\
37 $output_header_file $dictionary -o $cracked_password \
38 && notify-send "Success" "Cracked"\
39 || notify-send -u critical "Error" "Crack failed"