#!/usr/bin/perl #Copyright 2007 Issac Goldstand # #Licensed under the Apache License, Version 2.0 (the "License"); #you may not use this file except in compliance with the License. #You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # #Unless required by applicable law or agreed to in writing, software #distributed under the License is distributed on an "AS IS" BASIS, #WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #See the License for the specific language governing permissions and #limitations under the License. # NOTE: Before using change IP address and expert password to fit your modem # See http://www.dslreports.com/forum/remark,6450609~root=canbroadband # See http://www.forpage.com/forum/viewtopic.php?topic=327&forum=19&33 use Net::Telnet; use strict; use warnings; my $IP="10.0.0.138"; # IP address of modem my $EXPERT="1391106571"; # Expert password access print "Connecting to $IP...\n"; my $t = Net::Telnet->new; #$t->input_log("alcatel.log"); # Uncomment to enable lgging of the telnet session $t->open($IP); $t->waitfor("/User :/"); $t->print(""); $t->waitfor("/=>/"); $t->print(":td prompt"); $t->waitfor("/Password :/"); $t->print($EXPERT); $t->waitfor("/>/"); $t->prompt("/dbg>/"); $t->cmd("dbg"); print "Connected!\n"; my $i=0x0; my $go =1; while ($go) { printf("Scanning 0x%x...\n", $i) if ($i % 128 == 0); my $hex = sprintf("%x", $i); my @lines = $t->cmd("dm $hex"); while ($_ = shift @lines) { print $_ if /active/; } $i+=5; # repeat with an offset of 5 bytes in case the match string was spread across 2 lines $hex = sprintf("%x", $i); @lines = $t->cmd("dm $hex"); while ($_ = shift @lines) { print $_ if /active/; } $i+=75; $go=0 if $i>=32768; # loop until 0x8000 } print "Done!\n"; $t->close;