#!/usr/bin/perl -w ######################################################################## # Get External IP address of Netgear router ################################################# use strict; use warnings; use LWP::UserAgent; use Data::Dumper; #use HTML::TableContentParser; use Getopt::Long; my $host=""; my $user=""; my $password=""; my $addr = ""; my $port=80; my $Netgear_Page = "s_status.htm"; # Netgear Router status my $Linksys_Page = "Status_Router.asp"; my $result=GetOptions( "host=s" => \$host, "user=s" => \$user, "password=s" => \$password, "ipaddress=s" => \$addr, "port=i" => \$port ); my $ua=LWP::UserAgent -> new(); if ($host){ }else{ for (qx/ipconfig/){ m/^\s+Default Gateway\D+([\d|\.]+)/ and $host=$1 }; } barf_and_complain() unless ( $host and $user and $password ); my $host_settings=sprintf("%s:%d",$host,$port); my $url = sprintf("http://%s:%d/$Netgear_Page",$host,$port); my $req = HTTP::Request->new(GET => $url); $req->authorization_basic($user, $password); my $content = $ua->request($req)->as_string; ##print "----Content--\n$content-----\n"; while ($content=~m/