You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
495 B
Bash
22 lines
495 B
Bash
2 years ago
|
#!/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
|