NAME

Net::SinFP3::Global - global configuration and useful methods for all objects

SYNOPSIS

use Net::SinFP3::Global;

my $global = Net::SinFP3::Global->new(
   log => $log,
);

DESCRIPTION

This is nearly the first object to create when you want to use Net::SinFP3 framework. This object is given to every other objects (manually or automatically) and serves as parameter bridging between all of them.

This object also gives access to useful methods that plugins may use.

ATTRIBUTES

log (Net::SinFP3::Log)

Will contain a Net::SinFP3::Log object.

job ($scalar)

This is the current job ID in the context of running process.

next (Net::SinFP3::Next)

This is the current Net::SinFP3::Next in the context of running process.

input (Net::SinFP3::Input)

This is the current Net::SinFP3::Input in the context of running process.

db (Net::SinFP3::DB)

This is the current Net::SinFP3::DB in the context of running process.

mode (Net::SinFP3::Mode)

This is the current Net::SinFP3::Mode in the context of running process.

search (Net::SinFP3::Search)

This is the current Net::SinFP3::Search in the context of running process.

output (Net::SinFP3::Output)

This is the current Net::SinFP3::Output in the context of running process.

target ($scalar)

The target is either an IPv4 address, an IPv6 address or a hostname. Device information will be gathered by using this value (if provided).

ipv6 ($scalar)

Use IPv6 mode globally or not (default to not).

jobs ($scalar)

The maximum number of jobs to do in parallel (default to 10).

dnsReverse ($scalar)

Do reverse DNS lookups or not (default to not).

worker ($scalar)

Specify which worker model you want to use. This is either 'fork' or 'thread' currently (default to 'fork').

device ($scalar)

Network device to use (default to auto-discovered).

retry ($scalar)

The number of retry to perform on actions requiring such thing (default to 3).

timeout ($scalar)

The number of seconds before timing out on actions requiring such thing (default to 3).

ip ($scalar)

My IPv4 address (default to auto-discovered).

ip6 ($scalar)

My IPv6 address (default to auto-discovered).

mac ($scalar)

My MAC address (default to auto-discovered).

subnet ($scalar)

My subnetwork address (default to auto-discovered).

gatewayIp ($scalar)

My gateway IPv4 address (default to auto-discovered).

gatewayIp6 ($scalar)

My gateway IPv6 address (default to auto-discovered).

gatewayMac ($scalar)

My gateway MAC address (default to auto-discovered).

result ([ Net::SinFP3::Result, ... ])

This attribute will be set by the currently running Net::SinFP3::Search plugin after it has been run.

METHODS

All these methods print a warning and return undef on failure.

new (%hash)

Object contructor. You must give it the following attributes: log. All device related thingies will be automatically found. If you don't want this behaviour, you can manually specify attributes within this object constructor.

expandSubnet (subnet => $scalar)

Takes a subnet string in CIDR format (192.168.0/24) and returns an arrayref of IPv4 addresses.

expandPorts (ports => $scalar)

Takes a ports string and returns an arrayref of unique ports. The format is using ',' and '-' characters. Examples: '1-65535' or '80,443' or '1-1024,8000'. You can also specify either one of top10, top100, top1000 or all ports to respectively scan top 10, 100, 1000 or all ports on the target.

expandFiles (files => $scalar)

Takes a string that will feed a glob function in order to return an arrayref of files.

lookupMac (ip => $scalar)

Will return the MAC address of the target IPv4 host, or the MAC address of the IPv4 gateway.

lookupMac6 (ipv6 => $scalar)

Will return the MAC address of the target IPv6 host, or the MAC address of the IPv6 gateway.

getHostAddr (host => $scalar)

Tries to resolve the IP address of the target host. It will use ipv6 attribute to resolve in IPv6 or IPv4 mode.

intToIp (ip => $scalar)

Converts an IP address in presentation notation to numerical notation.

ipToInt (int => $scalar)

Converts an IP address in numerical notation to presentation notation.

getAddrReverse (addr => $scalar)

Tries to do a reverse lookup of the target host. It will use ipv6 attribute to resolve in IPv6 or IPv4 mode.

getDumpOnline (%hash)

Will return a Net::Frame::Dump::Online2 object. See that module to know which attributes you can provide in the hash.

getDumpOffline (file => $scalar, %hash)

Will return a Net::Frame::Dump::Offline object. See that module to know which attributes you can provide in the hash. You must at list provide the file attribute.

getDumpWriter (%hash)

Will return a Net::Frame::Dump::Writer object. See that module to know which attributes you can provide in the hash.

getWriteL2 ()

Will return a Net::Write::Layer2 object. It will use the device attribute to know which layer 2 link to use.

getWriteL3 (dst => $scalar)

Will return a Net::Write::Layer3 object. It will use dst attribute to know which interface to use.

getWrite (%hash)

Will return a Net::Write::Layer3 or Net::Write::Layer2 object depending on the value of ipv6 attribute.

tcpConnect (ip => $scalar, port => $scalar)

Will try to connect to the remote host.

AUTHOR

Patrice <GomoR> Auffret

COPYRIGHT AND LICENSE

Copyright (c) 2011-2018, Patrice <GomoR> Auffret

You may distribute this module under the terms of the Artistic license. See LICENSE.Artistic file in the source distribution archive.