5 def test_OpenHKLM(pipe
):
9 r
['unknown']['unknown0'] = 0x9038
10 r
['unknown']['unknown1'] = 0x0000
11 r
['access_required'] = 0x02000000
13 result
= dcerpc
.winreg_OpenHKLM(pipe
, r
)
15 return result
['handle']
17 def test_QueryInfoKey(pipe
, handle
):
22 r
['class']['name'] = None
24 return dcerpc
.winreg_QueryInfoKey(pipe
, r
)
26 def test_CloseKey(pipe
, handle
):
31 dcerpc
.winreg_CloseKey(pipe
, r
)
33 def test_Enum(pipe
, handle
, depth
= 0):
38 keyinfo
= test_QueryInfoKey(pipe
, handle
)
47 r
['in_name']['unknown'] = 0x20a
48 r
['in_name']['key_name'] = {}
49 r
['in_name']['key_name']['name'] = None
51 r
['class']['name'] = None
52 r
['last_changed_time'] = {}
53 r
['last_changed_time']['low'] = 0
54 r
['last_changed_time']['high'] = 0
56 for i
in range(0, keyinfo
['num_subkeys']):
60 subkey
= dcerpc
.winreg_EnumKey(pipe
, r
)
65 s
['keyname']['name'] = subkey
['out_name']['name']
67 s
['access_mask'] = 0x02000000
69 result
= dcerpc
.winreg_OpenKey(pipe
, s
)
71 test_Enum(pipe
, result
['handle'], depth
+ 1)
73 test_CloseKey(pipe
, result
['handle'])
80 keyinfo
['max_valnamelen'] = 18
81 keyinfo
['max_valbufsize'] = 0x31f5
85 r
['foo']['max_len'] = keyinfo
['max_valnamelen'] * 2
86 r
['foo']['buffer'] = {}
87 r
['foo']['buffer']['max_len'] = keyinfo
['max_valnamelen']
88 r
['foo']['buffer']['offset'] = 0
89 r
['foo']['buffer']['len'] = 0
90 r
['foo']['buffer']['buffer'] = ''
93 r
['value']['max_len'] = keyinfo
['max_valbufsize']
94 r
['value']['offset'] = 0
96 r
['value']['buffer'] = []
99 r
['foo2']['max_len'] = keyinfo
['max_valbufsize']
100 r
['foo2']['offset'] = 0
102 r
['foo2']['buffer'] = ''
103 r
['value1'] = keyinfo
['max_valbufsize']
106 for i
in range(0, keyinfo
['num_values']):
111 print dcerpc
.winreg_EnumValue(pipe
, r
)
115 def test_Key(pipe
, handle
):
117 test_Enum(pipe
, handle
)
119 def runtests(binding
, domain
, username
, password
):
121 print 'Testing WINREG pipe'
123 pipe
= dcerpc
.pipe_connect(binding
,
124 dcerpc
.DCERPC_WINREG_UUID
, dcerpc
.DCERPC_WINREG_VERSION
,
125 domain
, username
, password
)
127 handle
= test_OpenHKLM(pipe
)
129 test_Key(pipe
, handle
)