CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/lib/rex/post/meterpreter/extensions/stdapi/constants.rb
Views: 11791
1
# -*- coding: binary -*-
2
#
3
4
###
5
#
6
# Windows Specific Constants
7
# --------------------------
8
#
9
# These are put into the global namespace for now
10
# so that they can be referenced globally.
11
#
12
###
13
14
##
15
#
16
# Net
17
#
18
##
19
AF_INET = 2
20
AF_INET6 = 23
21
22
##
23
#
24
# Permissions
25
#
26
##
27
DELETE = 0x00010000
28
READ_CONTROL = 0x00020000
29
WRITE_DAC = 0x00040000
30
WRITE_OWNER = 0x00080000
31
SYNCHRONIZE = 0x00100000
32
STANDARD_RIGHTS_REQUIRED = 0x000f0000
33
STANDARD_RIGHTS_READ = READ_CONTROL
34
STANDARD_RIGHTS_WRITE = READ_CONTROL
35
STANDARD_RIGHTS_EXECUTE = READ_CONTROL
36
STANDARD_RIGHTS_ALL = 0x001f0000
37
SPECIFIC_RIGHTS_ALL = 0x0000ffff
38
MAXIMUM_ALLOWED = 0x02000000
39
GENERIC_READ = 0x80000000
40
GENERIC_WRITE = 0x40000000
41
GENERIC_EXECUTE = 0x20000000
42
GENERIC_ALL = 0x10000000
43
44
##
45
#
46
# Page Protections
47
#
48
##
49
PAGE_NOACCESS = 0x00000001
50
PAGE_READONLY = 0x00000002
51
PAGE_READWRITE = 0x00000004
52
PAGE_WRITECOPY = 0x00000008
53
PAGE_EXECUTE = 0x00000010
54
PAGE_EXECUTE_READ = 0x00000020
55
PAGE_EXECUTE_READWRITE = 0x00000040
56
PAGE_EXECUTE_WRITECOPY = 0x00000080
57
PAGE_GUARD = 0x00000100
58
PAGE_NOCACHE = 0x00000200
59
PAGE_WRITECOMBINE = 0x00000400
60
MEM_COMMIT = 0x00001000
61
MEM_RESERVE = 0x00002000
62
MEM_DECOMMIT = 0x00004000
63
MEM_RELEASE = 0x00008000
64
MEM_FREE = 0x00010000
65
MEM_PRIVATE = 0x00020000
66
MEM_MAPPED = 0x00040000
67
MEM_RESET = 0x00080000
68
MEM_TOP_DOWN = 0x00100000
69
MEM_WRITE_WATCH = 0x00200000
70
MEM_PHYSICAL = 0x00400000
71
MEM_LARGE_PAGES = 0x20000000
72
MEM_4MB_PAGES = 0x80000000
73
SEC_FILE = 0x00800000
74
SEC_IMAGE = 0x01000000
75
SEC_RESERVE = 0x04000000
76
SEC_COMMIT = 0x08000000
77
SEC_NOCACHE = 0x10000000
78
MEM_IMAGE = SEC_IMAGE
79
80
##
81
#
82
# Registry Permissions
83
#
84
##
85
KEY_QUERY_VALUE = 0x00000001
86
KEY_SET_VALUE = 0x00000002
87
KEY_CREATE_SUB_KEY = 0x00000004
88
KEY_ENUMERATE_SUB_KEYS = 0x00000008
89
KEY_NOTIFY = 0x00000010
90
KEY_CREATE_LINK = 0x00000020
91
KEY_WOW64_64KEY = 0x00000100
92
KEY_WOW64_32KEY = 0x00000200
93
KEY_READ = (STANDARD_RIGHTS_READ | KEY_QUERY_VALUE |
94
KEY_ENUMERATE_SUB_KEYS | KEY_NOTIFY) & ~SYNCHRONIZE
95
KEY_WRITE = (STANDARD_RIGHTS_WRITE | KEY_SET_VALUE |
96
KEY_CREATE_SUB_KEY) & ~SYNCHRONIZE
97
KEY_EXECUTE = KEY_READ
98
KEY_ALL_ACCESS = (STANDARD_RIGHTS_ALL | KEY_QUERY_VALUE |
99
KEY_SET_VALUE | KEY_CREATE_SUB_KEY |
100
KEY_ENUMERATE_SUB_KEYS | KEY_NOTIFY |
101
KEY_CREATE_LINK) & ~SYNCHRONIZE
102
103
##
104
#
105
# Registry
106
#
107
##
108
HKEY_CLASSES_ROOT = 0x80000000
109
HKEY_CURRENT_USER = 0x80000001
110
HKEY_LOCAL_MACHINE = 0x80000002
111
HKEY_USERS = 0x80000003
112
HKEY_PERFORMANCE_DATA = 0x80000004
113
HKEY_CURRENT_CONFIG = 0x80000005
114
HKEY_DYN_DATA = 0x80000006
115
116
REG_NONE = 0
117
REG_SZ = 1
118
REG_EXPAND_SZ = 2
119
REG_BINARY = 3
120
REG_DWORD = 4
121
REG_DWORD_LITTLE_ENDIAN = 4
122
REG_DWORD_BIG_ENDIAN = 5
123
REG_LINK = 6
124
REG_MULTI_SZ = 7
125
REG_QWORD = 11
126
127
##
128
#
129
# Process Permissions
130
#
131
##
132
PROCESS_TERMINATE = 0x00000001
133
PROCESS_CREATE_THREAD = 0x00000002
134
PROCESS_SET_SESSIONID = 0x00000004
135
PROCESS_VM_OPERATION = 0x00000008
136
PROCESS_VM_READ = 0x00000010
137
PROCESS_VM_WRITE = 0x00000020
138
PROCESS_DUP_HANDLE = 0x00000040
139
PROCESS_CREATE_PROCESS = 0x00000080
140
PROCESS_SET_QUOTA = 0x00000100
141
PROCESS_SET_INFORMATION = 0x00000200
142
PROCESS_QUERY_INFORMATION= 0x00000400
143
PROCESS_SUSPEND_RESUME = 0x00000800
144
PROCESS_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0xFFF
145
146
##
147
#
148
# Thread Permissions
149
#
150
##
151
THREAD_TERMINATE = 0x00000001
152
THREAD_SUSPEND_RESUME = 0x00000002
153
THREAD_GET_CONTEXT = 0x00000008
154
THREAD_SET_CONTEXT = 0x00000010
155
THREAD_SET_INFORMATION = 0x00000020
156
THREAD_QUERY_INFORMATION = 0x00000040
157
THREAD_SET_THREAD_TOKEN = 0x00000080
158
THREAD_IMPERSONATE = 0x00000100
159
THREAD_DIRECT_IMPERSONATION = 0x00000200
160
THREAD_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x3FF
161
162
##
163
#
164
# Creation flags
165
#
166
##
167
168
CREATE_SUSPENDED = 0x00000004
169
170
##
171
#
172
# Event Log
173
#
174
##
175
EVENTLOG_SEQUENTIAL_READ = 0x00000001
176
EVENTLOG_SEEK_READ = 0x00000002
177
EVENTLOG_FORWARDS_READ = 0x00000004
178
EVENTLOG_BACKWARDS_READ = 0x00000008
179
180
##
181
#
182
# Event Log
183
#
184
##
185
EWX_LOGOFF = 0
186
EWX_SHUTDOWN = 0x00000001
187
EWX_REBOOT = 0x00000002
188
EWX_FORCE = 0x00000004
189
EWX_POWEROFF = 0x00000008
190
EWX_FORCEIFHUNG = 0x00000010
191
192
##
193
#
194
# Shutdown Reason Codes
195
#
196
##
197
SHTDN_REASON_MINOR_DC_PROMOTION = 0x00000021
198
SHTDN_REASON_MAJOR_APPLICATION = 0x00040000
199
SHTDN_REASON_MAJOR_HARDWARE = 0x00010000
200
SHTDN_REASON_FLAG_COMMENT_REQUIRED = 0x01000000
201
SHTDN_REASON_FLAG_DIRTY_UI = 0x08000000
202
SHTDN_REASON_MINOR_UNSTABLE = 0x00000006
203
SHTDN_REASON_MINOR_SECURITYFIX_UNINSTALL = 0x00000018
204
SHTDN_REASON_MINOR_ENVIRONMENT = 0x00000000
205
SHTDN_REASON_MAJOR_LEGACY_API = 0x00070000
206
SHTDN_REASON_MINOR_DC_DEMOTION = 0x00000022
207
SHTDN_REASON_MINOR_SECURITYFIX = 0x00000012
208
SHTDN_REASON_FLAG_CLEAN_UI = 0x04000000
209
SHTDN_REASON_MINOR_HOTFIX = 0x00000011
210
SHTDN_REASON_MINOR_CORDUNPLUGGED = 0x00000000
211
SHTDN_REASON_MINOR_HOTFIX_UNINSTALL = 0x00000017
212
SHTDN_REASON_FLAG_USER_DEFINED = 0x40000000
213
SHTDN_REASON_MINOR_SYSTEMRESTORE = 0x00000001
214
SHTDN_REASON_MINOR_OTHERDRIVER = 0x00000000
215
SHTDN_REASON_MINOR_WMI = 0x00000015
216
SHTDN_REASON_MINOR_INSTALLATION = 0x00000002
217
SHTDN_REASON_MINOR_BLUESCREEN = 0x0000000F
218
SHTDN_REASON_MAJOR_SOFTWARE = 0x00030000
219
SHTDN_REASON_MINOR_NETWORKCARD = 0x00000009
220
SHTDN_REASON_MINOR_SERVICEPACK_UNINSTALL = 0x00000016
221
SHTDN_REASON_MINOR_SERVICEPACK = 0x00000010
222
SHTDN_REASON_MINOR_UPGRADE = 0x00000003
223
SHTDN_REASON_FLAG_PLANNED = 0x80000000
224
SHTDN_REASON_MINOR_MMC = 0x00000019
225
SHTDN_REASON_MINOR_POWER_SUPPLY = 0x00000000
226
SHTDN_REASON_MINOR_MAINTENANCE = 0x00000001
227
SHTDN_REASON_VALID_BIT_MASK = 0x00000000
228
SHTDN_REASON_MAJOR_NONE = 0x00000000
229
SHTDN_REASON_MAJOR_POWER = 0x00060000
230
SHTDN_REASON_FLAG_DIRTY_PROBLEM_ID_REQUIRED = 0x02000000
231
SHTDN_REASON_MINOR_OTHER = 0x00000000
232
SHTDN_REASON_MINOR_PROCESSOR = 0x00000008
233
SHTDN_REASON_MAJOR_OTHER = 0x00000000
234
SHTDN_REASON_MINOR_DISK = 0x00000007
235
SHTDN_REASON_MINOR_NETWORK_CONNECTIVITY = 0x00000014
236
SHTDN_REASON_MAJOR_OPERATINGSYSTEM = 0x00020000
237
SHTDN_REASON_MINOR_HUNG = 0x00000005
238
SHTDN_REASON_MINOR_TERMSRV = 0x00000020
239
SHTDN_REASON_MINOR_NONE = 0x00000000
240
SHTDN_REASON_MINOR_RECONFIG = 0x00000004
241
SHTDN_REASON_MAJOR_SYSTEM = 0x00050000
242
SHTDN_REASON_MINOR_HARDWARE_DRIVER = 0x00000000
243
SHTDN_REASON_MINOR_SECURITY = 0x00000013
244
SHTDN_REASON_DEFAULT = SHTDN_REASON_MAJOR_OTHER | SHTDN_REASON_MINOR_OTHER
245
246
##
247
#
248
# Keyboard Mappings
249
#
250
##
251
252
VirtualKeyCodes = {
253
1 => %W{ LClick },
254
2 => %W{ RClick },
255
3 => %W{ Cancel },
256
4 => %W{ MClick },
257
8 => %W{ Back },
258
9 => %W{ Tab },
259
10 => %W{ Newline },
260
12 => %W{ Clear },
261
13 => %W{ Return },
262
263
16 => %W{ Shift },
264
17 => %W{ Ctrl },
265
18 => %W{ Alt },
266
19 => %W{ Pause },
267
20 => %W{ CapsLock },
268
269
27 => %W{ Esc },
270
271
32 => %W{ Space },
272
33 => %W{ Prior },
273
34 => %W{ Next },
274
35 => %W{ End },
275
36 => %W{ Home },
276
37 => %W{ Left },
277
38 => %W{ Up },
278
39 => %W{ Right },
279
40 => %W{ Down },
280
41 => %W{ Select },
281
42 => %W{ Print },
282
43 => %W{ Execute },
283
44 => %W{ Snapshot },
284
45 => %W{ Insert },
285
46 => %W{ Delete },
286
47 => %W{ Help },
287
48 => %W{ 0 )},
288
49 => %W{ 1 !},
289
50 => %W{ 2 @},
290
51 => %W{ 3 #},
291
52 => %W{ 4 $},
292
53 => %W{ 5 %},
293
54 => %W{ 6 ^},
294
55 => %W{ 7 &},
295
56 => %W{ 8 *},
296
57 => %W{ 9 (},
297
65 => %W{ a A},
298
66 => %W{ b B},
299
67 => %W{ c C},
300
68 => %W{ d D},
301
69 => %W{ e E},
302
70 => %W{ f F},
303
71 => %W{ g G},
304
72 => %W{ h H},
305
73 => %W{ i I},
306
74 => %W{ j J},
307
75 => %W{ k K},
308
76 => %W{ l L},
309
77 => %W{ m M},
310
78 => %W{ n N},
311
79 => %W{ o O},
312
80 => %W{ p P},
313
81 => %W{ q Q},
314
82 => %W{ r R},
315
83 => %W{ s S},
316
84 => %W{ t T},
317
85 => %W{ u U},
318
86 => %W{ v V},
319
87 => %W{ w W},
320
88 => %W{ x X},
321
89 => %W{ y Y},
322
90 => %W{ z Z},
323
91 => %W{ LWin },
324
92 => %W{ RWin },
325
93 => %W{ Apps },
326
327
95 => %W{ Sleep },
328
96 => %W{ N0 },
329
97 => %W{ N1 },
330
98 => %W{ N2 },
331
99 => %W{ N3 },
332
100 => %W{ N4 },
333
101 => %W{ N5 },
334
102 => %W{ N6 },
335
103 => %W{ N7 },
336
104 => %W{ N8 },
337
105 => %W{ N9 },
338
106 => %W{ Multiply },
339
107 => %W{ Add },
340
108 => %W{ Separator },
341
109 => %W{ Subtract },
342
110 => %W{ Decimal },
343
111 => %W{ Divide },
344
112 => %W{ F1 },
345
113 => %W{ F2 },
346
114 => %W{ F3 },
347
115 => %W{ F4 },
348
116 => %W{ F5 },
349
117 => %W{ F6 },
350
118 => %W{ F7 },
351
119 => %W{ F8 },
352
120 => %W{ F9 },
353
121 => %W{ F10 },
354
122 => %W{ F11 },
355
123 => %W{ F12 },
356
124 => %W{ F13 },
357
125 => %W{ F14 },
358
126 => %W{ F15 },
359
127 => %W{ F16 },
360
128 => %W{ F17 },
361
129 => %W{ F18 },
362
130 => %W{ F19 },
363
131 => %W{ F20 },
364
132 => %W{ F21 },
365
133 => %W{ F22 },
366
134 => %W{ F23 },
367
135 => %W{ F24 },
368
144 => %W{ NumLock },
369
145 => %W{ Scroll },
370
160 => %W{ LShift },
371
161 => %W{ RShift },
372
162 => %W{ LCtrl },
373
163 => %W{ RCtrl },
374
164 => %W{ LMenu },
375
165 => %W{ RMenu },
376
166 => %W{ Back },
377
167 => %W{ Forward },
378
168 => %W{ Refresh },
379
169 => %W{ Stop },
380
170 => %W{ Search },
381
171 => %W{ Favorites },
382
172 => %W{ Home },
383
176 => %W{ Forward },
384
177 => %W{ Reverse },
385
178 => %W{ Stop },
386
179 => %W{ Play },
387
186 => %W{ ; :},
388
187 => %W{ = +},
389
188 => %W{ , <},
390
189 => %W{ - _},
391
190 => %W{ . >},
392
191 => %W{ / ?},
393
192 => %W{ ' ~},
394
219 => %W| [ {|,
395
220 => %W{ \ |},
396
221 => %W| ] }|,
397
222 => %W{ ' Quotes},
398
}
399
400