Ok,
I finished my "Time Delay lock Box" by using John Ripper
It works like a charm! (very tested)
Considerations:
- target file: file.xwd (keepassx file)
- Np: Number of chunks to slice the target file before encrypting. It serves to linear increasing time probably decoding (we can just leave it to One).
( ProbablyTime decoding x Nº Chunks) == 1 day/Hours x Np
- Nc: Encrypted word length (It grows exponential the decoding times)
Requirements
- john Ripper (snap)
- gcolor2 (Used as a flag stop screen to check all before destroy target files)
- sudo chattr (need to be added in sudoers)
- keepassx (target file)
Theses are the scripts,
rip.sh (It encrypts the target file with a random password and once done, It destroys the files to encrypt)
Code: Select all
#!/bin/sh
#
APATH=/home/user/LINUXDEBS/rip
INI=`date +%Y-%m-%d_%H:%M:%S`
# Partes dividido de encriptado
Np=1
#Caracteres de encriptado
Nc=5
#**************************
FICH="$1"
#VRAN="$(cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 5 | head -n 1)"
#5 CARACTERES, VAN DESDE MINUTOS HAST 7 HORAS
cd $APATH && mkdir done
# Split en N partes para aumentar el tiempo de cifrado---------------------
rm -rf .zzSplit/
mkdir .zzSplit && mv *.xwd .zzSplit/ && cd .zzSplit/
split -n$Np *.xwd split_
for f in split_*
do
VRAN="$(cat /dev/urandom | tr -dc 'a-z0-9' | fold -w $Nc | head -n 1)"
#echo "RANDOM=$VRAN"
mv $f $f.part.xwd
zip -P "$VRAN" $f$INI.zip $f.part.xwd
echo $VRAN > $f$INI.zip.txt
done
mkdir sal$INI && mv *.zip *.txt sal$INI && mv sal$INI ../done/
sudo chattr +i ../done/sal$INI/*.zip
cd ../. && rm -rf .zzSplit/
# Split en N partes para aumentar el tiempo de cifrado---------------------
mkdir undone
ln -sf ../done/sal$INI/ ./undone/ && cd undone && rm sal
mv sal$INI sal
#Verifica q esta correctamente añadido
cd $APATH/done/sal$INI/
for f in split_*.zip
do
VRAN=$(cat $f.txt)
unzip -P "$VRAN" $f
done
cat split*.xwd > out.xwd
#
# #Control@@@@@@@
# dolphin out.xwd &
sleep 5
gcolor2
killall keepassx
# #Control@@@@@@@
#
rm *.txt *.xwd
sudo chattr +i ./
#
unrip.sh (It unecrypt the generated file/ sliced files by using force-brute, generating txt files with the passwords to unecrypt them and merge them)
Code: Select all
#!/bin/sh
#
APATH=/home/user/LINUXDEBS/rip
VARL=/tmp/xxYaS
CONT=""
INI=`date +%Y-%m-%d_%H:%M:%S`
FICH="$1"
#VRAN=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 2 | head -n 1)
rm -rf /home/user/snap/john-the-ripper/
clear
cd $APATH && mkdir undone
rsync -aAXv --delete $APATH/undone/sal/ $APATH/undone/ --exclude=sal
cd $APATH/undone
for f in split_*
do
# Cálcula riempo-----------------------------
killall timerout.sh -9
# Cálcula riempo-----------------------------
cp -f $f part.zip
snap run john-the-ripper.zip2john part.zip > johnpass.hash
#sudo snap run john-the-ripper --incremental:LowerNum johnpass.hash
snap run john-the-ripper --incremental:LowerNum johnpass.hash
snap run john-the-ripper --show johnpass.hash > clave$f.txt
CONT=$(cat $VARL/contador.txt)
killall timerout.sh -9
echo "Tiempo Procesado $f: $CONT" >> logTiempo$INI.txt
done
FIN=`date +%Y-%m-%d_%H:%M:%S`
echo "$FICH Comenzo a $INI y termino a $FIN" >> logTiempo$INI.txt
cat clave*.txt >> logTiempo$INI.txt
sudo chattr +i logTiempo$INI.txt
timerout.sh (It works as a counter timer for the decoding task)
Code: Select all
#!/bin/bash
#
VARL=/tmp/xxYaS
rm -rf $VARL
mkdir /tmp/xxYaS
for (( c=1; c>=1; c++ ))
do
CONT=$(date -d@$c -u +%H:%M:%S)
# clear
#echo -ne "Welcome $CONT times"
sleep 1
printf "\r%2d $CONT Welcome times"
echo $CONT > $VARL/contador.txt
done &