Mini Shell
import io
import socket
import sys
import os
import message_reader
def main():
php_dict = message_reader.fillDictionary()
server_address = '/tmp/go.sock'
try:
os.unlink(server_address)
except OSError:
if os.path.exists(server_address):
raise
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
print >>sys.stderr, 'starting up on %s' % server_address
sock.bind(server_address)
os.chmod(server_address, 0o777)
sock.listen(1)
while True:
print >>sys.stderr, 'waiting for a connection'
connection, client_address = sock.accept()
try:
print >>sys.stderr, 'connection from', client_address
file = io.open(connection.fileno(), "rb", buffering = 0)
while True:
obj = message_reader.readDataFromStream(file)
if obj=="":
break
queue = obj.proactive.queue_string.split("|")
print "[",
for item in queue:
index_letter = item[0].lower()
if index_letter == 'a':
print "ANYOP(%s)" % (item[1:]),
else:
bad = ""
if item[0].isupper():
bad = "(BAD)"
print "%s%s" % (php_dict[index_letter],bad),
print "]"
file.close()
finally:
connection.close()
if __name__== "__main__":
main()
Zerion Mini Shell 1.0