MCPcopy Create free account
hub / github.com/ELMERIKH/PyinMemoryPE / set_security_descriptor

Method set_security_descriptor

windows/winobject/process.py:491–503  ·  view source on GitHub ↗
(self, sd)

Source from the content-addressed store, hash-verified

489
490
491 def set_security_descriptor(self, sd):
492 if isinstance(sd, basestring):
493 sd = security.SecurityDescriptor.from_string(sd)
494 open_flags = gdef.WRITE_OWNER | gdef.WRITE_DAC
495 if (sd.sacl and
496 any(ace.Header.AceType != gdef.SYSTEM_MANDATORY_LABEL_ACE_TYPE for ace in sd.sacl)):
497 # Print error if requested but no SecurityPrivilege ?
498 open_flags |= gdef.ACCESS_SYSTEM_SECURITY
499 tmp_handle = windows.winproxy.OpenProcess(open_flags, 0, self.pid)
500 try:
501 sd._apply_to_handle_and_type(tmp_handle, gdef.SE_KERNEL_OBJECT)
502 finally:
503 windows.winproxy.CloseHandle(tmp_handle)
504
505 security_descriptor = property(get_security_descriptor, set_security_descriptor)
506

Callers

nothing calls this directly

Calls 2

from_stringMethod · 0.45

Tested by

no test coverage detected