Plugintools added ip2long & long2ip
Former-commit-id: 5c5f9589a32947ce2d9a725e504661a11c8311ee
This commit is contained in:
parent
bd0aa4ea8a
commit
f77373aa1d
|
@ -18,7 +18,7 @@ use warnings;
|
||||||
use LWP::UserAgent;
|
use LWP::UserAgent;
|
||||||
use HTTP::Cookies;
|
use HTTP::Cookies;
|
||||||
use HTTP::Request::Common;
|
use HTTP::Request::Common;
|
||||||
|
use Socket qw(inet_ntoa inet_aton);
|
||||||
use File::Copy;
|
use File::Copy;
|
||||||
use Scalar::Util qw(looks_like_number);
|
use Scalar::Util qw(looks_like_number);
|
||||||
use Time::HiRes qw(time);
|
use Time::HiRes qw(time);
|
||||||
|
@ -40,6 +40,8 @@ our %EXPORT_TAGS = ( 'all' => [ qw() ] );
|
||||||
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
|
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
|
||||||
|
|
||||||
our @EXPORT = qw(
|
our @EXPORT = qw(
|
||||||
|
__ip_to_long
|
||||||
|
__long_to_ip
|
||||||
api_available
|
api_available
|
||||||
api_call
|
api_call
|
||||||
api_create_custom_field
|
api_create_custom_field
|
||||||
|
@ -128,6 +130,22 @@ sub check_lib_version {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# Returns IP address(v4) in longint format
|
||||||
|
###############################################################################
|
||||||
|
sub __ip_to_long {
|
||||||
|
my $ip_str = shift;
|
||||||
|
return unpack "N", inet_aton($ip_str);
|
||||||
|
}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# Returns IP address(v4) in longint format
|
||||||
|
###############################################################################
|
||||||
|
sub __long_to_ip {
|
||||||
|
my $ip_long = shift;
|
||||||
|
return inet_ntoa pack("N", ($ip_long));
|
||||||
|
}
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Convert CSV string to hash
|
# Convert CSV string to hash
|
||||||
################################################################################
|
################################################################################
|
||||||
|
@ -491,7 +509,11 @@ sub print_agent {
|
||||||
|
|
||||||
if (ref($modules_def) eq "ARRAY") {
|
if (ref($modules_def) eq "ARRAY") {
|
||||||
foreach my $module (@{$modules_def}) {
|
foreach my $module (@{$modules_def}) {
|
||||||
|
if (ref($module) eq "HASH" && (defined $module->{'name'})) {
|
||||||
$xml .= print_module($config, $module,1);
|
$xml .= print_module($config, $module,1);
|
||||||
|
} elsif (ref($module) eq "HASH" && (defined $module->{'discovery'})) {
|
||||||
|
$xml .= print_discovery_module($config, $module,1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} elsif (ref($modules_def) eq "HASH" && (defined $modules_def->{'name'})) {
|
} elsif (ref($modules_def) eq "HASH" && (defined $modules_def->{'name'})) {
|
||||||
$xml .= print_module($config, $modules_def,1);
|
$xml .= print_module($config, $modules_def,1);
|
||||||
|
|
Loading…
Reference in New Issue