1# Copyright (c) 2017, The MITRE Corporation. All rights reserved.
2# See LICENSE.txt for complete terms.
3
4from mixbox import entities
5from mixbox import fields
6
7import cybox.bindings.win_handle_object as win_handle_binding
8from cybox.common import (ObjectProperties, String, UnsignedLong,
9        UnsignedInteger)
10
11
12class WinHandle(ObjectProperties):
13    _binding = win_handle_binding
14    _binding_class = win_handle_binding.WindowsHandleObjectType
15    _namespace = 'http://cybox.mitre.org/objects#WinHandleObject-2'
16    _XSI_NS = "WinHandleObj"
17    _XSI_TYPE = "WindowsHandleObjectType"
18
19    id_ = fields.TypedField("ID", UnsignedInteger)
20    name = fields.TypedField("Name", String)
21    type_ = fields.TypedField("Type", String)
22    object_address = fields.TypedField("Object_Address", UnsignedLong)
23    access_mask = fields.TypedField("Access_Mask", UnsignedLong)
24    pointer_count = fields.TypedField("Pointer_Count", UnsignedLong)
25
26
27class WinHandleList(entities.EntityList):
28    _binding = win_handle_binding
29    _binding_class = win_handle_binding.WindowsHandleListType
30    _namespace = 'http://cybox.mitre.org/objects#WinHandleObject-2'
31
32    handle = fields.TypedField("Handle", WinHandle, multiple=True)
33