diff --git a/README.md b/README.md index 61069a1..bdb5af4 100644 --- a/README.md +++ b/README.md @@ -75,3 +75,5 @@ Following detections have been tested: * * * > +* +* diff --git a/cmd/upx_obfuscator/main.go b/cmd/upx_obfuscator/main.go new file mode 100644 index 0000000..ba6643c --- /dev/null +++ b/cmd/upx_obfuscator/main.go @@ -0,0 +1,37 @@ +package main + +import ( + "os" + "bytes" + "log" +) + +var originalIdentifier = []byte("UPX0") +var obfuscatedIdentifier = []byte("GSP7") + +func main() { + if len(os.Args) != 2 { + log.Fatalln("Specify exe file to obfuscate") + } + + filename := os.Args[1] + + log.Println("Obfuscating UPX compressed executable file") + log.Println("\t", filename) + + data, _ := os.ReadFile(filename) + + foundIndex := bytes.Index(data, originalIdentifier) + if foundIndex > -1 { + // Found it! + log.Println("Found UPX identifier at offset", foundIndex) + } else { + log.Fatalln("Error file is not UPX packed") + } + + + obfuscatedData := bytes.Replace(data, originalIdentifier, obfuscatedIdentifier, 1) + _ = os.WriteFile(filename, obfuscatedData, 0666) + + log.Println("done") +}