Eikonal Blog

2010.03.23

Gathering information on a Unix system

Filed under: VA (Vulnerability Assessment) — Tags: , , , , , — sandokan65 @ 14:42
Test Linux AIX HP-UX
Hardware
ioscan -v
Kernel parameter information
kmtune -l
Network Configuration parameters
ndd -h supported
Network and routing tables.
netstat -in
netstat -rn
General machine information
uname -a
Raid Configuration
/sbin/irdiag -v
System Resources
sar -b <interval> <count>

Similar:

Tools


Sources:

kmtune.pl

Filed under: unix, VA (Vulnerability Assessment) — Tags: , — sandokan65 @ 14:30

kmtune.pl – a Perl script wrapping kmtune: http://forums2.itrc.hp.com/service/forums/getattachment.do?attachmentId=4902&ext=.txt. Author: H.Merijn Brand. (Source: http://forums13.itrc.hp.com/service/forums/questionanswer.do?admit=109447627+1269354030577+28353475&threadId=939626).

Local copy:

#!/pro/bin/perl -w

use strict;
use integer;

if (@ARGV) {
    local $" = '/i || m/';
    eval "sub pat { local \$_ = shift; m/@ARGV/i }";
    }
else {
    eval "sub pat { 1 }"
    }

my (%tune, %parm, $PARM, $parm, %ref);

open my $list, "kmtune -l |";
while () {
    s/\s+$//;
    my ($p, $v) = split m/:\s+/, $_, 2 or next;
    $v =~ s/\b0X([\dA-Fa-f]+)\b/0x\L$1/g;
    $p eq "Parameter" and $parm = $v, next;

    $tune{$parm}{$p} = $v;

    $p eq "Value" or next;
    if ($v =~ m/^-?(0x[\da-f]+|\d+)$/) {
	$parm{uc $parm} = 0 + $v =~ m/^-?0x/ ? hex $v : $v;
	}
    else {
	#printf STDERR "%-20s: '%s'\n", $p, $v;
	$ref{$parm} = $v;
	}
    }
close $list;

while (keys %ref) {
    foreach my $p (keys %ref) {
	my $up = uc $p;
	my $v  = $tune{$p}{Value};
	#my @r = (m/\b([A-Za-z]\w*)\b/g);
	my $x = 0;
	eval q(
	    $v =~ s/\b([A-Za-z]\w*)\b/exists$parm{uc $1}?$parm{uc $1}:do{$x++,$1}/ge;
	    );
	$x and next;
	eval "\$v = $v";
	$parm{$up} = $v;
	delete $ref{$p};
	}
    }

$= = 64;
foreach $parm (sort keys %tune) {
    $tune{$parm}{Default} eq $tune{$parm}{Value} and $tune{$parm}{Default} = "";
    $PARM = uc $parm;
    pat ("$parm $parm{$PARM} $tune{$parm}{Value} $tune{$parm}{Default}\n") and
	write;
    }

format STDOUT_TOP =
Parameter            Value hex    Value dec   Function                    Default
-------------------- ------------ ----------- --------------------------- --------------------
.
format STDOUT =
@<<<<<<<<<<<<<<<<<<>>>>>>>>>> @>>>>>>>>>> ^<<<<<<<<<<<<<<<<<<<<<<<<<< ^<<<<<<<<<<<<<<<<<<<
$parm,sprintf("0x%010x",$parm{$PARM}),$parm{$PARM},$tune{$parm}{Value},$tune{$parm}{Default}
~~                                            ^<<<<<<<<<<<<<<<<<<<<<<<<<< ^<<<<<<<<<<<<<<<<<<<
					      $tune{$parm}{Value},        $tune{$parm}{Default}
.

Blog at WordPress.com.