User:ILebedev: Difference between revisions
From ICO wiki
Jump to navigationJump to search
No edit summary |
No edit summary |
||
(18 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
Quest 1 (5p) | Quest 1 (5p) | ||
Line 5: | Line 4: | ||
<source lang=bash> | <source lang=bash> | ||
#!/bin/bash | #!/bin/bash | ||
# | #installeerin ntp teenuse, vastated promptides yes | ||
apt-get install ntp | #Lisan "server ntp.eenet.ee" ntp confi faili lõppu | ||
#teeb teenusele restardi | |||
export LC=ALL_C | |||
sudo apt-get -y install ntp | |||
echo "server ntp.eenet.ee" >> /etc/ntp.conf | echo "server ntp.eenet.ee" >> /etc/ntp.conf | ||
service ntp restart | service ntp restart | ||
</source> | |||
'''Quest 4''' | |||
Teha skript, mis saab käsurea parameetrina ühe stringidest MD5, Blowfish, SHA256, SHA512 ja leiab üles kõik kasutajad, kellede parooliräsi on antud algoritmiga räsitud. | |||
<source lang=bash> | |||
#!/bin/bash | |||
# Imre Lebedev - A22 | |||
if [ $1 = "MD5" ] | |||
then | |||
getent shadow | grep '\$1\$' > /dev/null | |||
if [ $? = 0 ] | |||
then | |||
echo "MD5'ga krüpteeritud kasutajad on:" | |||
getent shadow | grep '\$1$\' > /etc/proov/proov | |||
cut -d":" -f1 /etc/proov | |||
fi | |||
elif [ $1 = "Blowfish" ] | |||
then | |||
getent shadow | grep '\$2y\$' > /dev/null | |||
if [ $? = 0 ] | |||
then | |||
echo "Blowfish'ga krüpteeritud kasutajad on:" | |||
getent shadow | grep '\$2y\$' > /etc/proov/proov | |||
cut -d":" -f1 /etc/proov | |||
fi | |||
elif [ $1 = "SHA-256" ] | |||
then | |||
getent shadow | grep '\$5\$' > /dev/null | |||
if [ $? = 0 ] | |||
then | |||
echo "Blowfish'ga krüpteeritud kasutajad on:" | |||
getent shadow | grep '\$5\$' > /etc/proov/proov | |||
cut -d":" -f1 /etc/proov | |||
fi | |||
elif [ $1 = "SHA-512" ] | |||
then | |||
getent shadow | grep '\$6\$' > /dev/null | |||
if [ $? = 0 ] | |||
then | |||
echo "Blowfish'ga krüpteeritud kasutajad on:" | |||
getent shadow | grep '\$6\$' > /etc/proov/proov | |||
cut -d":" -f1 /etc/proov | |||
fi | |||
else | |||
echo "Sisesta algoritm järgmiselt:" | |||
echo "./quest2014.sh [Algoritm]" | |||
echo "Algoritmi valikud : SHA-512 : SHA-256 : Blowfish ; MD5" | |||
exit 1 | |||
fi | |||
</source> |
Latest revision as of 13:46, 25 February 2014
Quest 1 (5p)
Loo skript, mis paigaldab ntp teenuse ja seab serveriks ntp.eenet.ee
#!/bin/bash
#installeerin ntp teenuse, vastated promptides yes
#Lisan "server ntp.eenet.ee" ntp confi faili lõppu
#teeb teenusele restardi
export LC=ALL_C
sudo apt-get -y install ntp
echo "server ntp.eenet.ee" >> /etc/ntp.conf
service ntp restart
Quest 4
Teha skript, mis saab käsurea parameetrina ühe stringidest MD5, Blowfish, SHA256, SHA512 ja leiab üles kõik kasutajad, kellede parooliräsi on antud algoritmiga räsitud.
#!/bin/bash
# Imre Lebedev - A22
if [ $1 = "MD5" ]
then
getent shadow | grep '\$1\$' > /dev/null
if [ $? = 0 ]
then
echo "MD5'ga krüpteeritud kasutajad on:"
getent shadow | grep '\$1$\' > /etc/proov/proov
cut -d":" -f1 /etc/proov
fi
elif [ $1 = "Blowfish" ]
then
getent shadow | grep '\$2y\$' > /dev/null
if [ $? = 0 ]
then
echo "Blowfish'ga krüpteeritud kasutajad on:"
getent shadow | grep '\$2y\$' > /etc/proov/proov
cut -d":" -f1 /etc/proov
fi
elif [ $1 = "SHA-256" ]
then
getent shadow | grep '\$5\$' > /dev/null
if [ $? = 0 ]
then
echo "Blowfish'ga krüpteeritud kasutajad on:"
getent shadow | grep '\$5\$' > /etc/proov/proov
cut -d":" -f1 /etc/proov
fi
elif [ $1 = "SHA-512" ]
then
getent shadow | grep '\$6\$' > /dev/null
if [ $? = 0 ]
then
echo "Blowfish'ga krüpteeritud kasutajad on:"
getent shadow | grep '\$6\$' > /etc/proov/proov
cut -d":" -f1 /etc/proov
fi
else
echo "Sisesta algoritm järgmiselt:"
echo "./quest2014.sh [Algoritm]"
echo "Algoritmi valikud : SHA-512 : SHA-256 : Blowfish ; MD5"
exit 1
fi