Automatic Virgin Superhub 1/2 Router Reboot Perl Script

Here is a quick Perl Script we have created to automatically reboot a Virgin Superhub 1 and Superhub 2 Router.

You require Mechanize to run this script successfully.

 

Steps

1: Make sure you have the Perl WWW::Mechanize Module installed.

     For Debian distributions you can use the following command to install Mechanize

sudo apt-get install libwww-mechanize-perl

2: Open a text editor such as vim or nano and copy the following script into it.

use WWW::Mechanize;
my $mech = WWW::Mechanize->new( autocheck => 0);
#login
$url="http://@ARGV[0]";
$mech->get( $url );
$mech->form_name('VmLogin');
$mech->field("VmLoginUsername","@ARGV[1]");
$mech->field("VmLoginPassword","@ARGV[2]");
$mech->submit_form(); #get settings page and reboot $url = "http://@ARGV[0]/VmRgRebootRestoreDevice.asp";
$mech->get( $url );
$mech->form_id("VmRgRebootRestoreDevice");
$mech->field("VmDeviceRestore",'0');
$mech->field("VmDeviceReboot",'1');
$mech->submit_form(); exit;

3: Save the script in the perl format using the name "scriptname".pl

4: To call the script in the command line use the following command

perl "scriptname" "ip of router" "username"  "password"

 

 

IT Support Contracts

Support contracts to cover all your IT and Telecoms with UK wide free call-out. Our friendly support staff provide on-site, telephone, email and remote support for workstations, servers and phone systems. We offer full Linux support as well as Apple and Microsoft.

 

Linux Business Servers

Linux servers to suit every requirement from drop-in Microsoft replacements to advanced firewalls, high availability, thin client servers and virtualisation. Our SME Business Server product provides your business with an IT solution taking care of networking, security, storage, email, backup, remote access and much more.

 

Distro Support Includes

  • Elastix / Issabel / FreePBX
  • RedHat / CentOS / Scientific
  • Koozali / smeserver / SUSE
  • Solaris / Unux / BSD
  • Debian / Ubuntu / Linux Mint
  • Arch / Archbang / Gentoo
  • Fedora / Kubuntu / Xubuntu
  • Raspbian / Embedded Systems

Ubuntu Server & Desktop

Pre-configured Ubuntu server, desktop and thin client systems to suit your requirements. We offer drop-in Microsoft Server replacements and even migrate your existing Microsoft server or desktops and keep the applications you need.