🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

github.com/brimstone/obfuscate-xor

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/brimstone/obfuscate-xor

v0.0.0-20210527140316-51ac9495be37
Source
Go
Version published
Created
Source

obfuscate-xor

A little toy to encode strings with other strings. The point of this is to hide a string "under" an expected string in a binary or script.

Usage

Usage of ./obfuscate-xor:
  -language string
    	Language for output (default "go")
  -matches int
    	Number of matches (default 10)
  -plain string
    	Plain text to hide (default "AmsiScanBuffer")
  -wordlist string
    	Wordlist for cover text (default "words.txt")

Go Example

$ ./obfuscate-xor
// Helper xor function:
func xor(input string, key []byte) (output string) {
    for i := 0; i < len(input); i++ {
        output += string(input[i] ^ key[i%len(key)])
    }
    return output
}
// Covers:
AmsiScanBuffer := xor("sysblocktraced", []byte{0x32, 0x14, 0x0, 0xb, 0x3f, 0xc, 0x2, 0x5, 0x36, 0x7, 0x7, 0x5, 0x0, 0x16}) // AmsiScanBuffer

Powershell Example

$ ./obfuscate-xor -language powershell
# Helper xor function:
function xor {
    Param(
        [Parameter(Position = 0, Mandatory = $True)] $plain,
        [Parameter(Position = 1, Mandatory = $True)] $key
    )
    $r = ""
    $plaintext.ToCharArray() | foreach-object -process {
        $r += [char]([byte][char]$_ -bxor $key[$r.Length % $key.Length])
    }
    return $r
}
# Covers:
$AmsiScanBuffer = xor -plain "sysblocktraced" -key @(0x32,0x14,0x0,0xb,0x3f,0xc,0x2,0x5,0x36,0x7,0x7,0x5,0x0,0x16)

FAQs

Package last updated on 27 May 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts