X7ROOT File Manager
Current Path:
/lib64/python2.7/Demo/sockets
lib64
/
python2.7
/
Demo
/
sockets
/
??
..
??
README
(628 B)
??
broadcast.py
(283 B)
??
broadcast.pyc
(547 B)
??
broadcast.pyo
(547 B)
??
echosvr.py
(738 B)
??
echosvr.pyc
(827 B)
??
echosvr.pyo
(827 B)
??
finger.py
(1.23 KB)
??
finger.pyc
(1.13 KB)
??
finger.pyo
(1.13 KB)
??
ftp.py
(3.84 KB)
??
ftp.pyc
(2.88 KB)
??
ftp.pyo
(2.88 KB)
??
gopher.py
(9.55 KB)
??
gopher.pyc
(10.08 KB)
??
gopher.pyo
(10.08 KB)
??
mcast.py
(2.16 KB)
??
mcast.pyc
(2.12 KB)
??
mcast.pyo
(2.12 KB)
??
radio.py
(287 B)
??
radio.pyc
(471 B)
??
radio.pyo
(471 B)
??
rpython.py
(713 B)
??
rpython.pyc
(982 B)
??
rpython.pyo
(982 B)
??
rpythond.py
(1.18 KB)
??
rpythond.pyc
(1.3 KB)
??
rpythond.pyo
(1.3 KB)
??
telnet.py
(2.94 KB)
??
telnet.pyc
(2.1 KB)
??
telnet.pyo
(2.1 KB)
??
throughput.py
(2.04 KB)
??
throughput.pyc
(2.42 KB)
??
throughput.pyo
(2.42 KB)
??
udpecho.py
(1.43 KB)
??
udpecho.pyc
(1.98 KB)
??
udpecho.pyo
(1.98 KB)
??
unicast.py
(230 B)
??
unicast.pyc
(456 B)
??
unicast.pyo
(456 B)
??
unixclient.py
(232 B)
??
unixclient.pyc
(424 B)
??
unixclient.pyo
(424 B)
??
unixserver.py
(414 B)
??
unixserver.pyc
(593 B)
??
unixserver.pyo
(593 B)
Editing: rpythond.py
#! /usr/bin/python2.7 # Remote python server. # Execute Python commands remotely and send output back. # WARNING: This version has a gaping security hole -- it accepts requests # from any host on the Internet! import sys from socket import * import StringIO import traceback PORT = 4127 BUFSIZE = 1024 def main(): if len(sys.argv) > 1: port = int(eval(sys.argv[1])) else: port = PORT s = socket(AF_INET, SOCK_STREAM) s.bind(('', port)) s.listen(1) while 1: conn, (remotehost, remoteport) = s.accept() print 'connected by', remotehost, remoteport request = '' while 1: data = conn.recv(BUFSIZE) if not data: break request = request + data reply = execute(request) conn.send(reply) conn.close() def execute(request): stdout = sys.stdout stderr = sys.stderr sys.stdout = sys.stderr = fakefile = StringIO.StringIO() try: try: exec request in {}, {} except: print traceback.print_exc(100) finally: sys.stderr = stderr sys.stdout = stdout return fakefile.getvalue() main()
Upload File
Create Folder