
		ricardoxk
		
		(usa Ubuntu)
		
		Enviado em 09/06/2009 - 16:25h 
		Alguém poderai me ajudar com esse script?
Gostaria de saber a correta sintaxe dele para funcionar no FreeBSD.
#!/bin/bash
echo "Vou buscar os dados do sistema. Posso continuar? [s/n] "
        read RESPOSTA
        echo
        test "$RESPOSTA" = "n" && exit
                        echo "Data e Hora:"
                                date
                        echo
                        echo "Nome da Maquina:"
                                hostname
                        echo
                        echo "Informacoes da Rede:"
                                ifconfig le0 | grep  -w   'inet'| awk ' { print $2     }';
                                ifconfig le0 | grep  -w  'inet'| awk ' { print   $3 }';
                                ifconfig le0 | grep  -w  'inet'| awk ' { print $4   } ';
                        echo
                        echo "Gateway da rede:"
                                netstat -rn  | grep  -w  'default'| awk ' { print echo  $2   } ';
                        echo
                        echo "servidor de nomes da rede:"
                                cat /etc/resolv.conf |grep name |awk '{ print $1  $2 } '
                        echo
                        echo "Verificando Maquina no DNS!"
                                HOST=`hostname`
                                host $HOST
                        echo
        echo "Gostaria de verificar as faixas de IP's que estao em uso? Necessario o NMAP instalado! [s/n]."
                read cond
        echo
                                    test "$cond" = "n" && exit
        echo "Realizando mapeamento da rede!"
#Verifica le0
        VERI_le0=`ifconfig |grep le0|awk '{print $1}'|wc -l`
        IP=`netstat -rn  | grep  -w  'default'| awk ' { print echo  $2   } '`
                if [ $VERI_le0 = "1" ]; then
                le0=1
                IPle0=`ifconfig le0|grep inet|awk '{print $2 }'|cut -d ":" -f2` 2> /dev/null
                MASK_le0=`ifconfig le0|grep Mask|awk '{print $4}'|cut -d ":" -f 2`
                NMAP_le0=`nmap -sP $IP-254`
                count=1
                        for item in $NMAP_le0; do
                                PING_le0=`ping -c 1 $item |grep packets|awk `{print $4}``
                                echo "$item - Packets: $PING_le0"
                                count=`expr $count + 1`
                        done
                else
                        le0=0
                fi
exit