i got sick of having to access my soho via my browser just to add a bunch of sites that i want to block (for fighting spam and the spread of desease) so threw together this script. let me know if there is anyway that i can optimize and/or make it prettier :)
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;
c0s

In reply to adding blocked sites to a watchguard soho 5 by c0s

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.