Skip to content
This repository has been archived by the owner on Mar 20, 2023. It is now read-only.

Something when wrong during the obfuscation. Wrong shellcode format? #33

Open
AbdulRafeyKhan opened this issue May 23, 2020 · 1 comment

Comments

@AbdulRafeyKhan
Copy link

def gen_shellcode(self, shellcode):
    shellcode = shellcode.replace("\r", "").replace("\n", "")
    try:
        key = self.gen_key()
        self.ui.print_msg("Generating obfuscation key 0x%s".join([f'\\x{b:02x}' for b in data]))
        #self.ui.print_msg("Generating obfuscation key 0x%s" % key.encode().hex())
        shellcode = self.pad_shellcode(shellcode)
        magic = self.gen_magic()
        self.ui.print_msg("Generating magic bytes %s" % hex(magic))
        shellcode = hex(magic)[2:10].decode("hex") + shellcode
        shellcode = self.xor_payload(shellcode, key)
        size = len(shellcode)
        shellcode = self.set_decoder(hex(magic)[2:10].decode("hex"), (size - 4)) + shellcode
        for i in range(1, 5):
            shellcode = shellcode.replace("[RAND" + str(i) + "]", self.gen_pop(hex(self.gen_magic())[2:10].decode("hex")))
        self.ui.print_msg("Final shellcode length is %s (%d) bytes" % (hex(len(shellcode)), len(shellcode)))
        if self.is_debug():
            print
        return shellcode
    except:
        self.ui.print_error("Something when wrong during the obfuscation. Wrong shellcode format?")
        return False

can you explain me this piece of code it's showing error again and again

@AbdulRafeyKhan
Copy link
Author

please help me out i am not able to understand where the error is in this code

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

No branches or pull requests

1 participant