SgnSharp 0.1.0

dotnet add package SgnSharp --version 0.1.0
                    
NuGet\Install-Package SgnSharp -Version 0.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SgnSharp" Version="0.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SgnSharp" Version="0.1.0" />
                    
Directory.Packages.props
<PackageReference Include="SgnSharp" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SgnSharp --version 0.1.0
                    
#r "nuget: SgnSharp, 0.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package SgnSharp@0.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SgnSharp&version=0.1.0
                    
Install as a Cake Addin
#tool nuget:?package=SgnSharp&version=0.1.0
                    
Install as a Cake Tool

SgnSharp

SgnSharp is a .NET port of EgeBalci's SGN encoder for x86/x64 payloads. It provides a library API and a console utility.

CLI Usage

Build and run from the repo root:

dotnet build
dotnet run --project SgnSharp.Cli -- -i path\to\payload.bin -a 64 -c 2 -M 50 -S -v

CLI Flags

-h, --help               Show help
-i, --input=STRING       Input binary path
-o, --out=STRING         Encoded output binary name
-a, --arch=64            Binary architecture (32/64)
-c, --enc=1              Number of times to encode the binary
-M, --max=50             Maximum number of bytes for decoder obfuscation
    --plain              Do not encode the decoder stub
    --ascii              Generate ASCII printable payload (not supported yet)
-S, --safe               Preserve all register values
    --badchars=STRING    Disallow specified bytes in hex form (not supported yet)
    --seed=BYTE          Hex seed value (e.g. 0x2a)
-v, --verbose            Verbose output
    --version            Show version

Notes

  • --ascii and --badchars are not implemented yet and will return an error.
  • The CLI uses Keystone for assembly; the build copies the x64 keystone.dll into the output folder. If you need x86, update SgnSharp.Cli/SgnSharp.Cli.csproj to copy installed\x86-windows\bin\keystone.dll instead.

Library Usage

using SgnSharp;
using SgnSharp.Types;

var payload = File.ReadAllBytes("myfile.bin");
var encoder = new Encoder(
    Arch.x64,
    obfuscationLimit: 50,
    plainDecoder: false,
    encodingCount: 1,
    saveRegisters: false
);

var result = encoder.Encode(payload);
if (result.IsFailure)
{
    Console.WriteLine(result.Error);
    return;
}

File.WriteAllBytes("myfile.bin.sgn", result.Value);
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.0 91 12/27/2025