use strict; use LWP::Simple; use LWP::UserAgent; my %config = ( fw=>"IP_ADDRESS_OF_YOUR_WATCHGUARD", usr=>"administrator", pwd=>"ADMIN_PASSWORD" ); my $toadd; if (shift =~ /((\d{1,3}\.){3}\d{1,3}((-(\d{1,3}\.){3}\d{1,3})|\/\d{1,2 +})?)/){ $toadd = $1; }else { &showUsage; } sub showUsage{ die <<EOF Correct usage is as follows: newDeny.pl xxx.xxx.xxx.xxx newDeny.pl xxx.xxx.xxx.xxx-xxx.xxx.xxx.xxx newDeny.pl xxx.xxx.xxx.xxx/xx EOF } my @virginPage = split /\n/, get "http://$config{usr}:$config{pwd}\@$c +onfig{fw}/blksites.htm"; my @siteList; map { push @siteList, ($1) if /<option>((\d{1,3}\.){3}\d{1,3}((-(\d{1, +3}\.){3}\d{1,3})|\/\d{1,2})?)/i } @virginPage; push @siteList, ($toadd); my $postString = "result_ok=blksites.htm%3Fresult%3DOK&changed=1&refre +sh=0&count=". ($#siteList+1) . "&"; $postString .= join "", map {"siteList=$_&"} @siteList; $postString .= "addrType=blksites.htm%3FaddrType%3Dhost&addr=0.0.0.0&s +ubmitBtn=Submit"; my $ua = LWP::UserAgent->new; $ua->agent('Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CL +R 1.1.4322)'); my $req = HTTP::Request->new(POST => "http://$config{usr}:$config{pwd +}\@$config{fw}/blksites.htm"); $req->content_type('application/x-www-form-urlencoded'); $req->content($postString); my $res = $ua->request($req); print $res->as_string;
In reply to adding blocked sites to a watchguard soho 5 by c0s
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |