1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
while ( $x < @adIP ) # @adIP contient X.X.X.X X.X.X.X
{
$new_ip = $adIP[$x]; #$adIP contient X.X.X.X
print ("$new_ip\n");
while ( $z < @switchs_database ) #@switchs_database contient 4 lignes avec nom, IP, login, mdp
{
if ( $new_ip eq $switchs_database[$z][1] ) #je compare X.X.X.X d'audessus avec le contenue de la colone 1 du tableau
{
$switch_name = $switchs_database[$z]->[0];
$switch_ip = $switchs_database[$z]->[1];
$user_login = $switchs_database[$z]->[2];
$user_password = $switchs_database[$z]->[3];
print ("RECHERCHE SUR LE SWITCH : $switch_name \t $switch_ip\n");
($telnet_session) = &connexion($switch_name,$switch_ip,$user_login,$user_password);
($port_found, @find_tab) = &search($switch_name,$switch_ip,$user_login,$user_password,$telnet_session);
&print_result($switch_name,$switch_ip,$user_login,$user_password,$port_found,$telnet_session);
&deconnexion($telnet_session, $switch_name, $switch_ip);
}
else
{
&print_error("L'IP: $new_ip, n'est pas un switch\n"); # si l'ip existe pas dans le tableau switchs_database alors msg d'erreur!!!
}
$z++;
}
$x++;
} |
Partager