MCPcopy Create free account
hub / github.com/secdev/scapy / viewsec

Method viewsec

scapy/modules/ldaphero.py:742–1236  ·  view source on GitHub ↗

View security descriptor

(self, *args)

Source from the content-addressed store, hash-verified

740 self.sidscombo = {self._rslvsid(x): x for x in self.sids.keys()}
741
742 def viewsec(self, *args):
743 """
744 View security descriptor
745 """
746 # Get clicked item
747 item = self.tk_tree.selection()[0]
748
749 # Get SD
750 try:
751 results = self.client.search(
752 baseObject=item,
753 scope=0,
754 attributes=["ntSecurityDescriptor"],
755 controls=[
756 LDAP_Control(
757 controlType="1.2.840.113556.1.4.801",
758 criticality=True,
759 controlValue=LDAP_serverSDFlagsControl(
760 flags="OWNER+GROUP+DACL+SACL",
761 ),
762 )
763 ],
764 )
765 except LDAP_Exception as ex:
766 self.tprint(
767 ex.diagnosticMessage or "Error: %s" % ex.resultCode,
768 tags=["error"],
769 )
770 return
771
772 if item not in results:
773 return
774
775 try:
776 nTSecurityDescriptor = SECURITY_DESCRIPTOR(
777 results[item]["nTSecurityDescriptor"][0]
778 )
779 except LDAP_Exception as ex:
780 self.tprint(
781 "Error parsing the Security Descriptor: " + str(ex),
782 tags=["error"],
783 )
784 return
785
786 # Resolve the guids
787 if not self.load_guids():
788 return
789
790 # Pre-resolve all the SIDs.
791 owner = getattr(nTSecurityDescriptor, "OwnerSid", None)
792 group = getattr(nTSecurityDescriptor, "GroupSid", None)
793 _to_resolve = [
794 owner,
795 group,
796 ]
797 if hasattr(nTSecurityDescriptor, "DACL"):
798 _to_resolve.extend(x.Sid for x in nTSecurityDescriptor.DACL.Aces)
799 if hasattr(nTSecurityDescriptor, "SACL"):

Callers

nothing calls this directly

Calls 15

tprintMethod · 0.95
load_guidsMethod · 0.95
resolvesidsMethod · 0.95
_rslvsidMethod · 0.95
runMethod · 0.95
LDAP_ControlClass · 0.90
SECURITY_DESCRIPTORClass · 0.90
LDAP_AttributeValueClass · 0.90
BasePopupClass · 0.85

Tested by

no test coverage detected