jablonka.czprosek.czf

hotsanic

Subversion Repositories:
[/] [branches/] [HotSaNIC-0.5.0-pre6/] [modules/] [worms/] [platform/] [common.pm] - Rev 24 Go to most recent revision

Compare with Previous - Blame - Download


package HotSaNICmod::common;

sub version {
  ($VERSION = '$Revision: 1.5 $') =~ s/.*(\d+\.\d+).*/$1/;
  return "common.pm $VERSION";
  }      

sub configure {
  my %MODCONF=HotSaNICparser::get_moduleconfig(".",("ITEM"=>"array",INTERVAL=>"var",LOGPATH=>"var",LOGNAME=>"var"));

  if ($MODCONF{LOGNAME} eq "") {
    @dummy=split /\//,$MODCONF{LOGPATH};
    $MODCONF{LOGNAME}=pop @dummy;      
    $MODCONF{LOGPATH}=join "/",@dummy;      
    }
  if (! @{$MODCONF{ITEM}}) { @{$MODCONF{ITEM}}=("default.ida,CodeRed","cmd.exe,Nimda","root.exe,Nimda"); }
  foreach (@{$MODCONF{ITEM}}) { $_ =~ s/:/,/g; }
  return %MODCONF;
  }

sub get_names {
  my $entry=shift || ",";

  my $host="";
  my $community="";

  my ($item,$description)=split /,/,$entry;
  if( index($item, "SNMP:") >= 0) { (undef,$host,$community,$item,$num) = split /:/,$item; }
  if (defined $num) { $item = "$item:$num"; }
  if ($host ne "") { $name="$host:$item"; }
  else { $name=$item; }
  ($dbname=$name) =~ s/:/_/g;
  ($file=$name) =~ s/[.:]/_/g;

  return ($host,$community,$item,$dbname,$name,$file,$description,$maxin,$maxout);
  }
1;


Powered by WebSVN 2.2.1