Something when wrong during the obfuscation. Wrong shellcode format?
AbdulRafeyKhan opened this issue · comments
AbdulRafeyKhan commented
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 commented
please help me out i am not able to understand where the error is in this code