Wednesday, February 3, 2010

Perl Sample for Ticket

1, T1180
#!/usr/bin/perl -w
print "$#ARGV\n";

if ($#ARGV != 2) {
print "Usage: gen50phase.pl phase1 src dst\n";
exit;
}
print "$ARGV[0]\n";
print "$ARGV[1]\n";
print "$ARGV[2]\n";

open (PHASE2, ">50phase2.txt");
print PHASE2 "config vpn ipse phase2-interface\n";
for ($i=1; $i<51;$i++) {
print PHASE2 "edit a10.1.1.$i\n";
print PHASE2 "set keepalive enable\n";
print PHASE2 "set phase1name $ARGV[0]\n";
print PHASE2 "proposal aes128-sha1\n";
print PHASE2 "set replay disable\n";
print PHASE2 "set dst-subnet $ARGV[2].$i 255.255.255.255\n";
print PHASE2 "set src-subnet $ARGV[1].$i 255.255.255.255\n";
print PHASE2 "next\n";
}
print PHASE2 "end\n";
close (PHASE2);

No comments: