Versions used on cable modem network

From D3xt3r01.tk
Jump to navigationJump to search

WHY

I need to upgrade the software version used on most of the modems so I first need to know what's out there. Here's what I did to find out

HOW

I'll get the version via snmp from the modems using this OID which should be available on most modems:

 .1.3.6.1.2.1.1.1.0 ( sysDescr.0 )

I'll use BRAA to get the info fast from all the network using this script.

Note: I have modems on 10.0.0.0/21, 10.10.0.0/21, 10.200.0.0/21, 10.210.0.0/21 so feel free to modify to suit your needs !

#!/bin/bash

for i in {0,10,200,210} ; do
        for j in `seq 0 9`; do
                echo "Doing 10.$i.$j.0-255 now"
                braa -d 50 public@10.$i.$j.0-10.$i.$j.255:161:.1.3.6.1.2.1.1.1.0
        done
done

After running the script redirecting the output to a file .. I run this script to identify the versions and model name ( I'm using php since it's easier to parse strings ):

#!/usr/local/bin/php -f
<?php

if(!isset($argv[1]) || empty($argv[1])){
        die("Usage is ".$argv[0]." input_file\n");
}
if(!is_file($argv[1])){
        die($argv[1]." isn't a file.");
}
$file = file_get_contents($argv[1]);
$file = explode("\n", $file);
foreach($file as $line){
        if(stristr($line, 'arris')){
                preg_match('|([0-9.]+?):([0-9]+?)ms:.1.3.6.1.2.1.1.1.0:([a-zA-Z0-9]+?) CM ([a-zA-Z0-9]+?) Cable Modem serial no\. ([0-9]+?), HW_Version ([0-9.\(\)\s]+?), SW_Version ([A-Z0-9.]+?), Bootloader_ver ([0-9.]+?), OS: ([A-Z0-9\s.]*)|is', $line, $out);
                if($out[3] == "Arris"){
                        $arris[$out[4]][$out[7]][$out[8]][$out[6]]++;
                }else{
                        echo "There's a problem here: ".$line."\n";
                }
        }else if(stristr($line, 'motorola')){
                preg_match('|([0-9.]+?):([0-9]+?)ms:.1.3.6.1.2.1.1.1.0:<<HW_REV: ([0-9.]+?); VENDOR: ([a-zA-Z0-9\s]+?); BOOTR: ([a-zA-Z0-9.]+?); SW_REV: ([a-zA-Z0-9\-.]+?); MODEL: ([a-zA-Z0-9.]+?)>>|is', $line, $out);
                if($out[4] == "Motorola Corporation"){
                        $motorola[$out[7]][$out[6]][$out[5]][$out[3]]++;
                }else{
                        echo "There's a problem here: ".$line."\n";
                }
        }else if(stristr($line, 'thomson')){
                if(strstr($line, "E-MTA")){
                        preg_match('|([0-9.]+?):([0-9]+?)ms:.1.3.6.1.2.1.1.1.0:([a-zA-Z0-9\-\s]+?) <<HW_REV: ([0-9.]+?); VENDOR: ([a-zA-Z0-9\s]+?); BOOTR: ([a-zA-Z0-9.]+?); SW_REV: ([a-zA-Z0-9\-.]+?); MODEL: ([a-zA-Z0-9.]+?)>>|is', $line, $out);
                        if($out[5] == "Thomson" && $out[3] == "Thomson PacketCable E-MTA"){
                                $thomson[$out[8]][$out[7]][$out[6]][$out[4]]++;
                        }else{
                                echo "There's a problem here: ".$line."\n";
                        }
                }else{
                        preg_match('|([0-9.]+?):([0-9]+?)ms:.1.3.6.1.2.1.1.1.0:([a-zA-Z0-9\s]+?) <<HW_REV: ([0-9.]+?); VENDOR: ([a-zA-Z0-9\s]+?); BOOTR: ([a-zA-Z0-9.]+?); SW_REV: ([a-zA-Z0-9\-.]+?); MODEL: ([a-zA-Z0-9.]+?)>>|is', $line, $out);
                        if($out[5] == "Thomson" && $out[3] == "Thomson DOCSIS Cable Modem"){
                                $thomson[$out[8]][$out[7]][$out[6]][$out[4]]++;
                        }else{
                                echo "There's a problem here: ".$line."\n";
                        }
                }
        }else{
//              echo $line."\n";
        }
}
echo "ARRIS\n\n";
print_r($arris);
echo "MOTOROLA\n\n";
print_r($motorola);
echo "THOMSON\n\n";
print_r($thomson);
?>

Hope this helps you upgrade.