mirror of
https://github.com/EgeBalci/sgn
synced 2026-06-08 10:56:31 +00:00
ecc578b28c
- feat(cli): Apply obfuscation, encoding, and safe options in main loop - feat(obfuscation): Allow disabling garbage instruction generation via obfuscation limit - fix(encoder): Correct schema size calculation for x64 architecture - fix(encoder): Pad encoded payload with NOPs to ensure schema alignment - fix(obfuscation): Add fallback for random register selection in garbage generation - fix(cli): Truncate output file on write and ensure it is closed - fix(examples): Correct casing in sgn package import path - style(encoder): Remove trailing whitespace from register save definitions
34 lines
550 B
Go
34 lines
550 B
Go
package main
|
|
|
|
import (
|
|
"encoding/hex"
|
|
"fmt"
|
|
"os"
|
|
|
|
sgn "github.com/EgeBalci/sgn/pkg"
|
|
)
|
|
|
|
func main() {
|
|
// First open some file
|
|
file, err := os.ReadFile("myfile.bin")
|
|
if err != nil { // check error
|
|
fmt.Println(err)
|
|
return
|
|
}
|
|
// Create a new SGN encoder
|
|
encoder, err := sgn.NewEncoder(64)
|
|
if err != nil {
|
|
fmt.Println(err)
|
|
return
|
|
}
|
|
// Encode the binary
|
|
encodedBinary, err := encoder.Encode(file)
|
|
if err != nil {
|
|
fmt.Println(err)
|
|
return
|
|
}
|
|
// Print out the hex dump of the encoded binary
|
|
fmt.Println(hex.Dump(encodedBinary))
|
|
|
|
}
|