Logging into airbears through the browser each time my laptop connects is a pain. This script made it less painful:
#!/usr/bin/perl -w
use strict;
$|++;
use File::Basename;
use WWW::Mechanize 0.72;
my $mech = WWW::Mechanize->new( );
$mech->get( "https://wireless-gw1.berkeley.edu/logon" );
$mech->success() or die "Couldn't connect to wireless login page",
$mech->response->status_line;
# Select the form, fill the fields, and submit
$mech->form_name( "logonForm" );
$mech->set_visible([text=>"username"],[password=>"password"]);
$mech->click("logon_action");
$mech->success or die "Wireless login didn't seem to work.:",
$mech->response->status_line;
print "Logged onto Airbears.\n";
I needed to install the libwww-mechanize-formfiller perl package before it ran:
sudo apt-get install libwww-mechanize-formfiller-perl
Yoinked and (slightly) corrected from Yossi Farjoun.
Comments
is storing your login in plain text such a good idea?
Posted 05 May 2009 at 11:56 AM ¶It depends on how secure you keep your machine. If you allow others unsupervised access to your desktop, or are not certain of the network security on your machine, or have an unencrypted hard drive, then no of course not.
If, however, you keep your desktop locked down, set appropriate permissions for the file, are careful with your passwords, run an encrypted disk, and are generally aware, it’s not worse than storing passwords in firefox.
That said, it would be extremely awesome to have some more rational form of authentication with the network… How about SSH keys?
Posted 05 May 2009 at 12:03 PM ¶That story is so good i think the like when they are on his bed room and read it and enjoyed is
Posted 10 Aug 2009 at 1:55 AM ¶Post a Comment