Detectar sistemas operacionais dos dispositivos na rede via TTL
Publicado por Tiago Hillebrandt (última atualização em 28/03/2013)
[ Hits: 5.159 ]
Homepage: http://tiagohillebrandt.eti.br
Apesar do TTL ser facilmente manipulável, esse script pode facilitar na detecção do sistema operacional dos dispositivos conectados em uma determinada faixa de IP da classe C, sendo facilmente adaptável para outras classes de endereço.
#!/bin/bash
#
# Detecta sistemas operacionais dos dispositivos na rede via TTL
# Copyright (C) 2013 Tiago Hillebrandt <tiagohillebrandt@ubuntu.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
for i in {1..254}; do
latencia=`ping 192.168.1.$i -c 1 | grep ttl | awk -F'ttl=' '{ print $2 }' | awk '{ print $1 }'`
if [ ${#latencia} -eq 0 ]; then
sistema="-"
elif [ $latencia -lt 100 ]; then
sistema="Linux"
elif [ $latencia -gt 150 ]; then
sistema="UNIX"
else
sistema="Windows"
fi
echo "192.168.1.$i: $sistema"
done
Shell Script básico para gerenciar usuários e bancos no MySQL ou MariaDB
zswapdeslig.sh - Um "Desligador" de ZSWAP, SWAP em RAM para Sabayon Linux
Abrir e redirecionar portas TCP em firewall iptables
Configuração do Iptables em modo texto.
tirinha-0.5.sh : Baixa as tirinhas da Ilustrada da Folha de São Paulo
Boas Práticas e Padrões Idiomáticos em Go e C
Vale a pena ter mais de uma interface grafica no seu Linux?
Estrutura e Funcionamento de um Ebuild no Gentoo Linux
Copiar Para e Mover Para no menu de contexto do Nautilus e Dolphin
Dotando o Thunar das opcoes Copiar para e Mover para no menu de contexto
Usando o ble.sh (Bash Line Editor) no lugar do bash completion
Montagem pré automática de HD externo usb em NTFS não funciona no Debian Trixie - Solução
Instalação Dual Boot Linux+Windows 11 (3)
No Ubuntu 26.04, sudo passou a mostrar os asteriscos ao digitar por pa... (5)
Como instalar Warsaw no Gentoo? (0)
Como insiro e excluo um elemento XML e JSON ao código Javascript (1)









