Skip to content

Instantly share code, notes, and snippets.

@isra17
Created March 1, 2014 06:55
Show Gist options
  • Save isra17/9286255 to your computer and use it in GitHub Desktop.
Save isra17/9286255 to your computer and use it in GitHub Desktop.
import socket
import os, sys
HOST = ''
PORT = 50006
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind((HOST, PORT))
s.listen(1)
conn, addr = s.accept()
os.dup2(conn.fileno(), sys.stdout.fileno())
os.dup2(conn.fileno(), sys.stdin.fileno())
os.execvp(sys.argv[1],sys.argv[1:])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment