mirror of
https://github.com/xor-gate/go-socks5-ssh-proxy
synced 2026-03-23 06:16:35 +01:00
Fix go upx-obfuscator
This commit is contained in:
37
cmd/upx-obfuscator/main.go
Normal file
37
cmd/upx-obfuscator/main.go
Normal file
@ -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")
|
||||
}
|
||||
Reference in New Issue
Block a user