~alienagain/sec_scripts

bdfd85cab506a6da481ae7f08a6433ec566682af — paula 4 months ago f9c1b3b
adding an iterator to partially encrypt several random
2 files changed, 31 insertions(+), 1 deletions(-)

A partial_enc/repeat.sh
M partial_enc/simulacro.sh
A partial_enc/repeat.sh => partial_enc/repeat.sh +29 -0
@@ 0,0 1,29 @@
#!/bin/bash

pass="$1"
bfile=$2

xxd $bfile > content

mient=$(ent -t mibin2.bin |  csvcut -c 4 | tail -n 1); mient=${mient%.*}; sum=$(($mient / 1000000)); echo $sum
echo "the entropy of the encrypted file is $mient"

for i in {1..10}; do
	mirand="$((10 + $RANDOM % 1000))"
	echo "$i - editing position number $mirand"
	./simulacro.sh $mirand $bfile $pass
	sleep 1
	echo "DEBUG: "
	./mibin2.bin 10 20 30
	sleep 1
done

rm content
xxd $bfile > content

#fent= strings content | ent -t | csvcut -c 3 | tail -n 1

mient=$(ent -t mibin2.bin |  csvcut -c 4 | tail -n 1); mient=${mient%.*}; sum=$(($mient / 1000000)); echo $sum
echo "the entropy of the encrypted file is $mient"
echo -e "\n\nfile info:"
file $bfile

M partial_enc/simulacro.sh => partial_enc/simulacro.sh +2 -1
@@ 68,7 68,8 @@ npos=$(($pos*32))

echo -e "the position where to inject the encrypted: $nstr is\n $npos"

read -p"continue? Y/N " DUMMY
# TO DO : ACTUAL CHOICE :)
#read -p"continue? Y/N " DUMMY
#<(xxd -r -p -o 1 -seek $npos <(echo $nstr))
dd bs=1 if=<(echo $nstr) of=$bfile seek=$npos conv=notrunc