Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simple way to deobfuscate #9

Open
namdevel opened this issue Apr 11, 2022 · 3 comments
Open

Simple way to deobfuscate #9

namdevel opened this issue Apr 11, 2022 · 3 comments

Comments

@namdevel
Copy link

namdevel commented Apr 11, 2022

i make simple code to deobfuscate
check here : namdevel/bersekered

import os, sys, re
import subprocess
  
def write(file_name, data):
    f = open(file_name, "w")
    f.write(data)
    f.close()


if __name__ == "__main__":

    obf_file = "obfuscated.py"  # obfuscated file

    with open(obf_file) as code:
        data = code.read()
        
        s1 = re.search("if self.(.+?) in open", data).group(1)
        s1s = s1.replace("15", "12")
        s2 = re.findall("{(.+?)}", data)

        source = (
            data.replace(s1, s1s)
            .replace("{" + s2[0] + "}", "print")
            .replace(",{" + s2[1] + "}()", "")
        )
        write('tmpfile.py', source)
        subprocess.run(f"py tmpfile.py") # show real code in terminal
        os.unlink('tmpfile.py')
@TNPfffffff
Copy link

hi

@TNPfffffff
Copy link

can u help me decode ?

@namdevel
Copy link
Author

tele @DevSprout

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants