Skip to content

Instantly share code, notes, and snippets.

@pyperanger
Created September 11, 2020 13:14
Show Gist options
  • Save pyperanger/54c6a60a7b1f5f3294c543c2b08b0d6c to your computer and use it in GitHub Desktop.
Save pyperanger/54c6a60a7b1f5f3294c543c2b08b0d6c to your computer and use it in GitHub Desktop.
F4ck ofuscation shells
package main
import (
"fmt"
"io/ioutil"
"regexp"
"strconv"
"strings"
"flag"
)
var (
fname = flag.String("f", "", "File Name")
)
func replace(text string, chr string ) string {
c, _ := strconv.Atoi(chr)
tochg := "chr("+chr+")"
torpl := `"`+string(c)+`"`
txt := strings.Replace(text, tochg, torpl, -1)
return txt
}
func main() {
flag.Parse()
if *fname == "" {
flag.Usage()
return
}
obfusfile, err := ioutil.ReadFile(*fname)
if err != nil {
fmt.Println(err)
return
}
obfustext := string(obfusfile)
//var deofus string
var re = regexp.MustCompile(`(?m)chr\((\d+)\)`)
res := re.FindAllStringSubmatch(obfustext, -1)
for i := range res {
obfustext = replace(obfustext, res[i][1])
}
obfustext = strings.Replace(obfustext, "\"", "" , -1)
obfustext = strings.Replace(obfustext, ".", "" , -1)
fmt.Println(obfustext)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment