Socket
Socket
Sign inDemoInstall

github.com/brimstone/obfuscate-xor

Package Overview
Dependencies
0
Alerts
File Explorer

Install Socket

Detect and block malicious and high-risk dependencies

Install

    github.com/brimstone/obfuscate-xor


Version published

Readme

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

Last updated on 27 May 2021

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc