Parse binary SID to string format
(self, sid_bytes)
| 1234 | pass |
| 1235 | |
| 1236 | def _parse_binary_sid(self, sid_bytes): |
| 1237 | """Parse binary SID to string format""" |
| 1238 | import struct |
| 1239 | |
| 1240 | if len(sid_bytes) < 12: |
| 1241 | raise ValueError("SID too short") |
| 1242 | |
| 1243 | # Parse SID structure |
| 1244 | revision = sid_bytes[0] |
| 1245 | sub_authority_count = sid_bytes[1] |
| 1246 | authority = struct.unpack('>Q', b'\x00\x00' + sid_bytes[2:8])[0] |
| 1247 | |
| 1248 | # Build SID string |
| 1249 | sid_string = f"S-{revision}-{authority}" |
| 1250 | |
| 1251 | # Parse sub-authorities (little-endian 32-bit integers) |
| 1252 | for i in range(sub_authority_count): |
| 1253 | offset = 8 + (i * 4) |
| 1254 | if offset + 4 <= len(sid_bytes): |
| 1255 | sub_auth = struct.unpack('<I', sid_bytes[offset:offset+4])[0] |
| 1256 | sid_string += f"-{sub_auth}" |
| 1257 | |
| 1258 | return sid_string |
| 1259 | |
| 1260 | def __getattr__(self, name): |
| 1261 | """Delegate other attributes to the impacket auth object""" |
no outgoing calls
no test coverage detected