This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys, os, socket | |
s = socket.socket() | |
s.bind((sys.argv[1], int(sys.argv[2]))) | |
s.listen(5) | |
try: | |
while True: | |
conn, addr = s.accept() | |
path = os.path.join(os.getcwd(), "./"+conn.recv(4096).split("\n")[0].split(" ")[1]) | |
conn.send((open(path).read() if os.path.isfile(path) else reduce(lambda x,s:x+"\n"+s+("/" if os.path.isdir(s) else ""),sorted(os.listdir(path)),"Directory "+path+" ls")) if os.path.exists(path) else '404: '+path) | |
conn.close() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
stack = [] | |
compileStacks = [] | |
words = {} | |
builtins = {} | |
lambdaType = type(lambda x: x) #cannot compare against the function type directly for some reason | |
def prn(o): | |
print(o) | |
def clr(l): |
NewerOlder