id = $int_ID; $this->tgt_id = $int_TGT_ID; $this->name = $str_Name; $this->ipv4 = $str_Ipv4; $this->ipv6 = $str_Ipv6; $this->hostname = $str_Hostname; $this->fqdn = $str_FQDN; $this->description = $str_Description; } /** * Getter function for interface ID * * @return integer */ public function get_ID() { return $this->id; } /** * Setter function for interface ID * * @param interface $int_id_in */ public function set_ID($int_id_in) { $this->id = $int_id_in; } /** * Getter function for target ID * * @return integer */ public function get_TGT_ID() { return $this->tgt_id; } /** * Setter function for the target id * * @param integer $int_tgt_id_in */ public function set_TGT_ID($int_tgt_id_in) { $this->tgt_id = $int_tgt_id_in; } /** * Getter function for interface name * * @return string */ public function get_Name() { return $this->name; } /** * Setter function for interface name * * @param string $str_Name */ public function set_Name($str_Name) { $this->name = $str_Name; } /** * Getter function for the interface MAC * * @return string */ public function get_MAC() { return $this->mac; } /** * Setter function for the interface MAC * * @param string $mac */ public function set_MAC($mac) { $this->mac = $mac; } /** * Getter function for interface IPv4 address * * @return string */ public function get_IPv4() { return $this->ipv4; } /** * Setter function for interface IPv4 address * * @param string $str_Ipv4 */ public function set_IPv4($str_Ipv4) { $this->ipv4 = $str_Ipv4; } /** * Getter function for interface IPv6 address * * @return string */ public function get_IPv6() { return $this->ipv6; } /** * Setter function for interface IPv6 address * * @param string $str_Ipv6 */ public function set_IPv6($str_Ipv6) { $this->ipv6 = $str_Ipv6; } /** * Getter function for hostname * * @return string */ public function get_Hostname() { return $this->hostname; } /** * Setter function for hostname * * @param string $str_Hostname */ public function set_Hostname($str_Hostname) { $this->hostname = $str_Hostname; } /** * Getter function for TCP ports * * @return array:tcp_ports */ public function get_TCP_Ports() { return $this->tcp_ports; } /** * Return a TCP Port object of a specific port * * @param integer $port_number * * @return NULL|tcp_ports */ public function get_TCP_Port_By_Port_Number($port_number) { return isset($this->tcp_ports[$port_number]) ? $this->tcp_ports[$port_number] : null; } /** * Function to check and see if a TCP port is open * * @param int $port_number * * @return boolean */ public function is_TCP_Port_Open($port_number) { return isset($this->tcp_ports[$port_number]); } /** * Update a specific tcp port * * @param tcp_ports $tcp_port */ public function update_TCP_Port($tcp_port) { if (isset($this->tcp_ports[$tcp_port->get_Port()])) { // Get pointer to current port by reference so updates persist upon return $cur_port = &$this->tcp_ports[$tcp_port->get_Port()]; // Get current and new port banner and notes to determine if we need to update. $cur_banner = $cur_port->get_Banner(); $cur_notes = $cur_port->get_Notes(); $new_banner = $tcp_port->get_Banner(); $new_notes = $tcp_port->get_Notes(); // Only update banner if new banner is not already in current banner if (!empty($new_banner) && strpos($cur_banner, $new_banner) === false) { $cur_port->set_Banner($tcp_port->get_Banner()); } // Only update notes if new notes is not already in current notes if (!empty($new_notes) && strpos($cur_notes, $new_notes) === false) { $cur_port->append_Notes($tcp_port->get_Notes()); } } else { $this->tcp_ports[$tcp_port->get_Port()] = $tcp_port; } } /** * Setter function for TCP ports * * @param tcp_ports $tcp_Ports */ public function add_TCP_Ports($tcp_Ports) { if (!isset($this->tcp_ports[$tcp_Ports->get_Port()])) { $this->tcp_ports[$tcp_Ports->get_Port()] = $tcp_Ports; } else { if (empty($this->tcp_ports[$tcp_Ports->get_Port()]->get_Banner())) { $this->tcp_ports[$tcp_Ports->get_Port()]->set_Banner($tcp_Ports->get_Banner()); } else { $this->tcp_ports[$tcp_Ports->get_Port()]->set_Banner($this->tcp_ports[$tcp_Ports->get_Port()]->get_Banner() . PHP_EOL . $tcp_Ports->get_Banner()); } } } /** * Setter function for TCP ports based on array * * @param integer $port_number */ public function remove_TCP_Ports_Array($port_number) { unset($this->tcp_ports[$port_number]); } /** * Getter function for UDP ports * * @return array:udp_ports */ public function get_UDP_Ports() { return $this->udp_ports; } /** * Return a UDP Port object of a specific port * * @param integer $port_number * * @return NULL|udp_ports */ public function get_UDP_Port_By_Port_Number($port_number) { return isset($this->udp_port[$port_number]) ? $this->udp_ports[$port_number] : null; } /** * Function to check and see if a UDP port is open * * @param int $port_number * * @return boolean */ public function is_UDP_Port_Open($port_number) { return isset($this->udp_ports[$port_number]); } /** * Update a specific udp port * * @param udp_ports $udp_port */ public function update_UDP_Port($udp_port) { if (isset($this->udp_ports[$udp_port->get_Port()])) { // Get pointer to current port by reference so updates persist upon return $cur_port = &$this->udp_ports[$udp_port->get_Port()]; // Get current and new port banner and notes to determine if we need to update. $cur_banner = $cur_port->get_Banner(); $cur_notes = $cur_port->get_Notes(); $new_banner = $udp_port->get_Banner(); $new_notes = $udp_port->get_Notes(); // Only update banner if new banner is not already in current banner if (!empty($new_banner) && strpos($cur_banner, $new_banner) === false) { $cur_port->set_Banner($udp_port->get_Banner()); } // Only update notes if new notes is not already in current notes if (!empty($new_notes) && strpos($cur_notes, $new_notes) === false) { $cur_port->append_Notes($udp_port->get_Notes()); } } else { $this->udp_ports[$udp_port->get_Port()] = $udp_port; } } /** * Setter function for UDP ports * * @param udp_ports $udp_Ports */ public function add_UDP_Ports($udp_Ports) { if (!isset($this->udp_ports[$udp_Ports->get_Port()])) { $this->udp_ports[$udp_Ports->get_Port()] = $udp_Ports; } else { if (!$this->udp_ports[$udp_Ports->get_Port()]->get_Banner()) { $this->udp_ports[$udp_Ports->get_Port()]->set_Banner($udp_Ports->get_Banner()); } else { $this->udp_ports[$udp_Ports->get_Port()]->set_Banner($this->udp_ports[$udp_Ports->get_Port()]->get_Banner() . PHP_EOL . $udp_Ports->get_Banner()); } } } /** * Function to remove port from array * * @param integer $port_number */ public function remove_UDP_Ports_Array($port_number) { unset($this->udp_ports[$port_number]); } /** * Getter function for FQDN * * @return string */ public function get_FQDN() { return $this->fqdn; } /** * Setter function for FQDN * * @param string $str_FQDN */ public function set_FQDN($str_FQDN) { $this->fqdn = $str_FQDN; } /** * Getter function for Description * * @return string */ public function get_Description() { return $this->description; } /** * Setter function for Description * * @param string $str_Description */ public function set_Description($str_Description) { $this->description = $str_Description; } /** * Getter function for interface notes * * @return string */ public function get_Notes() { return $this->notes; } /** * Setter function for interface notes * * @param string $notes_in */ public function set_Notes($notes_in) { $this->notes = $notes_in; } /** * Getter function for preformated table row * * @return string */ public function get_Table_Data($Odd_Row) { $ret = "