示例#1
0
 def test_ips(self, filepath, expected):
     xml = self.create_xml(filepath)
     e = self.create_instance(xml)
     assert len(expected) == len(e.get_port_ip_map())
     for key in expected:
         assert compare_lists(expected[key],
                              e.get_port_ip_map().get(key, []))
         assert compare_lists(
             expected[key],
             e.get_ips_for_port(key.split('/')[0],
                                key.split('/')[1]))
示例#2
0
 def equals(self, other):
     return isinstance(other, OSClass) \
            and self.__type == other.get_type() \
            and self.__vendor == other.get_vendor() \
            and self.__family == other.get_family() \
            and self.__generation == other.get_generation() \
            and self.__accuracy == other.get_accuracy() \
            and compare_lists(self.__cpes, other.get_cpes())
示例#3
0
 def equals(self, other):
     return isinstance(other, Host) \
            and self.__start_time == other.get_start_time() \
            and self.__end_time == other.get_end_time() \
            and self.__status.equals(other.get_status()) \
            and self.__comment == other.get_comment() \
            and compare_lists_equal(self.__os, other.get_os()) \
            and compare_lists_equal(self.__addresses, other.get_addresses()) \
            and compare_lists_equal(self.__uptimes, other.get_uptimes()) \
            and compare_lists_equal(self.__hostnames, other.get_hostnames()) \
            and compare_lists_equal(self.__ports, other.get_ports()) \
            and compare_lists_equal(self.__extraports, other.get_extraports()) \
            and compare_lists_equal(self.__traces, other.get_traces()) \
            and compare_lists_equal(self.__ipidsequences, other.get_ipid_sequences()) \
            and compare_lists_equal(self.__tcpsequences, other.get_tcp_sequences()) \
            and compare_lists_equal(self.__tcptssequences, other.get_tcpts_sequences()) \
            and compare_lists_equal(self.__times, other.get_times()) \
            and compare_lists(self.__distances, other.get_distances()) \
            and compare_lists(self.__smurfs, other.get_smurfs()) \
            and compare_script_maps(self.__hostscripts, other.get_host_scripts())
示例#4
0
    def equals(self, other):
        status = isinstance(other, ReverseIndex) \
                 and Script.equals(self, other) \
                 and len(self.__port_ip_map) == len(other.get_port_ip_map())

        if status:
            other_elements_other = other.get_port_ip_map()
            for other_key in self.__port_ip_map:
                if not compare_lists(self.__port_ip_map[other_key], other_elements_other.get(other_key, [])):
                    return False

        return status
示例#5
0
 def equals(self, other):
     return isinstance(other, Service) \
            and self.__name == other.get_name() \
            and self.__conf == other.get_conf() \
            and self.__method == other.get_method() \
            and self.__version == other.get_version() \
            and self.__product == other.get_product() \
            and self.__extrainfo == other.get_extra_info() \
            and self.__tunnel == other.get_tunnel() \
            and self.__proto == other.get_proto() \
            and self.__rpcnum == other.get_rpc_num() \
            and self.__lowver == other.get_low_version() \
            and self.__highver == other.get_high_version() \
            and self.__hostname == other.get_hostname() \
            and self.__ostype == other.get_os_type() \
            and self.__devicetype == other.get_device_type() \
            and self.__servicefp == other.get_service_fp() \
            and compare_lists(self.__cpes, other.get_cpes())
示例#6
0
    def equals(self, other):
        status = isinstance(other, SSH2EnumAlgos) \
                 and Script.equals(self, other) \
                 and compare_lists(self.__kex_algorithms, other.get_kex_algorithms()) \
                 and compare_lists(self.__server_host_key_algorithms, other.get_server_host_key_algorithms()) \
                 and compare_lists(self.__encryption_algorithms, other.get_encryption_algorithms()) \
                 and compare_lists(self.__mac_algorithms, other.get_mac_algorithms()) \
                 and compare_lists(self.__compression_algorithms, other.get_compression_algorithms()) \
                 and len(self.__other) == len(other.get_other())

        if status:
            other_elements_other = other.get_other()
            for other_key in self.__other:
                if not compare_lists(self.__other[other_key],
                                     other_elements_other.get(other_key, [])):
                    return False

        return status
示例#7
0
 def equals(self, other):
     return isinstance(other, OS) \
            and compare_lists_equal(self.__used_ports, other.get_used_ports()) \
            and compare_lists_equal(self.__os_matches, other.get_os_matches()) \
            and compare_lists(self.__os_fingerprints, other.get_os_fingerprints())
 def test_encryption_algorithms(self, filepath, expected):
     xml = self.create_xml(filepath)
     e = self.create_instance(xml)
     assert compare_lists(expected, e.get_encryption_algorithms())
 def test_other(self, filepath, expected):
     xml = self.create_xml(filepath)
     e = self.create_instance(xml)
     assert len(expected) == len(e.get_other())
     for key in expected:
         assert compare_lists(expected[key], e.get_other().get(key, []))
示例#10
0
 def test_server_host_key_algorithms(self, filepath, expected):
     xml = self.create_xml(filepath)
     e = self.create_instance(xml)
     assert compare_lists(expected, e.get_server_host_key_algorithms())