]> bicyclesonthemoon.info Git - botm/www-trap/commitdiff
First commit of trap main
authorb <b@bicyclesonthemoon.info>
Thu, 8 Sep 2022 20:50:11 +0000 (20:50 +0000)
committerb <b@bicyclesonthemoon.info>
Thu, 8 Sep 2022 20:50:11 +0000 (20:50 +0000)
makefile [new file with mode: 0644]
trap.c [new file with mode: 0644]
trap.conf [new file with mode: 0644]

diff --git a/makefile b/makefile
new file mode 100644 (file)
index 0000000..d4dfe7c
--- /dev/null
+++ b/makefile
@@ -0,0 +1,56 @@
+CC=gcc
+CF=-g -Wall
+
+MV    = mv
+CP    = cp
+RM    = rm
+MKDIR = mkdir
+
+BIN_DIR  = /botm/bin/trap
+CONF_DIR = /botm/etc/www/conf
+
+
+CONF=1190 baltixy botm rnk
+
+
+# LF=-lIL
+#LF2=-lcgi
+
+all: trap
+       
+
+trap: trap.c
+       $(CC) $(CF) -o trap trap.c
+
+bin_dir:
+       $(MKDIR) -p $(BIN_DIR)
+
+cp_bin: trap | bin_dir
+       $(CP) trap $(BIN_DIR)
+
+conf_dir:
+       $(MKDIR) -p $(CONF_DIR)
+
+cp_conf: $(CONF)
+       
+
+$(CONF): trap.conf | conf_dir
+       $(MKDIR) -p $(CONF_DIR)/$@
+       $(CP) trap.conf $(CONF_DIR)/$@
+
+install: cp_bin cp_conf
+       
+
+rm_bin:
+       $(RM) -f $(BIN_DIR)/trap
+
+rm_conf:
+       $(RM) -f $(foreach conf, $(CONF), $(CONF_DIR)/$(conf)/trap.conf)
+
+uninstall: rm_bin rm_conf
+       
+
+clean:
+       $(RM) -r trap
+
+.PHONY: all bin_dir cp_bin conf_dir cp_conf install rm_bin rm_conf uninstall clean $(CONF)
diff --git a/trap.c b/trap.c
new file mode 100644 (file)
index 0000000..6ab3c00
--- /dev/null
+++ b/trap.c
@@ -0,0 +1,60 @@
+// TRAAAP ! ! !
+//#include <cgi.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+
+int main (int argc, char *argv[])
+{
+       //s_cgi *cgi;
+       
+       unsigned long randomhex;
+       //cgi=cgiInit();
+       
+       sscanf(((getenv("PATH_INFO")!=NULL)?(getenv("PATH_INFO")+1):""),"%lx",&randomhex);
+       srand(randomhex);
+       
+       printf("Content-type: text/html\n\n");
+       fputs("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"\"><html lang=\"en\"><head>\n",stdout);
+       printf("<title>Oh no, the trap! &bull; 0x%08lx &bull; Bicycles on the Moon</title>\n",randomhex);
+       fputs("<link rel=\"home\" title=\"1190\" href=\"/\"><link rel=\"stylesheet\" href=\"/css/botm.css\"><link rel=\"icon\" type=\"image/png\" href=\"/img/favicon.png\">\n",stdout);
+       fputs("<meta http-equiv=\"Content-type\" content=\"text/html; charset=utf-8\"></head><body>\n",stdout);
+       //fputs("<img src=\"/img/botmlogo2.png\" alt=\"1190.bicyclesonthemoon.info\" border=\"0\">\n",stdout);
+       fputs("<H1>Oh no, the trap!</H1>\n",stdout);
+       printf("Your number is: 0x%08lx<br>\n",randomhex);
+       fputs("Please see these too:<ul><li>\n",stdout);
+       randomhex=rand();
+       printf("<a href=\"/trap/%08lx\">0x%08lx</a>\n",randomhex,randomhex);
+       fputs("</li><li>\n",stdout);
+       randomhex=rand();
+       printf("<a href=\"/trap/%08lx\">0x%08lx</a>\n",randomhex,randomhex);
+       fputs("</li><li>\n",stdout);
+       randomhex=rand();
+       printf("<a href=\"/trap/%08lx\">0x%08lx</a>\n",randomhex,randomhex);
+       fputs("</li><li>\n",stdout);
+       randomhex=rand();
+       printf("<a href=\"/trap/%08lx\">0x%08lx</a>\n",randomhex,randomhex);
+       fputs("</li><li>\n",stdout);
+       randomhex=rand();
+       printf("<a href=\"/trap/%08lx\">0x%08lx</a>\n",randomhex,randomhex);
+       fputs("</li></ul>\n",stdout);
+       fputs("But don't look at these:<ul><li>\n",stdout);
+       randomhex=rand();
+       printf("<a href=\"/trap/%08lx\">0x%08lx</a>\n",randomhex,randomhex);
+       fputs("</li><li>\n",stdout);
+       randomhex=rand();
+       printf("<a href=\"/trap/%08lx\">0x%08lx</a>\n",randomhex,randomhex);
+       fputs("</li><li>\n",stdout);
+       randomhex=rand();
+       printf("<a href=\"/trap/%08lx\">0x%08lx</a>\n",randomhex,randomhex);
+       fputs("</li><li>\n",stdout);
+       randomhex=rand();
+       printf("<a href=\"/trap/%08lx\">0x%08lx</a>\n",randomhex,randomhex);
+       fputs("</li><li>\n",stdout);
+       randomhex=rand();
+       printf("<a href=\"/trap/%08lx\">0x%08lx</a>\n",randomhex,randomhex);
+       fputs("</li></ul></body></html>\n",stdout);
+       
+       
+       return 0;
+}
diff --git a/trap.conf b/trap.conf
new file mode 100644 (file)
index 0000000..78faab3
--- /dev/null
+++ b/trap.conf
@@ -0,0 +1,7 @@
+#The TRAP for bots!
+
+ScriptAlias /trap /botm/bin/trap/trap
+
+<Directory /botm/bin/trap>
+       Require all granted
+</Directory>