BloodHoundAD / SharpHoundCommon

Common library used by SharpHound.
GNU General Public License v3.0
75 stars 47 forks source link

.NET Version #53

Open daddycocoaman opened 1 year ago

daddycocoaman commented 1 year ago

Hi,

I was wondering if there's any chance SharpHoundCommon (and ultimately SharpHound) could target .NET Standard 2.0 instead of 4.6.2? It would allow the library and executable to be compiled with .NET Core in addition to Framework.

rvazarkar commented 1 year ago

We've actually evaluated which .net version we use a few times, but it all generally boils down to one thing: whats the least common denominator amongst target windows versions that are likely to show up on pentests/redteams since you generally have to run code on a computer you don't own.

I've historically used the following page as a guide: https://learn.microsoft.com/en-us/archive/blogs/astebner/mailbag-what-version-of-the-net-framework-is-included-in-what-version-of-the-os

With Win10 anniversary being a safe baseline version for most environments now, we defaulted to 4.6.2

daddycocoaman commented 1 year ago

.NET Standard is a set of APIs across versions, not a version itself. 4.6.2 falls in the NET Standard 2.0 range, so it is able to run binaries targeted for .NET Standard 2.0. If SharpHoundCommon has Standard 2.0 build, it can be used in the existing SharpHound target as well as any other compatible targets.

https://learn.microsoft.com/en-us/dotnet/standard/net-standard?tabs=net-standard-2-0

On Mon, Mar 20, 2023, 2:29 PM Rohan Vazarkar @.***> wrote:

We've actually evaluated which .net version we use a few times, but it all generally boils down to one thing: whats the least common denominator amongst target windows versions that are likely to show up on pentests/redteams since you generally have to run code on a computer you don't own.

I've historically used the following page as a guide:

https://learn.microsoft.com/en-us/archive/blogs/astebner/mailbag-what-version-of-the-net-framework-is-included-in-what-version-of-the-os

With Win10 anniversary being a safe baseline version for most environments now, we defaulted to 4.6.2

— Reply to this email directly, view it on GitHub https://github.com/BloodHoundAD/SharpHoundCommon/issues/53#issuecomment-1476818819, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFBVEIZJATJQKVASRDPMGATW5CV2TANCNFSM6AAAAAAWBO2D7E . You are receiving this because you authored the thread.Message ID: @.***>

irby commented 1 year ago

What @daddycocoaman describes is correct. .NET Standard 2.0 is compatible with both .NET Framework >= 4.6.1 and .NET Core >= 2.0. Because SharpHoundCommon targets strictly .NET Framework, the package cannot be consumed by .NET Core projects.

Just a note, .NET Standard 2.1 does not support .NET Framework. Just as a heads up on the difference between 2.0 and 2.1.

rvazarkar commented 1 year ago

The other issue I ran into when including netstandard2.0 is it massively balloons the size of the binary once all the DLLs get pulled in for netstandard. Since file size matters for remote execution, that would also be tricky