hotsanic |
Subversion Repositories: |
Compare with Previous - Blame - Download
package HotSaNICmod::common;
sub version {
($VERSION = '$Revision: 1.6 $') =~ s/.*(\d+\.\d+).*/$1/;
return "common.pm $VERSION";
}
sub configure {
my %MODCONF=HotSaNICparser::get_moduleconfig(".",(IPTABLES=>"var",INTIF=>"var",EXTIF=>"var",DEVINT=>"array",DEVEXT=>"array",STYLE=>"var"));
if ($MODCONF{IPTABLES} eq "") { $MODCONF{IPTABLES}=get_netfilter(); }
if ($MODCONF{STYLE} ne "") { $MODCONF{GRAPH_BASE}=$MODCONF{STYLE}; }
(my $extif=$MODCONF{EXTIF}) =~ s/,/ /g;
(my $intif=$MODCONF{INTIF}) =~ s/,/ /g;
foreach (@{$MODCONF{DEVEXT}}) { push @{$MODCONF{DEV}},"ext,$extif,$_"; }
foreach (@{$MODCONF{DEVINT}}) { push @{$MODCONF{DEV}},"int,$intif,$_"; }
return %MODCONF;
}
sub get_netfilter {
my @list=grep /iptables$/,HotSaNICparser::locate_files("bin/iptables");
if (! @list) { @list=grep /ipchains$/,HotSaNICparser::locate_files("bin/ipchains"); }
my $CMD=shift @list;
return $CMD;
}
sub get_names {
my $entry=shift || ",";
my $host="";
my $community="";
my ($side,$interfaces,$item,$description)=split /,/,$entry;
$name=$item;
($dbname="$side$name") =~ s/\//_/g;
$file=$dbname;
return ($host,$community,$item,$dbname,$name,$file,$description);
}
1;