Improve both do and sudo shell script

This commit is contained in:
gbaconni
2021-11-08 18:04:52 +01:00
parent 7b898eb0a7
commit 0cad5a4ae3
2 changed files with 27 additions and 2 deletions

5
do.sh
View File

@@ -7,8 +7,9 @@ ssh_clean ()
ssh_exec () ssh_exec ()
{ {
ssh -p 4242 -l ${USER} -o StrictHostKeyChecking=no 127.0.0.1 $@ 2>&1 \ export SSHPASS="${SSHPASS-Born2beRoot}"
| grep -v -e 'Warning: Permanently added' ./ssh.exp -p 4242 ${USER}@127.0.0.1 $@ 2>&1 \
| grep -v -i -e '^Warning: Permanently added' -e ' password:' -e '^spawn ssh'
} }
main () main ()

24
sudo.sh Executable file
View File

@@ -0,0 +1,24 @@
#!/bin/bash
ssh_clean ()
{
ssh-keygen -R "[127.0.0.1]:4242" >/dev/null 2>&1
}
ssh_sudo ()
{
export SSHPASS="${SSHPASS-Born2beRoot}"
./ssh_sudo.exp -p 4242 ${USER}@127.0.0.1 sudo $@ 2>&1 \
| grep -v -i -e '^Warning: Permanently added' -e 'password' -e '^spawn ssh' -e 'Connection to'
}
main ()
{
ssh_clean
ssh_sudo $@
}
main $@
exit $?
#42