shell-script-pt
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [shell-script] Script de autenticação velox Telemar MG


From: Fernando Lemes da Silva
Subject: Re: [shell-script] Script de autenticação velox Telemar MG
Date: Tue, 11 Nov 2003 16:21:19 -0300

   Porque voce não atualiza o script ? Veja a forma que está sendo feita a
autenticação e faça as adaptações... a lista está aqui para ajudar nisso e
não pra distribuir scripts prontos...

   A proposito eu fiz o scriptzinho dos pings... não sei se errei em algum
detalhe, mas vai lá :


#!/bin/bash

function errorexit () {
  echo -e "\nSCAN IPs\nUsage : scanips <ip> <netmask>\n"
}
ip1=$(echo "$1..." | cut -d "." -f 1)
ip2=$(echo "$1..." | cut -d "." -f 2)
ip3=$(echo "$1..." | cut -d "." -f 3)
ip4=$(echo "$1..." | cut -d "." -f 4)
if [ -z "$ip1" ]; then errorexit; exit 1; fi
if [ "$ip1" -lt "0" -o "$ip1" -gt "255" ]; then errorexit; exit 1; fi
if [ -z "$ip2" ]; then errorexit; exit 1; fi
if [ "$ip2" -lt "0" -o "$ip2" -gt "255" ]; then errorexit; exit 1; fi
if [ -z "$ip3" ]; then errorexit; exit 1; fi
if [ "$ip3" -lt "0" -o "$ip3" -gt "255" ]; then errorexit; exit 1; fi
if [ -z "$ip4" ]; then errorexit; exit 1; fi
if [ "$ip4" -lt "0" -o "$ip4" -gt "255" ]; then errorexit; exit 1; fi
nm1=$(echo "$2..." | cut -d "." -f 1)
nm2=$(echo "$2..." | cut -d "." -f 2)
nm3=$(echo "$2..." | cut -d "." -f 3)
nm4=$(echo "$2..." | cut -d "." -f 4)
if [ "$nm1" ] && [ -z "$nm2" ]&& [ -z "$nm3" ] && [ -z "$nm4" ]; then
nm=$nm1
else
  if [ -z "$nm1" ]; then errorexit; exit 1; fi
  if [ "$nm1" -lt 0 ] || [ "$nm1" -gt 255 ]; then errorexit; exit 1; fi
  if [ -z "$nm2" ]; then errorexit; exit 1; fi
  if [ "$nm2" -lt 0 ] || [ "$nm2" -gt 255 ]; then errorexit; exit 1; fi
  if [ -z "$nm3" ]; then errorexit; exit 1; fi
  if [ "$nm3" -lt 0 ] || [ "$nm3" -gt 255 ]; then errorexit; exit 1; fi
  if [ -z "$nm4" ]; then errorexit; exit 1; fi
  if [ "$nm4" -lt 0 ] || [ "$nm4" -gt 252 ]; then errorexit; exit 1; fi
  nm=0
  while [ "$nm1" -gt 0 ]; do nm=$[$nm + $nm1%2]; nm1=$[$nm1/2]; done
  while [ "$nm2" -gt 0 ]; do nm=$[$nm + $nm2%2]; nm2=$[$nm2/2]; done
  while [ "$nm3" -gt 0 ]; do nm=$[$nm + $nm3%2]; nm3=$[$nm3/2]; done
  while [ "$nm4" -gt 0 ]; do nm=$[$nm + $nm4%2]; nm4=$[$nm4/2]; done
fi
if [ "$nm" -gt "30" ]; then errorexit; exit 1; fi
network=$(ipcalc -n $ip1.$ip2.$ip3.$ip4/$nm | cut -d "=" -f 2)
broadcast=$(ipcalc -b $ip1.$ip2.$ip3.$ip4/$nm | cut -d "=" -f 2)

a1=$(echo "$network" | cut -d "." -f 1)
a2=$(echo "$network" | cut -d "." -f 2)
a3=$(echo "$network" | cut -d "." -f 3)
a4=$[$(echo "$network" | cut -d "." -f 4) + 1]
b1=$(echo "$broadcast" | cut -d "." -f 1)
b2=$(echo "$broadcast" | cut -d "." -f 2)
b3=$(echo "$broadcast" | cut -d "." -f 3)
b4=$[$(echo "$broadcast" | cut -d "." -f 4) - 1]

echo "Scanning network $network/$nm..."
for c1 in $(seq $a1 $b1); do
  for c2 in $(seq $a2 $b2); do
    for c3 in $(seq $a3 $b3); do
      for c4 in $(seq $a4 $b4); do
        ping -nc 1 -w 1 $c1.$c2.$c3.$c4 > /dev/null
        if [ "$?" -eq 0 ]; then echo "$c1.$c2.$c3.$c4"; fi
      done
    done
  done
done



   []'s
   Fernando Lemes

----- Original Message ----- 
From: "cnclinux" <address@hidden>
To: <address@hidden>
Sent: Tuesday, November 11, 2003 3:06 PM
Subject: [shell-script] Script de autenticação velox Telemar MG


Boa tarde pessoal....
Estou com um problema no meu script de autenticação velox
telemar....a Telemar realizaou mudanças na forma de
autenticação.....caso alguém tenha este script atualizado me avise
por favor...
cnclinux



reply via email to

[Prev in Thread] Current Thread [Next in Thread]