Giovanni Bassetti Immagine
 Blog personale di Nanni Bassetti... di Admin
 
"
Un computer sicuro è un computer spento e gettato in fondo al mare, con l'hard disk sbriciolato

N.B.
"
 

\\ Home Page : Articolo
NBSTEGO - bash script for steganography
Di Admin (del 19/12/2008 @ 20:30:34, in Computer Forensics, linkato 5437 volte)

Non so perchè, ma mi sono dedicato all'evoluzione di BrutalStego, ho scritto, infatti, un nuovo bash script, che fa realmente una steganografia di un testo, lo cripta in AES256 e lo nasconde in esadecimale nel file vettore.

La cosa che mi interessava era poter criptare il testo, nasconderlo e poterlo rilevare tramite immissione di password, insomma un tool di steganografia reale!

Strumenti usati:
grep, awk, dd, bc, wc, xxd, openssl

In sostanza funziona così:
si inserisce il nome del file vettore, si inserisce il nome del nuovo file (quello contenente il messaggio segreto), si inserisce il messaggio ed infine si inserisce la password.
Dopo questi input, il programmino cripta con OpenSSL in AES256 il messaggio segreto, poi lo converte in esadecimale e lo posiziona all'interno del nuovo file vettore.
L'ho testato sulle JPG e sugli MP3 e non si nota alcuna perturbazione.
Rilanciando il programmino, si può andare a svelare il messaggio segreto, inserendo il nome del file vettore e la password ; - )

Ecco lo script:

#!/bin/bash
# NBStego - by Nanni Bassetti - http://www.nannibassetti.com - nannib@libero.it
# a simple steganographic tool for Linux. Tested on  JPG, MP3, AVI
# It uses AES256 algorithm by openssl

hid ()
{

echo "Insert the message to hide:"
read ms
echo $ms>ptext
echo "Insert the file where to hide:"
read fl
echo "Insert the file name of the new file:"
read nfl
echo "Insert your password:"
read pw
# here it crypts the plaintext in cyphered text by aes25 and save it into steg.bin
openssl aes-256-cbc -in ptext -out steg.bin
# password length
lenpw=$(expr length "$pw")
lenpw_mod=$(echo 0 + 10 | bc)
# temp1.bin is the head of the new file
dd if=$fl of=temp1.bin bs=1c count=$lenpw_mod
# temp2.bin is a 10 bytes file filled of zeroes to store the secret message length
dd if=$fl of=temp2.bin bs=1c skip=$lenpw_mod count=10
# temp2.bin is the end of the new file
dd if=$fl of=temp3.bin bs=1c skip=$(echo $lenpw_mod + 10 | bc)
dd if=/dev/zero of=temp2.bin count=10 bs=1c
# hex conversion of steg.bin
cat steg.bin | xxd -p > steghex.bin
# len is the length of the steghex.bin file
len=$(wc -c steghex.bin|awk '{print $1 }')
# hex conversion of len
echo $len | xxd -p > l.bin
# it builts the new file
cat temp1.bin l.bin temp2.bin steghex.bin temp3.bin > $nfl
rm temp1.bin
rm temp2.bin
rm temp3.bin
rm steg.bin
rm steghex.bin
rm ptext
rm l.bin
echo " "
echo " -------------------------- "
echo " "

}
#-----End Hide-----


reveal ()
{
echo "Insert the file name containing the secret message:"
read nfl
echo "Insert the password:"
read pw
lenpw=$(expr length "$pw")
lenpw_mod=$(echo 0 + 10 | bc)
len=$(dd if=$nfl skip=$lenpw_mod bs=1c count=10 | xxd -r -p)
# it finds the openssl aes256 signanture into the target file and it takes the offset
sk=$(grep -iaob -m 1 "53616c746564" $nfl | awk -F ":" '{print $1}')
dd if=$nfl bs=1c skip=$sk count=$len status=noxfer | xxd -r -p | openssl aes-256-cbc -d -out text.txt -k $pw
cat text.txt
}

echo "NBSTEGO by Nanni Bassetti - 2008-12"
echo "Choose if you want to hide or to reveal:"
echo "1) Hide"
echo "2) Reveal"
read answ1
case $answ1 in
     1)  hid ;;
     2)  reveal ;;
     *)  echo "Wrong answer! Write 1 or 2"
      echo " ";;
    esac
exit

 Clicca qui per il DOWNLOAD

Articolo Articolo  Storico Storico Stampa Stampa
Ci sono 38 persone collegate

< giugno 2025 >
L
M
M
G
V
S
D
      
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
           

Cerca per parola chiave
 

Titolo
Annunci (68)
CHI SONO (4)
Computer Forensics (108)
SICUREZZA INFORMATICA (7)
TuttoStorto (16)

Catalogati per mese:
Marzo 2018
Aprile 2018
Maggio 2018
Giugno 2018
Luglio 2018
Agosto 2018
Settembre 2018
Ottobre 2018
Novembre 2018
Dicembre 2018
Gennaio 2019
Febbraio 2019
Marzo 2019
Aprile 2019
Maggio 2019
Giugno 2019
Luglio 2019
Agosto 2019
Settembre 2019
Ottobre 2019
Novembre 2019
Dicembre 2019
Gennaio 2020
Febbraio 2020
Marzo 2020
Aprile 2020
Maggio 2020
Giugno 2020
Luglio 2020
Agosto 2020
Settembre 2020
Ottobre 2020
Novembre 2020
Dicembre 2020
Gennaio 2021
Febbraio 2021
Marzo 2021
Aprile 2021
Maggio 2021
Giugno 2021
Luglio 2021
Agosto 2021
Settembre 2021
Ottobre 2021
Novembre 2021
Dicembre 2021
Gennaio 2022
Febbraio 2022
Marzo 2022
Aprile 2022
Maggio 2022
Giugno 2022
Luglio 2022
Agosto 2022
Settembre 2022
Ottobre 2022
Novembre 2022
Dicembre 2022
Gennaio 2023
Febbraio 2023
Marzo 2023
Aprile 2023
Maggio 2023
Giugno 2023
Luglio 2023
Agosto 2023
Settembre 2023
Ottobre 2023
Novembre 2023
Dicembre 2023
Gennaio 2024
Febbraio 2024
Marzo 2024
Aprile 2024
Maggio 2024
Giugno 2024
Luglio 2024
Agosto 2024
Settembre 2024
Ottobre 2024
Novembre 2024
Dicembre 2024
Gennaio 2025
Febbraio 2025
Marzo 2025
Aprile 2025
Maggio 2025
Giugno 2025

Gli interventi più cliccati






21/06/2025 @ 09:30:37
script eseguito in 44 ms