12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
|
# File 'lib/rex/post/meterpreter/extensions/stdapi/railgun/def/windows/def_ntdll.rb', line 12
def self.create_library(constant_manager, library_path = 'ntdll')
dll = Library.new(library_path, constant_manager)
dll.add_function('NtAllocateVirtualMemory', 'DWORD', [
['DWORD', 'ProcessHandle', 'in'],
['PBLOB', 'BaseAddress', 'inout'],
['PDWORD', 'ZeroBits', 'in'],
['PBLOB', 'RegionSize', 'inout'],
['DWORD', 'AllocationType', 'in'],
['DWORD', 'Protect', 'in']
])
dll.add_function('NtClose', 'DWORD', [
['DWORD', 'Handle', 'in'],
])
dll.add_function('NtCreateFile', 'DWORD', [
['PHANDLE', 'FileHandle', 'inout'],
['DWORD', 'DesiredAccess', 'in'],
['PBLOB', 'ObjectAttributes', 'in'],
['PBLOB', 'IoStatusBlock', 'inout'],
['PBLOB', 'AllocationSize', 'in'],
['DWORD', 'FileAttributes', 'in'],
['DWORD', 'ShareAccess', 'in'],
['DWORD', 'CreateDisposition', 'in'],
['DWORD', 'CreateOptions', 'in'],
['PBLOB', 'EaBuffer', 'in'],
['DWORD', 'EaLength', 'in'],
])
dll.add_function('NtDeviceIoControlFile', 'DWORD', [
['DWORD', 'FileHandle', 'in'],
['DWORD', 'Event', 'in'],
['LPVOID', 'ApcRoutine', 'in'],
['LPVOID', 'ApcContext', 'in'],
['PDWORD', 'IoStatusBlock', 'out'],
['DWORD', 'IoControlCode', 'in'],
['LPVOID', 'InputBuffer', 'in'],
['DWORD', 'InputBufferLength', 'in'],
['LPVOID', 'OutputBuffer', 'in'],
['DWORD', 'OutputBufferLength', 'in'],
])
dll.add_function('NtOpenFile', 'DWORD', [
['PHANDLE', 'FileHandle', 'inout'],
['DWORD', 'DesiredAccess', 'in'],
['PBLOB', 'ObjectAttributes', 'in'],
['PBLOB', 'IoStatusBlock', 'inout'],
['DWORD', 'ShareAccess', 'in'],
['DWORD', 'OpenOptions', 'in'],
])
dll.add_function('NtQueryInformationProcess', 'DWORD', [
['DWORD', 'ProcessHandle', 'in'],
['DWORD', 'ProcessInformationClass', 'in'],
['PBLOB', 'ProcessInformation', 'inout'],
['DWORD', 'ProcessInformationLength', 'in'],
['PDWORD', 'ReturnLength', 'inout'],
])
dll.add_function('NtQueryInformationThread', 'DWORD', [
['DWORD', 'ThreadHandle', 'in'],
['DWORD', 'ThreadInformationClass', 'in'],
['PBLOB', 'ThreadInformation', 'inout'],
['DWORD', 'ThreadInformationLength', 'in'],
['PDWORD', 'ReturnLength', 'inout'],
])
dll.add_function('NtQueryIntervalProfile', 'DWORD', [
['DWORD', 'ProfileSource', 'in'],
['PDWORD', 'Interval', 'out'],
])
dll.add_function('NtQuerySystemInformation', 'DWORD', [
['DWORD', 'SystemInformationClass', 'in'],
['PBLOB', 'SystemInformation', 'inout'],
['DWORD', 'SystemInformationLength', 'in'],
['PDWORD', 'ReturnLength', 'inout'],
])
dll.add_function('NtQuerySystemTime', 'DWORD', [
['PBLOB', 'SystemTime', 'inout'],
])
dll.add_function('NtWaitForSingleObject', 'DWORD', [
['DWORD', 'Handle', 'in'],
['BOOL', 'Alertable', 'in'],
['PBLOB', 'Timeout', 'in'],
])
dll.add_function('RtlCharToInteger', 'DWORD', [
['PBLOB', 'String', 'inout'],
['DWORD', 'Base', 'in'],
['PDWORD', 'Value', 'inout'],
])
dll.add_function('RtlConvertSidToUnicodeString', 'DWORD', [
['PBLOB', 'UnicodeString', 'inout'],
['PBLOB', 'Sid', 'inout'],
['BOOL', 'AllocateDestinationString', 'in'],
])
dll.add_function('RtlFreeAnsiString', 'VOID', [
['PBLOB', 'AnsiString', 'inout'],
])
dll.add_function('RtlFreeOemString', 'VOID', [
['PBLOB', 'OemString', 'inout'],
])
dll.add_function('RtlFreeUnicodeString', 'VOID', [
['PBLOB', 'UnicodeString', 'inout'],
])
dll.add_function('RtlGetNtVersionNumbers', 'VOID', [
['PDWORD', 'MajorVersion', 'inout'],
['PDWORD', 'MinorVersion', 'inout'],
['PDWORD', 'BuildNumber', 'inout']
])
dll.add_function('RtlGetVersion', 'VOID', [
['PBLOB', 'VersionInformation', 'inout']
])
dll.add_function('RtlInitAnsiString', 'VOID', [
['PBLOB', 'DestinationString', 'inout'],
['PBLOB', 'SourceString', 'inout'],
])
dll.add_function('RtlInitString', 'VOID', [
['PBLOB', 'DestinationString', 'inout'],
['PBLOB', 'SourceString', 'inout'],
])
dll.add_function('RtlLocalTimeToSystemTime', 'DWORD', [
['PBLOB', 'LocalTime', 'in'],
['PBLOB', 'SystemTime', 'inout'],
])
dll.add_function('RtlNtStatusToDosError', 'DWORD', [
['DWORD', 'Status', 'in'],
])
dll.add_function('RtlTimeToSecondsSince1970', 'BOOL', [
['PBLOB', 'Time', 'inout'],
['PDWORD', 'ElapsedSeconds', 'inout'],
])
dll.add_function('RtlUniform', 'DWORD', [
['PDWORD', 'Seed', 'inout'],
])
dll.add_function('RtlUnwind', 'VOID', [
['PBLOB', 'TargetFrame', 'in'],
['PBLOB', 'TargetIp', 'in'],
['PBLOB', 'ExceptionRecord', 'in'],
['PBLOB', 'ReturnValue', 'in'],
])
dll.add_function('RtlInitUnicodeString', 'VOID', [
['PBLOB', 'DestinationString', 'out'],
['PWCHAR', 'SourceString', 'in']
])
dll.add_function('NtCreateSymbolicLinkObject', 'DWORD', [
['PDWORD', 'LinkHandle', 'out'],
['DWORD', 'DesiredAccess', 'in'], ['PBLOB', 'ObjectAttributes', 'in'], ['PBLOB', 'TargetName', 'in'] ])
return dll
end
|