Skip to content

Instantly share code, notes, and snippets.

@fordnox
Created March 21, 2014 08:04
Show Gist options
  • Save fordnox/9681706 to your computer and use it in GitHub Desktop.
Save fordnox/9681706 to your computer and use it in GitHub Desktop.
python proxy
#!/usr/bin/python
import json
from subprocess import Popen, PIPE
txt = raw_input();
cmd = txt.split()
o = None
e =None
try:
p = Popen(cmd, stdout=PIPE, stderr=PIPE)
o, e = p.communicate()
except:
e = str(sys.exc_info()[0])
print json.dumps({"stdout": o, "stderr":e})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment