Linux Shellcode Development (Based on the buffer overflow topic) Lab
#!/usr/bin/python3 # Run "xxd -p -c 20 rev_sh.o", # copy and paste the machine code to the following: ori_sh =""" copy and paste machie code here """ sh = ori_sh.replace("\n", "") length = int(len(sh)/2) print("Length of the shellcode: {}".format(length)) s = 'shellcode= (\n' + ' "' for i in range(length): s += "\\x" + sh[2*i] + sh[2*i+1] if i > 0 and i % 16 == 15: s += '"\n' + ' "' s += '"\n' + ").encode('latin-1')" print(s)