#!/usr/bin/perl
use Net::Telnet ();
$hostname=”1.2.3.4″; # Change this
$username=”xxxxx”; # Change this (normally ”admin”)
$passwd=”xxxxx”; # Change this
$enablepasswd=”your-enable-password”; # Change this
$prompt=”SG800-1>”; # This must be the same as your prompt
$t = new Net::Telnet (Errmode => ”return”, Timeout => 10, Prompt => ”/$prompt/”);
($x, $y) = $t->input_log($filename);
($x, $y) = $t->open(”$hostname”);
($x, $y) = $t->login($username, $passwd);
($x, $y) = $t->cmd(”enable”);
($x, $y) = $t->waitfor(’:’);
($x, $y) = $t->print(”$enablepasswd”);
$matchop = $t->prompt;
$prev = $t->prompt($matchop);
($a1, $a2) = $t->cmd(”upload configuration”);
($x, $y) = $t->cmd(”exit”);
$t->close($hostname);
Starta diskussion »
Skriv ett svar