-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathcryptosteg.sh
107 lines (91 loc) · 3.02 KB
/
cryptosteg.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#!/bin/bash
# CryptoSteg
# Encrypt files and steg them to pictures
# GPLv2 or later - [email protected] - Aurelien DESBRIERES
# find the license at gnu.org and much more ;-)
# Variables
ENCRYPT="$(gpg -c)"
DECRYPT="$(gpg)"
# Clear the terminal
tput clear
# Prevent pinentry trouble with pinentry display
echo pinentry-program /usr/bin/pinentry-curses >> ~/.gnupg/gpg-agent.conf
echo RELOADAGENT | gpg-connect-agent
# Welcome
printf "\033[1;32mWelcome to CryptoSteg\n Stegagnograph and Encrypt data\n Made Simple\033[0m%s\n"
# Request the user to install or not the needed software
while true; do
read -p "Do you need to install steghide and gpg to run CryptoSteg? Y/n " yn
case $yn in
[Yy]* ) # Install needed software for the operating system
command_exists () {
type "$1" &> /dev/null ;
}
# For Debian / Ubuntu / Trisquel / gNewSense and derivatives
if command_exists apt-get ; then
sudo apt-get install steghid gnupg ; exit
fi
# For Archlinux / Parabola and derivatives
if command_exists pacman ; then
sudo pacman -Sy steghide gnupg ; exit
fi
# For Android / Cyanogen / Replicant and derivatives
if command_exists apt ; then
sudo apt install steghide gnupg ; exit
fi
# For Fedora and derivatives
if command_exists dnf ; then
sudo dnf install -y steghide gnupg ; exit
fi
# For RedHat / CentOS and derivatives
if command_exists yum ; then
sudo yum install -y steghide gnupg ; exit
fi
# For Gentoo
if command_exists emerge ; then
sudo emerge --ask -y steghide gnupg ; exit
fi
# For Sabayon
if command_exit equo ; then
sudo equo install -y steghide gnupg ; exit
fi
# For FreeBSD
if command_exit pkg ; then
sudo pkg install -y steghide gnupg ; exit
fi
break;;
[Nn]* ) break ;;
* ) echo "Please answer Yes or no. ";;
esac
done
# Encrypt or Decrypt?
while true; do
read -p "Do you which to encrypt or decrypt data? Encrypt/Decrypt " ed
case $ed in
[Ee]* ) # Encrypt - Request the user where and which file he wish to encrypt
printf "Which file do you wish to encrypt?\n"
printf "Please provide its place and name like /home/user/file\n"
read FILE
# Encrypt
"$ENCRYPT" "$FILE"
# Request the user which picture he want to use
printf "Which picture do you wish to use?\n"
printf "Please provide its place and name like /home/user/picture\n"
read PICTURE
# Grab and Steg the file
steghide embed -cf "$PICTURE" -ef "$FILE".gpg
printf -v "Well done, $PICTURE now contain your secret safe\n"
break;;
[Dd]* ) # Decrypt - Request the user where and which file he wish to decrypt
printf "Which picture do you want to extract?\n"
printf "Please provide its place and name like /home/user/picture\n"
read PICTURE
# Encrypt
steghide extract -sf "$PICTURE"
$DECRYPT ./*.gpg
printf "Well done, your file is now human readable\n"
break;;
* ) echo "Please answer Encrypt or Decrypt.";;
esac
done
exit