Skip to content

Oxygem/go-byte-obfuscator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Go Byte Obfuscator

Script to generate obfuscated code that returns the input string. Is actually compatible with any byte input just no CLI for it.

> go run main.go "topsecret" > enc.go
> go run enc.go
Decrypted bytes (as string): topsecret

The input is encrypted using AES by generating and including a random key + IV; enc.go looks like:

package main

import (
    "crypto/aes"
    "crypto/cipher"
    "encoding/base64"
    "fmt"
)

func main() {
    key, _ := base64.StdEncoding.DecodeString("nE9B4kB+onESkUOnhoyTSC99/6mzqOZk+Khedk2Z53Q=")
    block, _ := aes.NewCipher(key)

    encryptedData, _ := base64.StdEncoding.DecodeString("oXj7eUqMm1Q9Cx3SyucBMcGDDdl0i7rgGzIu/eVslKw=")
    iv := encryptedData[:aes.BlockSize]
    text := encryptedData[aes.BlockSize:]
    padding := 7

    cipher.NewCBCDecrypter(block, iv).CryptBlocks(text, text)
    text = text[:len(text)-padding]

    fmt.Printf("Decrypted bytes (as string): %s\n", text)
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages