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

Method _build_sid

scapy/modules/ticketer.py:1068–1092  ·  view source on GitHub ↗
(self, sidstr, msdn=False)

Source from the content-addressed store, hash-verified

1066 self._add_cred(tkt)
1067
1068 def _build_sid(self, sidstr, msdn=False):
1069 if not sidstr:
1070 return None
1071 m = re.match(r"S-(\d+)-(\d+)-?((?:\d+-?)*)", sidstr.strip())
1072 if not m:
1073 raise ValueError("Invalid SID format: %s" % sidstr)
1074 subauthors = []
1075 if m.group(3):
1076 subauthors = [int(x) for x in m.group(3).split("-")]
1077 if msdn:
1078 return WINNT_SID(
1079 Revision=int(m.group(1)),
1080 IdentifierAuthority=WINNT_SID_IDENTIFIER_AUTHORITY(
1081 Value=struct.pack(">Q", int(m.group(2)))[2:],
1082 ),
1083 SubAuthority=subauthors,
1084 )
1085 else:
1086 return SID(
1087 Revision=int(m.group(1)),
1088 IdentifierAuthority=RPC_SID_IDENTIFIER_AUTHORITY(
1089 Value=struct.pack(">Q", int(m.group(2)))[2:]
1090 ),
1091 SubAuthority=subauthors,
1092 )
1093
1094 def _build_ticket(self, store):
1095 if store["CC.ClaimsArrays"]:

Callers 1

_build_ticketMethod · 0.95

Calls 4

WINNT_SIDClass · 0.90
SIDClass · 0.90

Tested by

no test coverage detected