Config.pm -- P.A.T.H Configuration SYNOPSIS use config; use Getopt::Std; getopts('h:c:p:i:',%args); $cfg = config->new(); $cfg->check(%args); if($cfg->connection) { @connect = $cfg->connection; print "Connection $connection[0] <--> $connection[1]\n"; } if($cfg->multiport) { @ports = $cfg->get_port; print "Ports: "; for(@ports) { print; } print "\n"; } DESCRIPTION This module checks the configuration for P.A.T.H. scripts. It parses the parameter like host (lists,ranges), connections, port (lists,ranges) and device. You can set and get config parameters. This module can also read and parse a configuration file. new check print get_device get_target get_source get_connection get_port get_flags get_ipopt get_tcpopt get_udpopt get_icmpopt get_opt set_flags set_ipopt set_tcpopt set_udpopt set_cmpopt set_opt set_device set_target set_source set_connection set_port multiport multitarget multisource target source port connection pcap readcfg register_config Description of methods new() $cfg = config->new() This creates a new config object. check() $cfg->check(%args); This method parses and checks the parameter in the hash %args. %args can contain the following things: i: device c: connection (target1-target2) h: host (list: host1,host2 // range host1-host3) p: port (list or range) print() $cfg->print(); This will print the configuration to STDOUT. get_device() $cfg->get_device This method returns the configured device. All the other get_* methods do the same. set_device() $cfg->set_device("eth1"); This method changes the device configuration and returns the new object. All teh other set_* methods are used similar and do the same. set_opt $cfg->set_opt(%config); This method sets the packet options like TCP flags, window size and so on. There is also a set_* method for each supported protocol. See the section configuration hash for a description of the hash %config. get_opt %config = $cfg->get_opt(); This method can be used to receive all the packet option from the config object. There is also a get_* method for each supported protcol. See the section configuration hash for a description of the hash %config. multitarget() $cfg->multitarget; This method will return the boolean value true if the configuration contains more than one host. The multisource and multiport method is used the same way. connection() $cfg->connection; This method return the boolean value true if a connection is found in the configuration. The port and host method are used the same way. pcap() $string = $cfg->pcap(); Create a pcap expression from the configuration like: host 192.168.1.1 and port 23 or port 21 readcfg() %config = config::readcfg($opt,$file); This function will parse a config file like this: parameter == value opt: a - Function return an array h - Function returns a hash (default) file: Contains the path to the config file. register_config() $cfg->register_config(%config); This method stores the default values like target and device into the config object. The configuration hash The configuration hash has the following values (depeding on which protocol should be configured): $opts{'protocol'} $opts{'spoof'} $opts{'target'} $opts{'frag'} $opts{'ttl'} $opts{tos} $opts{'src_port'} $opts{'dst_port'} $opts{'syn'} $opts{'ack'} $opts{'rst'} $opts{'fin'} $opts{'psh'} $opts{'urg'} $opts{'seq'} $opts{'ack_seq'} $opts{'win'} $opts{'data'} $opts{'type'} $opts{'code'} $opts{'gateway'} $opts{'mtu'} BUGS Currently there are no known bugs... Please send bug reports to bugs@crazydj.de AUTHOR Bastian Ballmann [ bytebeater@crazydj.de ] http://www.crazydj.de COPYRIGHT This module is free software. It is licensed under GPL.