Skip to content

Commit 8ebb2dc

Browse files
committed
Add helper methods for ace type checks
1 parent b6ed7f0 commit 8ebb2dc

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

lib/rex/proto/ms_dtyp.rb

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,43 @@ class MsDtypAceType
331331
def self.name(value)
332332
constants.select { |c| c.upcase == c }.find { |c| const_get(c) == value }
333333
end
334+
335+
def self.alarm?(type)
336+
[
337+
SYSTEM_ALARM_ACE_TYPE,
338+
SYSTEM_ALARM_OBJECT_ACE_TYPE,
339+
SYSTEM_ALARM_CALLBACK_ACE_TYPE,
340+
SYSTEM_ALARM_CALLBACK_OBJECT_ACE_TYPE,
341+
].include? type
342+
end
343+
344+
def self.allowed?(type)
345+
[
346+
ACCESS_ALLOWED_ACE_TYPE,
347+
ACCESS_ALLOWED_COMPOUND_ACE_TYPE,
348+
ACCESS_ALLOWED_OBJECT_ACE_TYPE,
349+
ACCESS_ALLOWED_CALLBACK_ACE_TYPE,
350+
ACCESS_ALLOWED_CALLBACK_OBJECT_ACE_TYPE,
351+
].include? type
352+
end
353+
354+
def self.audit?(type)
355+
[
356+
SYSTEM_AUDIT_ACE_TYPE,
357+
SYSTEM_AUDIT_OBJECT_ACE_TYPE,
358+
SYSTEM_AUDIT_CALLBACK_ACE_TYPE,
359+
SYSTEM_AUDIT_CALLBACK_OBJECT_ACE_TYPE,
360+
].include? type
361+
end
362+
363+
def self.denied?(type)
364+
[
365+
ACCESS_DENIED_ACE_TYPE,
366+
ACCESS_DENIED_OBJECT_ACE_TYPE,
367+
ACCESS_DENIED_CALLBACK_ACE_TYPE,
368+
ACCESS_DENIED_CALLBACK_OBJECT_ACE_TYPE,
369+
].include? type
370+
end
334371
end
335372

336373
# [2.4.4.1 ACE_HEADER](https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-dtyp/628ebb1d-c509-4ea0-a10f-77ef97ca4586)

0 commit comments

Comments
 (0)