From e73be379ea0bc07a0da98506c77fdbd3f7696188 Mon Sep 17 00:00:00 2001 From: rvazarkar Date: Tue, 8 Aug 2023 18:57:23 -0400 Subject: [PATCH 1/6] fix: use string enum convertor to properly send enums --- src/Writers/JsonDataWriter.cs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/Writers/JsonDataWriter.cs b/src/Writers/JsonDataWriter.cs index 48a6dbf..821c9af 100644 --- a/src/Writers/JsonDataWriter.cs +++ b/src/Writers/JsonDataWriter.cs @@ -1,8 +1,10 @@ -using System.IO; +using System.Collections.Generic; +using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; using Newtonsoft.Json; +using Newtonsoft.Json.Converters; using Newtonsoft.Json.Serialization; using Sharphound.Client; using SharpHoundCommonLib.OutputTypes; @@ -18,6 +20,7 @@ public class JsonDataWriter : BaseWriter private JsonTextWriter _jsonWriter; private readonly IContext _context; private string _fileName; + private JsonSerializerSettings _serializerSettings; private const int DataVersion = 5; @@ -31,6 +34,15 @@ public JsonDataWriter(IContext context, string dataType) : base(dataType) _context = context; if (_context.Flags.NoOutput) NoOp = true; + + _serializerSettings = new JsonSerializerSettings() + { + Converters = new List + { + new StringEnumConverter() + }, + Formatting = PrettyPrint + }; } private Formatting PrettyPrint => _context.Flags.PrettyPrint ? Formatting.Indented : Formatting.None; @@ -61,7 +73,7 @@ protected override async Task WriteData() { foreach (var item in Queue) { - await _jsonWriter.WriteRawValueAsync(JsonConvert.SerializeObject(item, PrettyPrint)); + await _jsonWriter.WriteRawValueAsync(JsonConvert.SerializeObject(item, _serializerSettings)); } } From f3e168ca0a56900021363dc6e6992f1850fdfb97 Mon Sep 17 00:00:00 2001 From: rvazarkar Date: Tue, 8 Aug 2023 19:25:19 -0400 Subject: [PATCH 2/6] chore: fix log line --- src/Sharphound.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Sharphound.cs b/src/Sharphound.cs index 77233b2..9880c75 100644 --- a/src/Sharphound.cs +++ b/src/Sharphound.cs @@ -392,7 +392,7 @@ public class Program public static async Task Main(string[] args) { var logger = new BasicLogger((int)LogLevel.Information); - logger.LogInformation("This version of SharpHound is compatible with the 4.3.1 Release of BloodHound"); + logger.LogInformation("This version of SharpHound is compatible with the 5.0.0 Release of BloodHound"); try { var parser = new Parser(with => From 5f6a0b7887ee5910262bed75a7e2d63ed9d5bd4b Mon Sep 17 00:00:00 2001 From: rvazarkar Date: Tue, 8 Aug 2023 19:30:23 -0400 Subject: [PATCH 3/6] chore: update README.md with version --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 29fcf9b..5a1482d 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ --- -SharpHound Open Source Client version: 1.1.1 +SharpHound Open Source Client version: 2.0.0 --- # SharpHound From aa2e2c2f5b23f093f25297edcbbb56dabec2d24e Mon Sep 17 00:00:00 2001 From: rvazarkar Date: Tue, 26 Sep 2023 15:11:47 -0400 Subject: [PATCH 4/6] chore: move commonlib over to new hosting --- .gitignore | 2 +- Sharphound.csproj | 7 ++++--- nuget.config | 8 ++++++++ 3 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 nuget.config diff --git a/.gitignore b/.gitignore index 98b8228..e2a5b73 100644 --- a/.gitignore +++ b/.gitignore @@ -428,7 +428,7 @@ PublishScripts/ *.nuget.targets # Nuget personal access tokens and Credentials -nuget.config +#nuget.config # Microsoft Azure Build Output csx/ diff --git a/Sharphound.csproj b/Sharphound.csproj index cee86b2..842c76b 100644 --- a/Sharphound.csproj +++ b/Sharphound.csproj @@ -24,15 +24,16 @@ - + + - + - + diff --git a/nuget.config b/nuget.config new file mode 100644 index 0000000..21f2f07 --- /dev/null +++ b/nuget.config @@ -0,0 +1,8 @@ + + + + + + + + From 16303fc79f4594bc9df6f26e90a0764b73859b54 Mon Sep 17 00:00:00 2001 From: rvazarkar Date: Tue, 26 Sep 2023 15:12:13 -0400 Subject: [PATCH 5/6] chore: add some extra logging around CollectAllProperties --- src/Producers/LdapProducer.cs | 6 ++++++ src/Runtime/ObjectProcessors.cs | 3 +++ 2 files changed, 9 insertions(+) diff --git a/src/Producers/LdapProducer.cs b/src/Producers/LdapProducer.cs index 6d712ef..78feaf4 100644 --- a/src/Producers/LdapProducer.cs +++ b/src/Producers/LdapProducer.cs @@ -31,6 +31,12 @@ public override async Task Produce() var log = Context.Logger; var utils = Context.LDAPUtils; + if (Context.Flags.CollectAllProperties) + { + log.LogDebug("CollectAllProperties set. Changing LDAP properties to *"); + ldapData.Props = new[] { "*" }; + } + foreach (var domain in Context.Domains) { Context.Logger.LogInformation("Beginning LDAP search for {Domain}", domain); diff --git a/src/Runtime/ObjectProcessors.cs b/src/Runtime/ObjectProcessors.cs index 45e4723..3282a68 100644 --- a/src/Runtime/ObjectProcessors.cs +++ b/src/Runtime/ObjectProcessors.cs @@ -10,6 +10,9 @@ using SharpHoundCommonLib.Enums; using SharpHoundCommonLib.OutputTypes; using SharpHoundCommonLib.Processors; +using Container = SharpHoundCommonLib.OutputTypes.Container; +using Group = SharpHoundCommonLib.OutputTypes.Group; +using Label = SharpHoundCommonLib.Enums.Label; namespace Sharphound.Runtime { From 271d28d2c74cd7007f06ff84c45c31e6f9d3eb6b Mon Sep 17 00:00:00 2001 From: rvazarkar Date: Thu, 28 Sep 2023 15:26:13 -0400 Subject: [PATCH 6/6] chore: bump version --- Sharphound.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sharphound.csproj b/Sharphound.csproj index 842c76b..9371942 100644 --- a/Sharphound.csproj +++ b/Sharphound.csproj @@ -6,8 +6,8 @@ latest full favicon.ico - 2.0.0 - 2.0.0 + 2.0.1 + 2.0.1 SpecterOps SharpHound SharpHound