Created
January 25, 2016 16:09
-
-
Save richardsonlima/621288753bc4b3122fec to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/env bash | |
# Created by Richardson Lima - contatorichardsonlima at gmail dot com | |
# set -x | |
Nat='' # NAT IP | |
Timeout='15' # Seconds | |
File='./EnvFile.txt' | |
User='' # Username for ssh connection | |
function CreateEnvFile(){ | |
cat << EOF > ./EnvFile.txt | |
01 | |
02 | |
03 | |
04 | |
05 | |
06 | |
EOF | |
} | |
function CreateCollect(){ | |
cat << EOF > ./Collector.sh | |
echo | |
echo -e "\033[1;34m [*] Checando informações gerais do sistema \033[m"; | |
echo -e "\033[1;32m [+] Sistema Operacional: \033[m" $(python -c 'import platform; print platform.system()' ) | |
echo -e "\033[1;32m [+] Nome do host: \033[m" $(python -c 'import socket; print socket.gethostname()' ) | |
echo -e "\033[1;32m [+] Distribuição: \033[m" $(python -c 'import platform; print platform.dist()' ) | |
echo -e "\033[1;32m [+] Versão/Kernel: \033[m" $(python -c 'import platform; print platform.release()' ) | |
echo -e "\033[1;32m [+] Arquitetura: \033[m" $(python -c 'import platform; print platform.machine()' ) | |
echo -e "\033[1;32m [+] Identificador do servidor: \033[m" $(python -c 'import os; os.system("sudo dmidecode -s system-uuid")') | |
echo | |
EOF | |
chmod +x ./Collector.sh | |
} | |
function main(){ | |
for port in $(cat $File); | |
do \ | |
echo -e '\033[1;32m [+] NatServer: \033[0m'$Nat && \ | |
echo -e '\033[1;32m [+] Port: 22 \033[0m'$port && \ | |
echo -e '\033[1;32m [+] TimeOut [seconds]: \033[0m'$Timeout && echo '' && \ | |
ssh -T -o ConnectTimeout=$Timeout -p22$port $user@$Nat < ./Collector.sh ; | |
echo ''; | |
done | |
} | |
### Call Functions | |
CreateEnvFile | |
CreateCollect | |
main |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment