diff options
author | Epoch Qwert <epoch@53flpnlls43fcguy.onion> | 2015-01-11 03:01:37 -0600 |
---|---|---|
committer | Epoch Qwert <epoch@53flpnlls43fcguy.onion> | 2015-01-11 03:01:37 -0600 |
commit | 42d9771ba0c2e3491025e24956c995a7db56372c (patch) | |
tree | 58bdbd0473d0789a59864063410b9ef5a9a1bcb6 | |
parent | 3f6b64304a8a11f0505e91681384327696983928 (diff) | |
download | misc-42d9771ba0c2e3491025e24956c995a7db56372c.tar.gz misc-42d9771ba0c2e3491025e24956c995a7db56372c.zip |
fuck if I know. I was just going to add the gateway. >_>
-rwxr-xr-x | nocompile/libexec/gopherd.sh | 5 | ||||
-rwxr-xr-x | nocompile/libexec/telnet-gateway.sh | 17 | ||||
-rw-r--r-- | src/libexec/httpd.c | 12 |
3 files changed, 30 insertions, 4 deletions
diff --git a/nocompile/libexec/gopherd.sh b/nocompile/libexec/gopherd.sh index d710f80..78509dc 100755 --- a/nocompile/libexec/gopherd.sh +++ b/nocompile/libexec/gopherd.sh @@ -10,6 +10,7 @@ # "export hostname" down there. export PATH=$PATH:/usr/local/bin read -t 10 req +logger -t gopher "$(/usr/local/libexec/peerip|head -n1): ${req}" base="$1" arg=$(echo "$req" | tr -d '\r' | cut -f2) #req=$(echo "$req" | unescape | tr -d '\r' | cut -f1) @@ -33,14 +34,14 @@ else printf "" # echo "fucked off #1" # echo "$myIP != $(gethostbyname $hostname 6)" -# logger "hostname (${hostname}) and IP (${myIP}) aren't matching up."; +# logger -t gopher "hostname (${hostname}) and IP (${myIP}) aren't matching up."; # exit 2 #jimmy cracked corn but nobody gives a shit. fi else if [ $(gethostbyname $hostname) != ${myIP} ];then echo "fucked off #2" - logger "hostname (${hostname}) and IP (${myIP}) aren't matching up."; + logger -t gopher "hostname (${hostname}) and IP (${myIP}) aren't matching up."; exit 2 fi fi diff --git a/nocompile/libexec/telnet-gateway.sh b/nocompile/libexec/telnet-gateway.sh new file mode 100755 index 0000000..ca2b90d --- /dev/null +++ b/nocompile/libexec/telnet-gateway.sh @@ -0,0 +1,17 @@ +#!/bin/bash +grep "^telnet:" /var/www/sites/hacking/links.txt \ + | cat -n +printf "Which do you want to connect to?\nnumber: " +read N +export N=$(printf "%s" "$N" | sed "s/[^0-9]//g") +serverURL=$(grep "^telnet:" /var/www/sites/hacking/links.txt \ + | cut '-d ' -f1 \ + | head -n${N} \ + | tail -n1) +echo "You've selected: $serverURL (#$N)" +printf "connecting in...\n" +for i in `seq 5 1`;do + printf "\r%d..." $i + sleep 1 +done +nc $(printf "%s" "$serverURL" | cuturl | grep ^domain | cut '-d ' -f2) 23 diff --git a/src/libexec/httpd.c b/src/libexec/httpd.c index 812e051..41339ae 100644 --- a/src/libexec/httpd.c +++ b/src/libexec/httpd.c @@ -5,6 +5,9 @@ #include <unistd.h> #include <syslog.h> #include <sys/wait.h> +#include <sys/socket.h> +#include <netdb.h> +#include <netinet/in.h> #define VHOST_ROOT "/var/www/vhosts" #define SITES_ROOT "/var/www/sites" @@ -26,8 +29,12 @@ int main(int argc,char *argv[]) { char *get_param; char line[getpagesize()]; fgets(line,sizeof(line)-1,stdin); -// syslog(LOG_INFO,"ADDRESS did a LINE"); -// syslog(LOG_WARNING,"httpd syslog test\n"); + struct sockaddr_in6 sa6; + unsigned int sl=sizeof(sa6); + char h[NI_MAXHOST]; + if(getpeername(0,(struct sockaddr *)&sa6,&sl) == -1) syslog(LOG_WARNING,"getpeername: %m"); + getnameinfo((struct sockaddr *)&sa6,sl,h,sizeof(h),0,0,NI_NUMERICHOST); + setenv("REMOTE_ADDR",h,1); if(!strchr(line,'\n')) { printf("HTTP/1.1 413 Entity Too Large\r\n"); standard_headers(); @@ -36,6 +43,7 @@ int main(int argc,char *argv[]) { return 0; } if(strchr(line,'\r')) *strchr(line,'\r')=0; + syslog(LOG_WARNING,"%s %s\n",h,line); method=strdup(line); if((page=strchr(method,' '))) { *page=0; |