Cisco ASA 5505 User Manual

Page 1848

Advertising
background image

81-14

Cisco ASA 5500 Series Configuration Guide using the CLI

Chapter 81 Managing Software and Configurations

Backing Up Configuration Files or Other Files

$cli=“copy /noconfirm dap.xml $storage/$prompt-$date-dap.xml”;

$ocli=“copy /noconfirm $storage/$prompt-$date-dap.xml disk0:/dap.xml”;

print “$cli\n”;

print OUT “$ocli\n”;

$obj->send(“$cli\n”);

$obj->expect(15, “$prompt#” );

}

sub csd {

$obj = shift;

$obj->clear_accum();

$obj->send(“dir sdesktop\n”);

$obj->expect(15, “$prompt#” );

$output = $obj->before();

return 0 if($output =~ /Error/);

$cli=“copy /noconfirm sdesktop/data.xml $storage/$prompt-$date-data.xml”;

$ocli=“copy /noconfirm $storage/$prompt-$date-data.xml disk0:/sdesktop/data.xml”;

print “$cli\n”;

print OUT “$ocli\n”;

$obj->send(“$cli\n”);

$obj->expect(15, “$prompt#” );

}

sub webcontent {

$obj = shift;

$obj->clear_accum();

$obj->send(“show import webvpn webcontent\n”);

$obj->expect(15, “$prompt#” );

$output = $obj->before();

@items = split(/\n+/, $output);

for (@items) {

s/^\s+//;

s/\s+$//;

next if /show import/ or /No custom/;

next unless (/^.+\s+.+$/);

($url, $type) = split(/\s+/,$_);

$turl = $url;

$turl =~ s/\/\+//;

$turl =~ s/\+\//-/;

$cli = “export webvpn webcontent $url $storage/$prompt-$date-$turl”;

$ocli = $cli;

$ocli =~ s/^export/import/;

print “$cli\n”;

print OUT “$ocli\n”;

$obj->send(“$cli\n”);

$obj->expect(15, “$prompt#” );

}

}

sub login {

$obj = shift;

$obj->raw_pty(1);

$obj->log_stdout(0); #turn off console logging.

$obj->spawn(“/usr/bin/ssh $user\@$asa”) or die “can't spawn ssh\n”;

unless ($obj->expect(15, “password:” )) {

die “timeout waiting for password:\n”;

}

$obj->send(“$password\n”);

Advertising