From: b Date: Fri, 6 Nov 2015 17:22:57 +0000 (+0000) Subject: First version. X-Git-Url: http://bicyclesonthemoon.info/git-projects/?a=commitdiff_plain;h=e7ac41e5b31a23fa996600f637baebba279f7381;p=yplom%2Fproxy First version. git-svn-id: svn://botcastle1b/yplom/proxy@1 05ce6ebb-7522-4a6e-a768-0026ae12be9f --- e7ac41e5b31a23fa996600f637baebba279f7381 diff --git a/makefile b/makefile new file mode 100644 index 0000000..5d0c7e3 --- /dev/null +++ b/makefile @@ -0,0 +1,27 @@ +CC=gcc +#CC2=g++ +CF=-g -Wall +#LF=-lIL +LF2=-lcgi + +OD=/yplom/bin/proxy + +all: moveout copyout + +moveout: proxy setuid exec + mv proxy $(OD) + +copyout: rewrite setuid exec + cp rewrite $(OD) + +setuid: proxy + chmod u+s proxy + +exec: rewrite proxy + chmod +x rewrite proxy + +#proxy: proxy.c +# $(CC) $(CF) -o proxy proxy.c + +proxy: proxy.pl + cp proxy.pl proxy diff --git a/proxy.pl b/proxy.pl new file mode 100755 index 0000000..fd80538 --- /dev/null +++ b/proxy.pl @@ -0,0 +1,55 @@ +#!/usr/bin/perl + +use constant UNLOCK_PROXY_URL => '/proxy/unlock'; +use constant UNLOCK_PROXY_HOST => qr/^yplom\.bicyclesonthemoon\.info(:[0-9]*)?$/; +use constant UNLOCK_PROXY_PATH => qr/^\/proxy\/unlock\/?$/; + +if (($ENV{'HTTP_HOST'} =~ UNLOCK_PROXY_HOST) and ($ENV{'PATH_INFO'} =~ UNLOCK_PROXY_PATH)){ +# if (($ENV{'HTTP_HOST'} =~ /^yplom\.bicyclesonthemoon\.info(:(590)?80)?$/) and ($ENV{'PATH_INFO'} =~ /^\/proxy\/unlock\/?$/)){ + unlockpage(); +} +else { + debag(); +} + +sub unlockpage { + print "Content-type: text/html\n\n"; + print ''; + print ''; + print 'Unlock the proxy'; + print ''; + print ''; + print '

Unlock the proxy

'; + print '
'; + print 'Username:
'; + print 'Password:
'; + print ''; + print '
'; + print "\n"; +} + +sub debag { + print "Content-type: text/plain\n\n"; + print foreach $envk (keys %ENV) { + print "$envk = $ENV{$envk}\n"; + } + print "\n"; + + foreach $line ( ) { + print $line; + } + print "\n\n"; + if ($ENV{'REQUEST_URI'} =~ /^[a-z]*(:[0-9]*)?:\/\//){ + #if + $URL=$ENV{'REQUEST_URI'} + } + else{ + $URL='http://'.$ENV{'HTTP_HOST'}.$ENV{'REQUEST_URI'}; + } + print 'URL: ',$URL,"\n"; +} + + + + + diff --git a/rewrite b/rewrite new file mode 100755 index 0000000..cbef212 --- /dev/null +++ b/rewrite @@ -0,0 +1,2 @@ +#!/bin/sh +echo "OK rewrite-url=\"bicyclesonthemoon.info:59443\""