commit 818a107537b326a259df4f282906815a64b0fce2 Author: khuxkm Date: Tue Jul 3 00:25:25 2018 -0400 Initial commit diff --git a/cgi-bin/gopher.py b/cgi-bin/gopher.py new file mode 100644 index 0000000..bfe010d --- /dev/null +++ b/cgi-bin/gopher.py @@ -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) diff --git a/cgi-bin/intest b/cgi-bin/intest new file mode 100755 index 0000000..0fbe04f --- /dev/null +++ b/cgi-bin/intest @@ -0,0 +1,4 @@ +#!/usr/bin/env python3 +import os + +print("i{}\t\tnull.host\t1".format(os.environ["QUERY_STRING"])) diff --git a/cgi-bin/libtest b/cgi-bin/libtest new file mode 100755 index 0000000..9f1409e --- /dev/null +++ b/cgi-bin/libtest @@ -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.") diff --git a/cgi-bin/test b/cgi-bin/test new file mode 100755 index 0000000..d6bf32f --- /dev/null +++ b/cgi-bin/test @@ -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)) diff --git a/gophermap b/gophermap new file mode 100644 index 0000000..3c57121 --- /dev/null +++ b/gophermap @@ -0,0 +1,2 @@ +ihi all null.host 1 +0libgopher /~khuxkm/cgi-bin/libtest tilde.team 70