Initial commit

This commit is contained in:
Robert Miles 2018-07-03 00:25:25 -04:00
commit 818a107537
5 changed files with 50 additions and 0 deletions

30
cgi-bin/gopher.py Normal file
View File

@ -0,0 +1,30 @@
import os,subprocess
def get_input():
return os.environ.get("QUERY_STRING","")
def line(type,text,selector="",host="",port="",skip=False):
print("{}{}\t{}\t{}\t{}".format(type,text,selector,host,port))
def title(name):
line("!",name)
def link_dir(text,selector,host="",port=""):
line("1",text,selector,host,port)
def link(text,selector,host="",port=""):
line("0",text,selector,host,port)
def text(text):
line("i",text," ".strip(),"null.host","1")
def figlet(tex,**opts):
if len(opts.keys())==0:
opts = {"f":"standard"}
ct = ["/usr/bin/figlet"]
for k in opts:
ct.append("-"+k)
ct.append(opts[k])
ct.append(tex)
for line in subprocess.check_output(ct).decode("ascii").split("\n"):
text(line)

4
cgi-bin/intest Executable file
View File

@ -0,0 +1,4 @@
#!/usr/bin/env python3
import os
print("i{}\t\tnull.host\t1".format(os.environ["QUERY_STRING"]))

8
cgi-bin/libtest Executable file
View File

@ -0,0 +1,8 @@
#!/usr/bin/env python3
from gopher import *
figlet("libgopher",f="slant")
text("")
text("libgopher is a python lib for making")
text("gopher CGI scripts. it defines functions")
text("which allow for easy formatting of output.")

6
cgi-bin/test Executable file
View File

@ -0,0 +1,6 @@
#!/usr/bin/env python3
import subprocess
print("iuptime\t\tnull.host\t1")
res = subprocess.check_output("uptime",shell=True).decode("utf-8").strip()
print("i{}\t\tnull.host\t1".format(res))

2
gophermap Normal file
View File

@ -0,0 +1,2 @@
ihi all null.host 1
0libgopher /~khuxkm/cgi-bin/libtest tilde.team 70