aboutsummaryrefslogtreecommitdiffstats
path: root/nyancat.py
diff options
context:
space:
mode:
authorAaron Peschel <aaron.peschel@gmail.com>2011-11-30 21:06:11 -0800
committerAaron Peschel <aaron.peschel@gmail.com>2011-11-30 21:46:00 -0800
commit900194edee61b6dded593e04b435e9b7c9ca0517 (patch)
treee6ecef21e6d002d7e8e8ef7d67e82f8a6c66e60d /nyancat.py
parentcb850e9ab9b70f183ef9afbda9952110b3922204 (diff)
downloadnyancat-900194edee61b6dded593e04b435e9b7c9ca0517.tar.gz
Made project more in line with Autotools standard.
Diffstat (limited to 'nyancat.py')
-rwxr-xr-xnyancat.py41
1 files changed, 0 insertions, 41 deletions
diff --git a/nyancat.py b/nyancat.py
deleted file mode 100755
index 039581c..0000000
--- a/nyancat.py
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/usr/bin/env python
-import SocketServer
-import threading, os
-from subprocess import Popen, PIPE
-from telnetsrvlib import TelnetHandler
-
-class TNS(SocketServer.ThreadingMixIn, SocketServer.TCPServer):
- allow_reuse_address = True
-
-class TNH(TelnetHandler):
- def handle(self):
- print self.TERM
- p = Popen(["./nyancat"], shell=False, stdout=PIPE, stdin=PIPE, bufsize=0)
- if (self.TERM.lower().find("xterm") != -1):
- p.stdin.write("1\n")
- elif (self.TERM.lower().find("linux") != -1):
- p.stdin.write("3\n")
- elif (self.TERM.lower().find("fallback") != -1):
- p.stdin.write("4\n")
- elif (self.TERM.lower().find("rxvt") == 0):
- p.stdin.write("3\n")
- else:
- p.stdin.write("2\n")
- while 1:
- s = p.stdout.read(1024)
- try:
- self.write(s)
- except:
- p.kill()
- return
-
-class serverThread(threading.Thread):
- def run(self):
- tns = TNS(("0.0.0.0", 23), TNH)
- tns.serve_forever()
-
-if __name__ == "__main__":
- t = serverThread()
- t.start()
- raw_input("Let me know when to stop.")
- os.kill(os.getpid(), 9)