This is a Simple Python remote command (Simple python shell - SPyShell) with password protected

#!/usr/bin/env python
# Simple python shell by Pham Duc Hai (duchaikhtn@gmail.com)
# http://guru.net.vn
import socket
import os
import commands
host = ''
port = 2009
password = 'secretcode'
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.bind((host, port))
s.listen(1)
print "Server is running on port %d; press Ctrl-C to terminate." % port
clientsock, clientaddr = s.accept()
clientfile = clientsock.makefile('rw', 0)
clientfile.write("SPyShell by Pham Duc Hai\n")
clientfile.write("Welcome, " + str(clientaddr) + "\n")
while 1:
clientfile.write("Please enter password: ")
line = clientfile.readline().strip()
if line == password:
clientfile.write('\n\r# ')
while 1:
line = clientfile.readline().strip()
if line == "exit":
clientfile.close()
clientsock.close()
output = commands.getstatusoutput(line)
for i in output:
clientfile.write(i)
clientfile.write('\n\r# ')
else:
clientfile.write('Wrong password!\n\r')
Download :
SpyShell.txt (1,11 KB)SpyShell.zip (,65 KB)