|
17 | 17 | namespace SharpHoundCommonLib.Processors { |
18 | 18 | public class LdapPropertyProcessor { |
19 | 19 | private static readonly HashSet<string> ReservedAttributes = new(); |
| 20 | + public delegate Task ComputerStatusDelegate(CSVComputerStatus status); |
| 21 | + public event ComputerStatusDelegate ComputerStatusEvent; |
20 | 22 |
|
21 | 23 | static LdapPropertyProcessor() { |
22 | 24 | ReservedAttributes.UnionWith(CommonProperties.TypeResolutionProps); |
@@ -249,10 +251,17 @@ public async Task<UserProperties> ReadUserProperties(IDirectoryObject entry, str |
249 | 251 |
|
250 | 252 | var resolvedHost = await _utils.ResolveHostToSid(d, domain); |
251 | 253 | if (resolvedHost.Success && resolvedHost.SecurityIdentifier.Contains("S-1")) |
| 254 | + { |
| 255 | + await SendComputerStatus(new CSVComputerStatus { |
| 256 | + Status = CSVComputerStatus.StatusSuccess, |
| 257 | + Task = nameof(ReadUserProperties), |
| 258 | + ComputerName = Helpers.StripServicePrincipalName(d).ToUpper().TrimEnd('$'), |
| 259 | + }); |
252 | 260 | comps.Add(new TypedPrincipal { |
253 | 261 | ObjectIdentifier = resolvedHost.SecurityIdentifier, |
254 | 262 | ObjectType = Label.Computer |
255 | 263 | }); |
| 264 | + } |
256 | 265 | } |
257 | 266 | } |
258 | 267 |
|
@@ -369,10 +378,17 @@ public async Task<ComputerProperties> ReadComputerProperties(IDirectoryObject en |
369 | 378 |
|
370 | 379 | var resolvedHost = await _utils.ResolveHostToSid(d, domain); |
371 | 380 | if (resolvedHost.Success && resolvedHost.SecurityIdentifier.Contains("S-1")) |
| 381 | + { |
| 382 | + await SendComputerStatus(new CSVComputerStatus { |
| 383 | + Status = CSVComputerStatus.StatusSuccess, |
| 384 | + Task = nameof(ReadComputerProperties), |
| 385 | + ComputerName = d, |
| 386 | + }); |
372 | 387 | comps.Add(new TypedPrincipal { |
373 | 388 | ObjectIdentifier = resolvedHost.SecurityIdentifier, |
374 | 389 | ObjectType = Label.Computer |
375 | 390 | }); |
| 391 | + } |
376 | 392 | } |
377 | 393 | } |
378 | 394 |
|
@@ -917,6 +933,10 @@ private enum IsTextUnicodeFlags { |
917 | 933 | IS_TEXT_UNICODE_NOT_UNICODE_MASK = 0x0F00, |
918 | 934 | IS_TEXT_UNICODE_NOT_ASCII_MASK = 0xF000 |
919 | 935 | } |
| 936 | + |
| 937 | + private async Task SendComputerStatus(CSVComputerStatus status) { |
| 938 | + if (ComputerStatusEvent is not null) await ComputerStatusEvent.Invoke(status); |
| 939 | + } |
920 | 940 | } |
921 | 941 |
|
922 | 942 | public class ParsedCertificate { |
|
0 commit comments