sgn for Mac
sgn — a macOS app available via Homebrew.
sgn — overview
SGN is a polymorphic binary encoder for offensive security purposes such as generating statically undetecable binary payloads. It uses a additive feedback loop to encode given binary instructions similar to LFSR. This project is the reimplementation of the original Shikata ga nai in golang with many improvements. [!WARNING] The project recently ported to Rust. This port keeps the original design and behaviour but replaces the keystone text assembler with the pure-Rust iced-x86 assembler, so there are no native library dependencies — it builds with a plain cargo build. Check out the sgn-go branch for legacy Go version.
Why? For offensive security community, the original implementation of shikata ga nai encoder is considered to be the best shellcode encoder(until now). But over the years security researchers found several pitfalls for statically detecing the decoder stub(related work FireEye article). The main motive for this project was to create a better encoder that encodes the given binary to the point it is identical with totally random data and not possible to detect the presence of a decoder. [x] 64 bit support. Finally properly encoded x64 shellcodes ! [x] New smaller decoder stub. LFSR key reduced to 1 byte [x] Encoded stub with pseudo random schema. Decoder stub is also encoded with a psudo random schema [x] No visible loop condition Stub decodes itself WITHOUT using any loop conditions !! [x] Decoder stub obfuscation. Random garbage instruction generator added with keystone [x] Safe register option. Non of the registers are clobbered (optional preable, may reduce polimorphism)
How it works
Each encoding pass: (optional) appends a register-restore suffix (safe mode); prepends random, value-preserving garbage instructions; ciphers the payload with the ADFL (additive feedback loop) cipher and prepends a loop-free decoder stub that reverses it at runtime; unless --plain, encrypts the stub itself with a random per-run schema cipher (XOR/ADD/SUB/ROL/ROR/NOT over DWORDs) and prepends a self-locating schema decoder, so even the decoder looks like random data; optionally repeats --enc times with fresh seeds; (optional) prepends a register-save prefix (safe mode).
Install
You can also get the pre-compiled binaries HERE.
Usage
-h is pretty self explanatory use -v if you want to see what's going on behind the scenes ( ͡° ͜ʖ ͡°)_/¯
Example:
Execution Flow
The following image is a basic workflow diagram for the encoder. But keep in mind that the sizes, locations and orders will change for garbage instructions, decoders and schema decoders on each iteration.
LFSR itself is pretty powerful in terms of probability space. For even more polimorphism garbage instructions are appended at the begining of the unencoded raw payload. Below image shows the the companion matrix of the characteristic polynomial of the LFSR and denoting the seed as a column vector, the state of the register in Fibonacci configuration after k steps.
Using as a library
Details
将 Shikata ga nai (仕方がない) 编码器移植到 Go,并作了若干改进
How to install sgn
- Open Terminal (press ⌘ + Space and type “Terminal”).
- If Homebrew is not installed yet, run the command below first.
- Run this command:
Latest 10 releases
Last updated 2026-07-28; current version v1.0.0-rs, with the latest 5 releases listed.
| Version | Released | Type | Size | macOS | Windows | Linux |
|---|---|---|---|---|---|---|
| v1.0.0-rs | 2026-07-28 | Stable | 401 KB | Download | Download | Download |
| v2.0.2 | 2026-05-01 | Stable | — | — | Download | Download |
| v2.0.1 | 2023-12-19 | Stable | 1.3 MB | Download | Download | Download |
| 2.0 | 2020-11-06 | Stable | 2.4 MB | Download | Download | Download |
| v1.0-stable | 2020-07-29 | Stable | 3.4 MB | Download | Download | Download |
Data from GitHub Releases; stable releases first, each group sorted newest first.
Prebuilt bottle platforms
Official Homebrew bottles cover:
- Apple silicon · latest macOS
- Apple silicon · macOS 26 Tahoe
- Apple silicon · macOS 15 Sequoia
- Apple silicon · macOS 14 Sonoma
- Intel · macOS 14 Sonoma
- Linux · ARM64
- Linux · x86_64
Compared with similar apps
Only public metadata is compared, with no subjective recommendation; see the compare pages for field-by-field comparisons.
| App | Version | License | Architecture | 30-day installs |
|---|---|---|---|---|
| sgn | v1.0.0-rs | MIT | CLI | 2 |
| uvg266 | v0.8.1 | BSD-3-Clause | CLI | 2 |
| libvo-aacenc | 0.1.3 | Apache-2.0 | CLI | 2 |
| openssl@4 | openssl-4.1.0 | Apache-2.0 | CLI | 494,798 |
Similar apps: Command-line Tools
uvg266
An open-source VVC encoder licensed under 3-clause BSDlibvo-aacenc
libvo-aacenc is a low-level library focused on AAC audio encoding, based on an encoder…openssl@4
Cryptography and SSL/TLS Toolkitxz
General-purpose data compression with high compression ratiopkgconf
pkgconf is a program which helps to configure compiler and linker flags for development…node
Node.js is an open-source, cross-platform JavaScript runtime environment.Categories: Command-line Tools