예제 #1
0
    def test_names(self):
        # The actual type is not important for this test
        a = TypedField("Some_Field", None)
        self.assertEqual("Some_Field", a.name)
        self.assertEqual("some_field", a.key_name)
        self.assertEqual("some_field", a.attr_name)

        a = TypedField("From", None)
        self.assertEqual("From", a.name)
        self.assertEqual("from", a.key_name)
        self.assertEqual("from_", a.attr_name)
예제 #2
0
class WhoisRegistrar(cybox.Entity):
    _binding = whois_binding
    _binding_class = whois_binding.WhoisRegistrarInfoType
    _namespace = "http://cybox.mitre.org/objects#WhoisObject-2"

    registrar_id = TypedField("Registrar_ID", String)
    registrar_guid = TypedField("Registrar_GUID", String)
    name = TypedField("Name", String)
    address = TypedField("Address", String)
    email_address = TypedField("Email_Address", EmailAddress)
    phone_number = TypedField("Phone_Number", String)
    whois_server = TypedField("Whois_Server", URI)
    referral_url = TypedField("Referral_URL", URI)
    contacts = TypedField("Contacts", WhoisContacts)
예제 #3
0
        class Foo(Entity):
            name = TypedField("Name", None)

            def __init__(self, name):
                super(Foo, self).__init__()
                self.name = name

            def __str__(self):
                return self.name
예제 #4
0
class WhoisContact(cybox.Entity):
    _binding = whois_binding
    _binding_class = whois_binding.WhoisContactType
    _namespace = "http://cybox.mitre.org/objects#WhoisObject-2"

    contact_type = TypedField("contact_type")
    contact_id = TypedField("Contact_ID", String)
    name = TypedField("Name", String)
    address = TypedField("Address", String)
    email_address = TypedField("Email_Address", EmailAddress)
    phone_number = TypedField("Phone_Number", String)
    fax_number = TypedField("Fax_Number", String)
    organization = TypedField("Organization", String)
예제 #5
0
class NetworkInterface(cybox.Entity):
    _namespace = "http://cybox.mitre.org/objects#SystemObject-2"
    _binding = system_binding
    _binding_class = system_binding.NetworkInterfaceType

    adapter = TypedField("Adapter", String)
    description = TypedField("Description", String)
    dhcp_lease_expires = TypedField("DHCP_Lease_Expires", DateTime)
    dhcp_lease_obtained = TypedField("DHCP_Lease_Obtained", DateTime)
    dhcp_server_list = TypedField("DHCP_Server_List", DHCPServerList)
    ip_gateway_list = TypedField("IP_Gateway_List", IPGatewayList)
    ip_list = TypedField("IP_List", IPInfoList)
    mac = TypedField("MAC", String)

    def __init__(self):
        super(NetworkInterface, self).__init__()
class DeviceObjectStruct(cybox.Entity):
    _binding = win_driver_binding
    _binding_class = win_driver_binding.DeviceObjectStructType
    _namespace = "http://cybox.mitre.org/objects#WinDriverObject-3"
    _XSI_NS = "WinDriverObj"
    _XSI_TYPE = "DeviceObjectStructType"

    attached_device_name = TypedField("Attached_Device_Name", String)
    attached_device_object = TypedField("Attached_Device_Object", UnsignedLong)
    attached_to_device_name = TypedField("Attached_To_Device_Name", String)
    attached_to_device_object = TypedField("Attached_To_Device_Object",
                                           UnsignedLong)
    attached_to_driver_name = TypedField("Attached_To_Driver_Name", String)
    attached_to_driver_object = TypedField("Attached_To_Driver_Object",
                                           UnsignedLong)
    device_name = TypedField("Device_Name", String)
    device_object = TypedField("Device_Object", UnsignedLong)
예제 #7
0
class WinPipe(Pipe):
    _binding = win_pipe_binding
    _binding_class = win_pipe_binding.WindowsPipeObjectType
    _namespace = 'http://cybox.mitre.org/objects#WinPipeObject-2'
    _XSI_NS = "WinPipeObj"
    _XSI_TYPE = "WindowsPipeObjectType"

    default_time_out = TypedField("Default_Time_Out", NonNegativeInteger)
    handle = TypedField("Handle", WinHandle)
    in_buffer_size = TypedField("In_Buffer_Size", NonNegativeInteger)
    max_instances = TypedField("Max_Instances", NonNegativeInteger)
    open_mode = TypedField("Open_Mode", HexBinary)
    out_buffer_size = TypedField("Out_Buffer_Size", NonNegativeInteger)
    pipe_mode = TypedField("Pipe_Mode", HexBinary)
    security_attributes = TypedField("Security_Attributes", String)

    def __init__(self):
        super(WinPipe, self).__init__()
예제 #8
0
class OS(cybox.Entity):
    _namespace = "http://cybox.mitre.org/objects#SystemObject-2"
    _binding = system_binding
    _binding_class = system_binding.OSType

    bitness = TypedField("Bitness", String)
    build_number = TypedField("Build_Number", String)
    environment_variable_list = TypedField("Environment_Variable_List",
                                           EnvironmentVariableList)
    install_date = TypedField("Install_Date", Date)
    patch_level = TypedField("Patch_Level", String)
    platform = TypedField("Platform", PlatformSpecification)

    def __init__(self):
        super(OS, self).__init__()
class WinDriver(WinExecutableFile):
    _binding = win_driver_binding
    _binding_class = win_driver_binding.WindowsDriverObjectType
    _namespace = "http://cybox.mitre.org/objects#WinDriverObject-3"
    _XSI_NS = "WinDriverObj"
    _XSI_TYPE = "WindowsDriverObjectType"

    driver_init = TypedField("Driver_Init", UnsignedLong)
    driver_name = TypedField("Driver_Name", String)
    driver_object_address = TypedField("Driver_Object_Address", HexBinary)
    driver_start_io = TypedField("Driver_Start_IO", HexBinary)
    driver_unload = TypedField("Driver_Unload", HexBinary)
    device_object_list = TypedField("Device_Object_List", DeviceObjectList)

    irp_mj_cleanup = TypedField("IRP_MJ_CLEANUP", UnsignedLong)
    irp_mj_close = TypedField("IRP_MJ_CLOSE", UnsignedLong)
    irp_mj_create = TypedField("IRP_MJ_CREATE", UnsignedLong)
    irp_mj_create_mailslot = TypedField("IRP_MJ_CREATE_MAILSLOT", UnsignedLong)
    irp_mj_create_named_pipe = TypedField("IRP_MJ_CREATE_NAMED_PIPE",
                                          UnsignedLong)
    irp_mj_device_change = TypedField("IRP_MJ_DEVICE_CHANGE", UnsignedLong)
    irp_mj_device_control = TypedField("IRP_MJ_DEVICE_CONTROL", UnsignedLong)
    irp_mj_directory_control = TypedField("IRP_MJ_DIRECTORY_CONTROL",
                                          UnsignedLong)
    irp_mj_file_system_control = TypedField("IRP_MJ_FILE_SYSTEM_CONTROL",
                                            UnsignedLong)
    irp_mj_flush_buffers = TypedField("IRP_MJ_FLUSH_BUFFERS", UnsignedLong)
    irp_mj_internal_device_control = TypedField(
        "IRP_MJ_INTERNAL_DEVICE_CONTROL", UnsignedLong)
    irp_mj_lock_control = TypedField("IRP_MJ_LOCK_CONTROL", UnsignedLong)
    irp_mj_pnp = TypedField("IRP_MJ_PNP", UnsignedLong)
    irp_mj_power = TypedField("IRP_MJ_POWER", UnsignedLong)
    irp_mj_query_ea = TypedField("IRP_MJ_QUERY_EA", UnsignedLong)
    irp_mj_query_information = TypedField("IRP_MJ_QUERY_INFORMATION",
                                          UnsignedLong)
    irp_mj_query_quota = TypedField("IRP_MJ_QUERY_QUOTA", UnsignedLong)
    irp_mj_query_security = TypedField("IRP_MJ_QUERY_SECURITY", UnsignedLong)
    irp_mj_query_volume_information = TypedField(
        "IRP_MJ_QUERY_VOLUME_INFORMATION", UnsignedLong)
    irp_mj_read = TypedField("IRP_MJ_READ", UnsignedLong)
    irp_mj_set_ea = TypedField("IRP_MJ_SET_EA", UnsignedLong)
    irp_mj_set_information = TypedField("IRP_MJ_SET_INFORMATION", UnsignedLong)
    irp_mj_set_quota = TypedField("IRP_MJ_SET_QUOTA", UnsignedLong)
    irp_mj_set_security = TypedField("IRP_MJ_SET_SECURITY", UnsignedLong)
    irp_mj_set_volume_information = TypedField("IRP_MJ_SET_VOLUME_INFORMATION",
                                               UnsignedLong)
    irp_mj_shutdown = TypedField("IRP_MJ_SHUTDOWN", UnsignedLong)
    irp_mj_system_control = TypedField("IRP_MJ_SYSTEM_CONTROL", UnsignedLong)

    def __init__(self):
        super(WinDriver, self).__init__()
예제 #10
0
class WinNetworkShare(ObjectProperties):
    _binding = win_network_share_binding
    _binding_class = win_network_share_binding.WindowsNetworkShareObjectType
    _namespace = "http://cybox.mitre.org/objects#WinNetworkShareObject-2"
    _XSI_NS = "WinNetworkShareObj"
    _XSI_TYPE = "WindowsNetworkShareObjectType"

    access_read = TypedField("ACCESS_READ")
    access_write = TypedField("ACCESS_WRITE")
    access_create = TypedField("ACCESS_CREATE")
    access_exec = TypedField("ACCESS_EXEC")
    access_delete = TypedField("ACCESS_DELETE")
    access_atrib = TypedField("ACCESS_ATRIB")
    access_perm = TypedField("ACCESS_PERM")
    access_all = TypedField("ACCESS_ALL")
    current_uses = TypedField("Current_Uses", NonNegativeInteger)
    local_path = TypedField("Local_Path", String)
    max_uses = TypedField("Max_Uses", NonNegativeInteger)
    netname = TypedField("Netname", String)
    type_ = TypedField("Type", String)
예제 #11
0
class WhoisEntry(ObjectProperties):
    _binding = whois_binding
    _binding_class = whois_binding.WhoisObjectType
    _namespace = "http://cybox.mitre.org/objects#WhoisObject-2"
    _XSI_NS = 'WhoisObj'
    _XSI_TYPE = 'WhoisObjectType'

    lookup_date = TypedField("Lookup_Date", DateTime)
    remarks = TypedField("Remarks", String)
    contact_info = TypedField("Contact_Info", WhoisContact)
    domain_name = TypedField("Domain_Name", URI)
    domain_id = TypedField("Domain_ID", String)
    server_name = TypedField("Server_Name", URI)
    ip_address = TypedField("IP_Address", Address)
    dnssec = TypedField("DNSSEC", String)
    nameservers = TypedField("Nameservers", WhoisNameservers)
    status = TypedField("Status", WhoisStatuses)
    updated_date = TypedField("Updated_Date", Date)
    creation_date = TypedField("Creation_Date", Date)
    expiration_date = TypedField("Expiration_Date", Date)
    regional_internet_registry = TypedField("Regional_Internet_Registry",
                                            String)
    sponsoring_registrar = TypedField("Sponsoring_Registrar", String)
    registrar_info = TypedField("Registrar_Info", WhoisRegistrar)
    registrants = TypedField("Registrants", WhoisRegistrants)

    DNSSEC_SIGNED = "Signed"
    DNSSEC_UNSIGNED = "Unsigned"
예제 #12
0
class WhoisRegistrant(WhoisContact):
    _namespace = "http://cybox.mitre.org/objects#WhoisObject-2"
    _binding = whois_binding
    _binding_class = whois_binding.WhoisRegistrantInfoType

    registrant_id = TypedField("Registrant_ID", String)
예제 #13
0
 def __init__(self):
     super(IPInfo, self).__init__()
     ip_address = TypedField("IP_Address", Address)
     subnet_mask = TypedField("Subnet_Mask", Address)
예제 #14
0
        class SomeEntity(Entity):
            _binding_class = Mock

            single = TypedField("Single")
            multiple = TypedField("Multiple", multiple=True)