#!/usr/bin/perl use strict; use warnings; use Net::SNMP; my $i=@ARGV; die "\nZu wenige Parameter!\n\nStartTftpDownload.pl \n Source 1: networkFile 3: startupConfig 4: runningConfig Destination 1: networkFile 3: startupConfig 4: runningConfig Example C:\\>StartTftpDownload.pl 172.23.210.151 172.23.210.222 5NMP-Wr1t3-(0mm 1 4 getit.conf " if $i<6; print "\n"; my $ROUT = $ARGV[0]; my $TFTP = $ARGV[1]; my $COMM = $ARGV[2]; my $SOUR = $ARGV[3]; my $DEST = $ARGV[4]; my $FILE = $ARGV[5]; my ($session, $error) = Net::SNMP->session( -hostname => $ROUT, -version => 'snmpv2', -community => $COMM, ); if (!defined $session) { printf "ERROR: %s.\n", $error; exit 1; } my $SES=".123"; my $OID="1.3.6.1.4.1.9.9.96.1.1.1.1.2" . $SES; $session->set_request(-varbindlist => [ $OID, INTEGER, '1' ], ); #The ConfigCopyProtocol is set to TFTP $OID="1.3.6.1.4.1.9.9.96.1.1.1.1.3" . $SES; $session->set_request(-varbindlist => [ $OID, INTEGER, $SOUR ], ); #Set the SourceFileType to networkfile #running-config $OID="1.3.6.1.4.1.9.9.96.1.1.1.1.4" . $SES; $session->set_request(-varbindlist => [ $OID, INTEGER, $DEST ], ); #Set the DestinationFileType to running-config #networkfile $OID="1.3.6.1.4.1.9.9.96.1.1.1.1.5" . $SES; $session->set_request(-varbindlist => [ $OID, IPADDRESS, $TFTP ], ); #Sets the ServerAddress to the IP address of the TFTP server $OID="1.3.6.1.4.1.9.9.96.1.1.1.1.6" . $SES; $session->set_request(-varbindlist => [ $OID, OCTET_STRING, $FILE ], ); #Sets the CopyFilename to your desired file name. $OID="1.3.6.1.4.1.9.9.96.1.1.1.1.14" . $SES; $session->set_request(-varbindlist => [ $OID, INTEGER, '1' ], ); #Sets the CopyStatus to active which starts the copy process. $OID="1.3.6.1.4.1.9.9.96.1.1.1.1.14" . $SES; $session->set_request(-varbindlist => [ $OID, INTEGER, '6' ], ); #Sets the CopyStatus to delete which cleans all saved informations out of the MIB exit;