When running snmpcheck, a SNMP enumeration tool found in Backtrack Linux, against Ubuntu 10.04 Lucid Lynx or Backtrack Linux it is likely you will receive some errors in the output. The errors occur when the running processes from the Linux server are enumerated. Below we show example output from the command when the errors are intact as well as a quick fix so you won’t have to modify the output for reports.
Perl Error When Running snmpcheck Against Backtrack Linux 5 R3:
- Use of uninitialized value within @runpath in concatenation (.) or string at ./snmpcheck-1.8.pl line 617.
The error is caused by the fact that the runpath or path the command was launched from is not available via SNMP. Without adding the fix below you can still easily find/replace the error line noted above however it is much nicer to have the clean output instead of the above error showing after each process is listed. I am not sure if the runpath information is available in different versions of snmpd, different Linux distributions, or how many other types of devices are effected by this but again the fix below simply suppresses the uninitialized errors from being output.
snmpcheck.pl Script Default Perl Lines 595 To 602:
- 595 } else{
- 596 # Other
- 597 my $processes = GetRequest($mibProcesses);
- 598 my @runindex = GetTable($mibRunIndex);
- 599 my @runname = GetTable($mibRunName);
- 600 my @runpath = GetTable($mibRunPath);
- 601 my @runtype = GetTable($mibRunType);
- 602 my @runstatus = GetTable($mibRunStatus);
snmpcheck.pl Script Updated Perl Lines 595 to 603:
- 595 } else{
- 596 no warnings 'uninitialized';
- 597 # Other
- 598 my $processes = GetRequest($mibProcesses);
- 599 my @runindex = GetTable($mibRunIndex);
- 600 my @runname = GetTable($mibRunName);
- 601 my @runpath = GetTable($mibRunPath);
- 602 my @runtype = GetTable($mibRunType);
- 603 my @runstatus = GetTable($mibRunStatus);
Notice the addition of line 596 which again simply does not display warnings for this section of the snmpcheck-1.8.pl Perl code. If anyone is aware of other devices where this throws a warning please leave a note in the comments below. Also I am far from a Perl whiz so if there is a better way to do this or there are any thoughts at all let us know in the comments below!