unixpickle / gobfuscate

Obfuscate Go binaries and packages
BSD 2-Clause "Simplified" License
1.45k stars 157 forks source link

[Bug] Obfuscating strings with predefined variables #45

Closed usiegl00 closed 3 years ago

usiegl00 commented 3 years ago

When obfuscating strings inside a function that already has len or make defined as variables. Go throws the following error:

cannot call non-function len

Example code:

package main

import "fmt"

func main() {
    var len = 5
    var str = "Hello, World!"
    fmt.Println(str[:len])
}

This issue appears in most of the golang.org/x/sys/unix/syscall code.

One solution would be to detect when the variables are in use and to use a different method to obfuscate strings in that function.