primeras funciones

master
fanta 3 years ago
commit 3738c31d73

@ -0,0 +1,21 @@
#!/usr/bin/env bash
main(){
checkRoot
haveProgram strace wget lsof
printActualSSHConnections
}
checkRoot(){
if [ "$(whoami)" != "root" ]; then echo -e "\e[31m\e[1m[NOT OK]\e[0m Run it with root please" && exit ; fi
}
haveProgram(){
for i in $@; do type $i &> /dev/null ; if [ $? == 1 ]; then echo "$i not found. Please install it"; fi ; done
}
printActualSSHConnections(){
lsof -c ssh 2>/dev/null | grep IPv4 | awk '{ print $2,$9 }' | cat -n | tee $tmpFileSSHConnections
}
main
Loading…
Cancel
Save