mirror of
				https://github.com/3proxy/3proxy.git
				synced 2025-11-04 07:42:39 +08:00 
			
		
		
		
	Merge remote-tracking branch 'refs/remotes/origin/devel'
This commit is contained in:
		
						commit
						09cfc076e2
					
				
							
								
								
									
										18
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										18
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@ -15,9 +15,23 @@ tmp/
 | 
			
		||||
*.swp
 | 
			
		||||
*.o
 | 
			
		||||
*.idb
 | 
			
		||||
src/res
 | 
			
		||||
res
 | 
			
		||||
version.c
 | 
			
		||||
3proxy.res
 | 
			
		||||
 | 
			
		||||
src/3proxy
 | 
			
		||||
src/proxy
 | 
			
		||||
src/socks
 | 
			
		||||
src/tcppm
 | 
			
		||||
src/udppm
 | 
			
		||||
src/pop3p
 | 
			
		||||
src/smtpp
 | 
			
		||||
src/ftppr
 | 
			
		||||
src/icqpr
 | 
			
		||||
src/mycrypt
 | 
			
		||||
src/dighosts
 | 
			
		||||
*.ld.so
 | 
			
		||||
*.dSYM
 | 
			
		||||
doc/html/man3/
 | 
			
		||||
doc/html/man8/
 | 
			
		||||
doc/html/index.html
 | 
			
		||||
@ -25,7 +39,6 @@ doc/html/index.html
 | 
			
		||||
verfile.sh
 | 
			
		||||
Makefile
 | 
			
		||||
Changelog
 | 
			
		||||
res
 | 
			
		||||
copytgz.sh
 | 
			
		||||
*~.nib
 | 
			
		||||
local.properties
 | 
			
		||||
@ -157,7 +170,6 @@ csx
 | 
			
		||||
AppPackages/
 | 
			
		||||
 | 
			
		||||
# Others
 | 
			
		||||
sql/
 | 
			
		||||
*.Cache
 | 
			
		||||
ClientBin/
 | 
			
		||||
[Ss]tyle[Cc]op.*
 | 
			
		||||
 | 
			
		||||
@ -19,6 +19,8 @@ DLFLAGS = -shared
 | 
			
		||||
DLSUFFICS = .ld.so
 | 
			
		||||
# -lpthreads may be reuqired on some platforms instead of -pthreads
 | 
			
		||||
LIBS = -lcrypto -lssl -ldl 
 | 
			
		||||
LIBSPREFIX = -l
 | 
			
		||||
LIBSSUFFIX = 
 | 
			
		||||
LNOUT = -o 
 | 
			
		||||
EXESUFFICS =
 | 
			
		||||
OBJSUFFICS = .o
 | 
			
		||||
@ -28,7 +30,7 @@ REMOVECOMMAND = rm -f
 | 
			
		||||
TYPECOMMAND = cat
 | 
			
		||||
COMPATLIBS =
 | 
			
		||||
MAKEFILE = Makefile.Linux
 | 
			
		||||
PLUGINS = SSLPlugin StringsPlugin TrafficPlugin PCREPlugin TransparentPlugin
 | 
			
		||||
PLUGINS = SSLPlugin StringsPlugin TrafficPlugin PCREPlugin TransparentPlugin PamAuth
 | 
			
		||||
 | 
			
		||||
include Makefile.inc
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -17,6 +17,8 @@ DCFLAGS = -fpic
 | 
			
		||||
DLFLAGS = -shared
 | 
			
		||||
DLSUFFICS = .ld.so
 | 
			
		||||
LIBS = -lpthread -lsocket -lnsl -lresolv -ldl
 | 
			
		||||
LIBSPREFIX = -l
 | 
			
		||||
LIBSSUFFIX = 
 | 
			
		||||
LNOUT = -o ./
 | 
			
		||||
EXESUFFICS =
 | 
			
		||||
OBJSUFFICS = .o
 | 
			
		||||
 | 
			
		||||
@ -18,6 +18,8 @@ DCFLAGS = -fpic
 | 
			
		||||
DLFLAGS = -shared
 | 
			
		||||
DLSUFFICS = .ld.so
 | 
			
		||||
LIBS = -lpthread -lsocket -lnsl -lresolv -ldl
 | 
			
		||||
LIBSPREFIX = -l
 | 
			
		||||
LIBSSUFFIX = 
 | 
			
		||||
LNOUT = -o ./
 | 
			
		||||
EXESUFFICS =
 | 
			
		||||
OBJSUFFICS = .o
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										34
									
								
								Makefile.ccc
									
									
									
									
									
								
							
							
						
						
									
										34
									
								
								Makefile.ccc
									
									
									
									
									
								
							@ -1,34 +0,0 @@
 | 
			
		||||
#
 | 
			
		||||
# 3 proxy Makefile for Compaq C Compiler
 | 
			
		||||
#
 | 
			
		||||
# You can try to remove -DWITH_STD_MALLOC to CFLAGS to use optimized malloc
 | 
			
		||||
# libraries
 | 
			
		||||
#
 | 
			
		||||
# remove -DNOODBC from CFLAGS and add -lodbc to LDFLAGS to compile with ODBC
 | 
			
		||||
# library support. Add -DSAFESQL for poorely written ODBC library / drivers.
 | 
			
		||||
 | 
			
		||||
BUILDDIR =
 | 
			
		||||
CC = ccc
 | 
			
		||||
CFLAGS = -O2 -c -pthread -D_THREAD_SAFE -DNOODBC -DWITH_STD_MALLOC -DFD_SETSIZE=4096 -WITH_POLL
 | 
			
		||||
COUT = -o 
 | 
			
		||||
LN = ccc
 | 
			
		||||
LDFLAGS = -O2 -pthread
 | 
			
		||||
DCFLAGS = -fpic
 | 
			
		||||
DLFLAGS = -shared
 | 
			
		||||
DLSUFFICS = .ld.so
 | 
			
		||||
LIBS =
 | 
			
		||||
LNOUT = -o 
 | 
			
		||||
EXESUFFICS =
 | 
			
		||||
OBJSUFFICS = .o
 | 
			
		||||
DEFINEOPTION = -D
 | 
			
		||||
COMPFILES = *~
 | 
			
		||||
REMOVECOMMAND = rm -f
 | 
			
		||||
TYPECOMMAND = cat
 | 
			
		||||
COMPATLIBS =
 | 
			
		||||
MAKEFILE = Makefile.ccc
 | 
			
		||||
PLUGINS = StringsPlugin TrafficPlugin PCREPlugin
 | 
			
		||||
 | 
			
		||||
include Makefile.inc
 | 
			
		||||
 | 
			
		||||
allplugins:
 | 
			
		||||
	@list='$(PLUGINS)'; for p in $$list; do cp Makefile Makefile.var plugins/$$p; cd plugins/$$p ; make ;	cd ../.. ; done
 | 
			
		||||
@ -17,6 +17,8 @@ LDFLAGS = -O2 -static -s
 | 
			
		||||
DLFLAGS = -shared
 | 
			
		||||
DLSUFFICS = .dll
 | 
			
		||||
LIBS = -lws2_32 -lodbc32 -ladvapi32
 | 
			
		||||
LIBSPREFIX = -l
 | 
			
		||||
LIBSSUFFIX = 
 | 
			
		||||
LNOUT = -o 
 | 
			
		||||
EXESUFFICS = .exe
 | 
			
		||||
OBJSUFFICS = .o
 | 
			
		||||
 | 
			
		||||
@ -16,6 +16,8 @@ DLFLAGS = /DLL
 | 
			
		||||
DLSUFFICS = .dll
 | 
			
		||||
LIBS = ws2_32.lib advapi32.lib odbc32.lib user32.lib kernel32.lib Gdi32.lib libeay32MT.lib ssleay32MT.lib
 | 
			
		||||
LIBSOLD = libeay32MT.lib ssleay32MT.lib
 | 
			
		||||
LIBSPREFIX = 
 | 
			
		||||
LIBSSUFFIX = .lib
 | 
			
		||||
LIBEXT = .lib                                                                                               
 | 
			
		||||
LNOUT = /out:
 | 
			
		||||
EXESUFFICS = .exe
 | 
			
		||||
 | 
			
		||||
@ -16,6 +16,8 @@ DLFLAGS = /DLL
 | 
			
		||||
DLSUFFICS = .dll
 | 
			
		||||
LIBS = ws2_32.lib advapi32.lib odbc32.lib user32.lib kernel32.lib Gdi32.lib libeay32MT.lib ssleay32MT.lib
 | 
			
		||||
LIBSOLD = libeay32MT.lib ssleay32MT.lib
 | 
			
		||||
LIBSPREFIX = 
 | 
			
		||||
LIBSSUFFIX = .lib
 | 
			
		||||
LIBEXT = .lib
 | 
			
		||||
LNOUT = /out:
 | 
			
		||||
EXESUFFICS = .exe
 | 
			
		||||
 | 
			
		||||
@ -21,6 +21,8 @@ DCFLAGS = -fpic
 | 
			
		||||
DLFLAGS = -shared
 | 
			
		||||
DLSUFFICS = .ld.so
 | 
			
		||||
LIBS =
 | 
			
		||||
LIBSPREFIX = -l
 | 
			
		||||
LIBSSUFFIX = 
 | 
			
		||||
LNOUT = -o 
 | 
			
		||||
EXESUFFICS =
 | 
			
		||||
OBJSUFFICS = .o
 | 
			
		||||
@ -30,7 +32,7 @@ REMOVECOMMAND = rm -f
 | 
			
		||||
TYPECOMMAND = cat
 | 
			
		||||
COMPATLIBS =
 | 
			
		||||
MAKEFILE = Makefile.unix
 | 
			
		||||
PLUGINS = StringsPlugin TrafficPlugin PCREPlugin
 | 
			
		||||
PLUGINS = StringsPlugin TrafficPlugin PCREPlugin PamAuth
 | 
			
		||||
 | 
			
		||||
include Makefile.inc
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -17,6 +17,8 @@ LDFLAGS = -O2 -s -mthreads
 | 
			
		||||
DLFLAGS = -shared
 | 
			
		||||
DLSUFFICS = .dll
 | 
			
		||||
LIBS = -lws2_32 -lodbc32 -ladvapi32
 | 
			
		||||
LIBSPREFIX = -l
 | 
			
		||||
LIBSSUFFIX = 
 | 
			
		||||
LNOUT = -o 
 | 
			
		||||
EXESUFFICS = .exe
 | 
			
		||||
OBJSUFFICS = .o
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										53
									
								
								cfg/sql/3proxy.cfg.sample
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										53
									
								
								cfg/sql/3proxy.cfg.sample
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,53 @@
 | 
			
		||||
# By Mark Dreuband
 | 
			
		||||
nserver 10.1.2.1
 | 
			
		||||
nscache 65536
 | 
			
		||||
 | 
			
		||||
# we can grab wpad file from provider and feed it to dighosts
 | 
			
		||||
# to build list of free networks
 | 
			
		||||
# system "c:\3proxy\dighosts.exe -m http://wpad.security.nnov.ru/wpad.dat c:\3proxy\freenetworks.net"
 | 
			
		||||
 | 
			
		||||
service
 | 
			
		||||
 | 
			
		||||
internal 192.168.1.1
 | 
			
		||||
external 10.1.1.1
 | 
			
		||||
 | 
			
		||||
dnspr
 | 
			
		||||
 | 
			
		||||
log &3proxylog,root
 | 
			
		||||
#log c:\3proxy\logs\proxy.log D
 | 
			
		||||
#logformat "Linsert into log (timestamp, username, service, clientip, remoteip, remoteport, bytesin, bytesout,request,error) values (
 | 
			
		||||
#logformat "%t '%U' '%N' '%C' '%R' %r %I %O '%T' %E"
 | 
			
		||||
logformat "-\'+_Linsert into log (time, bytesin, bytesout, username, url, host, port, service) values ('%Y-%m-%d %H:%M:%S', %I, %O, '%U', '%T', '%n', %r, '%N');"
 | 
			
		||||
archiver zip c:\3proxy\zip.exe -m -qq %A %F
 | 
			
		||||
rotate 50
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
auth strong
 | 
			
		||||
users temp:CL:password root:CL:password
 | 
			
		||||
 | 
			
		||||
# access free networks directly
 | 
			
		||||
allow * * $c:\3proxy\freenetworks.net
 | 
			
		||||
# redirect web traffic for non-free networks to provider's proxy
 | 
			
		||||
allow * * * 80
 | 
			
		||||
parent 1000 http 10.1.2.5 3128 
 | 
			
		||||
# allow rest of traffic
 | 
			
		||||
allow *
 | 
			
		||||
proxy
 | 
			
		||||
 | 
			
		||||
flush
 | 
			
		||||
 | 
			
		||||
auth iponly
 | 
			
		||||
allow *
 | 
			
		||||
pop3p
 | 
			
		||||
tcppm 25 mail.security.nnov.ru 25
 | 
			
		||||
 | 
			
		||||
flush
 | 
			
		||||
# redirect port 80 traffic via SOCKS server to local HTTP proxy to
 | 
			
		||||
# have URLs logged
 | 
			
		||||
allow  * * * 80
 | 
			
		||||
parent 1000 http 0.0.0.0 0
 | 
			
		||||
allow *
 | 
			
		||||
socks
 | 
			
		||||
 | 
			
		||||
#daemon
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										56
									
								
								cfg/sql/create.sql
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										56
									
								
								cfg/sql/create.sql
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,56 @@
 | 
			
		||||
# Connection: localhost
 | 
			
		||||
# Host: 127.0.0.1
 | 
			
		||||
# Saved: 2004-04-09 18:53:52
 | 
			
		||||
# 
 | 
			
		||||
# Host: 127.0.0.1
 | 
			
		||||
# Database: 3proxy
 | 
			
		||||
# Table: 'log'
 | 
			
		||||
# 
 | 
			
		||||
CREATE TABLE `log` (
 | 
			
		||||
  `time` datetime NOT NULL default '0000-00-00 00:00:00',
 | 
			
		||||
  `bytesin` int(11) NOT NULL default '0',
 | 
			
		||||
  `bytesout` int(11) NOT NULL default '0',
 | 
			
		||||
  `username` varchar(20) NOT NULL default '',
 | 
			
		||||
  `service` varchar(7) NOT NULL default '',
 | 
			
		||||
  `host` varchar(100) NOT NULL default '',
 | 
			
		||||
  `port` int(11) NOT NULL default '0',
 | 
			
		||||
  `url` varchar(255) NOT NULL default ''
 | 
			
		||||
) TYPE=MyISAM; 
 | 
			
		||||
 | 
			
		||||
CREATE TABLE `services` (
 | 
			
		||||
  `startport` int(11) NOT NULL default '0',
 | 
			
		||||
  `endport` int(11) NOT NULL default '0',
 | 
			
		||||
  `service` varchar(100) NOT NULL default '',
 | 
			
		||||
  `description` varchar(100) NOT NULL default ''
 | 
			
		||||
) TYPE=MyISAM; 
 | 
			
		||||
 | 
			
		||||
CREATE TABLE `timelimit` (
 | 
			
		||||
  `datefrom` datetime NOT NULL default '0000-00-00 00:00:00',
 | 
			
		||||
  `dateto` datetime NOT NULL default '0000-00-00 00:00:00'
 | 
			
		||||
) TYPE=MyISAM; 
 | 
			
		||||
 | 
			
		||||
INSERT INTO services (80, 80, NULL, 'Access to Web Server');
 | 
			
		||||
 | 
			
		||||
INSERT INTO services (443, 443, NULL, 'Secure Access to Web Server');
 | 
			
		||||
 | 
			
		||||
INSERT INTO services (3128, 3128, NULL, 'Access to Web server via external Proxy');
 | 
			
		||||
INSERT INTO services (1080, 1080, NULL, 'Access to external SOCKS server');
 | 
			
		||||
INSERT INTO services (5190, 5190, NULL, 'Access to ICQ');
 | 
			
		||||
INSERT INTO services (6666, 6668, NULL, 'Access to IRC');
 | 
			
		||||
 | 
			
		||||
INSERT INTO services (119, 119, NULL, 'Access to news server');
 | 
			
		||||
INSERT INTO services (25, 25, NULL, 'Sent Mail');
 | 
			
		||||
 | 
			
		||||
INSERT INTO services (0, 0, 'POP3P', 'Received Mail');
 | 
			
		||||
INSERT INTO services (0, 0, 'SMTPP', 'Sent Mail');
 | 
			
		||||
INSERT INTO services (0, 0, 'TCPPM', 'Access to external server via TCP');
 | 
			
		||||
INSERT INTO services (0, 0, 'UDPPM', 'Access to external server via UDP');
 | 
			
		||||
INSERT INTO services (0, 0, 'PROXY', 'Access to external server via Proxy');
 | 
			
		||||
INSERT INTO services (0, 0, 'FTPPR', 'Access to external server via FTP Proxy');
 | 
			
		||||
INSERT INTO services (0, 0, 'ICQPR', 'Access to external server via ICQ Proxy');
 | 
			
		||||
INSERT INTO services (0, 0, 'SOCKS4', 'Access to external server via Socks v4');
 | 
			
		||||
INSERT INTO services (0, 0, 'SOCKS5', 'Access to external server via Socks v5');
 | 
			
		||||
INSERT INTO services (0, 0, 'DNSPR', 'Name resolution');
 | 
			
		||||
INSERT INTO services (0, 0, NULL, 'Unknown');
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								cfg/sql/report.xls
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								cfg/sql/report.xls
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							@ -1,6 +0,0 @@
 | 
			
		||||
all:	  isqlodbc$(EXESUFFICS) 
 | 
			
		||||
clean:
 | 
			
		||||
	@$(REMOVECOMMAND) *$(OBJSUFFICS) $(COMPFILES)
 | 
			
		||||
 | 
			
		||||
isqlodbc$(EXESUFFICS): isqlodbc$(OBJSUFFICS) 
 | 
			
		||||
	$(LN) $(LNOUT)isqlodbc$(EXESUFFICS) $(LDFLAGS) $(VERFILE) isqlodbc$(OBJSUFFICS) $(COMPATLIBS) $(LIBS)
 | 
			
		||||
@ -1,15 +0,0 @@
 | 
			
		||||
CC = gcc
 | 
			
		||||
CFLAGS = -I /usr/local/include  -DUNIX
 | 
			
		||||
COUT = -o 
 | 
			
		||||
LN = gcc
 | 
			
		||||
LDFLAGS =  
 | 
			
		||||
LIBS =-L /usr/local/lib -lodbc
 | 
			
		||||
LNOUT = -o 
 | 
			
		||||
EXESUFFICS =
 | 
			
		||||
OBJSUFFICS = .o
 | 
			
		||||
DEFINEOPTION = -D
 | 
			
		||||
COMPFILES = *~
 | 
			
		||||
REMOVECOMMAND = rm -f
 | 
			
		||||
COMPATLIBS =
 | 
			
		||||
 | 
			
		||||
include Makefile.inc
 | 
			
		||||
@ -1,15 +0,0 @@
 | 
			
		||||
CC = gcc
 | 
			
		||||
CFLAGS = -DWIN32
 | 
			
		||||
COUT = -o 
 | 
			
		||||
LN = gcc
 | 
			
		||||
LDFLAGS =  
 | 
			
		||||
LIBS = -lodbc32
 | 
			
		||||
LNOUT = -o 
 | 
			
		||||
EXESUFFICS =
 | 
			
		||||
OBJSUFFICS = .o
 | 
			
		||||
DEFINEOPTION = -D
 | 
			
		||||
COMPFILES = *~
 | 
			
		||||
REMOVECOMMAND = rm -f
 | 
			
		||||
COMPATLIBS =
 | 
			
		||||
 | 
			
		||||
include Makefile.inc
 | 
			
		||||
@ -1,191 +0,0 @@
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
#ifdef WIN32
 | 
			
		||||
#include <io.h>
 | 
			
		||||
#include <windows.h>
 | 
			
		||||
#endif
 | 
			
		||||
#ifdef UNIX
 | 
			
		||||
#include <sqltypes.h>
 | 
			
		||||
#endif
 | 
			
		||||
#include <sql.h>
 | 
			
		||||
#include <sqlext.h>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#define  BUF_LENGTH 65000
 | 
			
		||||
 | 
			
		||||
/* environment variable */
 | 
			
		||||
SQLHENV    env=NULL;
 | 
			
		||||
SQLHDBC    dbc=NULL;
 | 
			
		||||
SQLHSTMT   stmt=NULL;
 | 
			
		||||
SQLHSTMT   cstmt=NULL;
 | 
			
		||||
unsigned  char *dsn;
 | 
			
		||||
unsigned  char *user;
 | 
			
		||||
unsigned  char *pass;
 | 
			
		||||
 | 
			
		||||
RETCODE    retcod;
 | 
			
		||||
 | 
			
		||||
/*description a columns of result of request */
 | 
			
		||||
SQLSMALLINT      ColumnCount;
 | 
			
		||||
unsigned int     ColNumber;
 | 
			
		||||
unsigned char    ColName[SQL_MAX_COLUMN_NAME_LEN];
 | 
			
		||||
unsigned int     Length;
 | 
			
		||||
unsigned int     Type;
 | 
			
		||||
unsigned int     Size;
 | 
			
		||||
unsigned int     Digits;
 | 
			
		||||
unsigned int     Nullable;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
unsigned char    data_buf[BUF_LENGTH];
 | 
			
		||||
unsigned long    OutData;
 | 
			
		||||
 | 
			
		||||
/* function print error message*/
 | 
			
		||||
void PrintError(HENV env,HDBC dbc,HSTMT stmt,RETCODE retcod)
 | 
			
		||||
{
 | 
			
		||||
 SQLINTEGER nError;
 | 
			
		||||
 SQLSMALLINT  TextLength;
 | 
			
		||||
 unsigned char    BufErrMsg[SQL_MAX_MESSAGE_LENGTH+1];
 | 
			
		||||
 unsigned char    SqlState[128];
 | 
			
		||||
 | 
			
		||||
 SQLError(env,dbc,stmt,SqlState,&nError,BufErrMsg,512, &TextLength);
 | 
			
		||||
 printf("%s\n" ,BufErrMsg);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void sqlquery(SQLHDBC dbc,SQLHSTMT stmt, unsigned char *strquery)
 | 
			
		||||
{
 | 
			
		||||
 retcod=SQLAllocStmt(dbc, &stmt);
 | 
			
		||||
 | 
			
		||||
 retcod=SQLExecDirect(stmt,strquery,SQL_NTS);
 | 
			
		||||
 if(retcod!=SQL_SUCCESS)
 | 
			
		||||
   { PrintError(env,dbc,stmt,retcod);}
 | 
			
		||||
 | 
			
		||||
    SQLNumResultCols(stmt,&ColumnCount);
 | 
			
		||||
 | 
			
		||||
    while(SQLFetch(stmt)==SQL_SUCCESS)
 | 
			
		||||
     {
 | 
			
		||||
      for(ColNumber=1; ColNumber<=ColumnCount ; ColNumber++)
 | 
			
		||||
       {
 | 
			
		||||
        SQLGetData(stmt,ColNumber,SQL_CHAR,data_buf,BUF_LENGTH,&OutData);
 | 
			
		||||
        printf("%s|",data_buf);
 | 
			
		||||
       }
 | 
			
		||||
       printf("\n",data_buf);
 | 
			
		||||
       strcpy(data_buf,"");
 | 
			
		||||
     }
 | 
			
		||||
 SQLFreeStmt( stmt, SQL_DROP );
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* isqlodbc dsn[[,user][,pass]] ["SQLCMD"] */
 | 
			
		||||
int main(int argc, char *argv[])
 | 
			
		||||
{
 | 
			
		||||
 unsigned char qbuf[64000];
 | 
			
		||||
 unsigned char *ptr=NULL;
 | 
			
		||||
 | 
			
		||||
 /* Allocate environment and database connection  handles */
 | 
			
		||||
 retcod=SQLAllocEnv( &env );
 | 
			
		||||
 if(retcod!=SQL_SUCCESS)
 | 
			
		||||
  {
 | 
			
		||||
   PrintError(env,dbc,stmt,retcod);
 | 
			
		||||
   SQLFreeEnv(env);
 | 
			
		||||
   return (-1);
 | 
			
		||||
  }
 | 
			
		||||
 retcod = SQLAllocConnect( env, &dbc );
 | 
			
		||||
 if(retcod!=SQL_SUCCESS)
 | 
			
		||||
  {
 | 
			
		||||
   PrintError(env,dbc,stmt,retcod);
 | 
			
		||||
   SQLFreeConnect( dbc );
 | 
			
		||||
   return (-1);
 | 
			
		||||
  }
 | 
			
		||||
 
 | 
			
		||||
 
 | 
			
		||||
 if(argc > 1 )
 | 
			
		||||
 {
 | 
			
		||||
  /* parsing command line and get parametrs */
 | 
			
		||||
  dsn = strtok(argv[1],",");
 | 
			
		||||
  user = strtok(NULL, ",");
 | 
			
		||||
  pass = strtok(NULL, ",");
 | 
			
		||||
 | 
			
		||||
  /* Connect from DSN */
 | 
			
		||||
  retcod=SQLConnect(dbc,dsn,SQL_NTS,user,SQL_NTS,pass,SQL_NTS);
 | 
			
		||||
 | 
			
		||||
  if(retcod!=SQL_SUCCESS)
 | 
			
		||||
     { PrintError(env,dbc,stmt,retcod); }
 | 
			
		||||
    else
 | 
			
		||||
     {
 | 
			
		||||
      if (argc > 2)
 | 
			
		||||
       {
 | 
			
		||||
        /*sql cmd from command line*/
 | 
			
		||||
        sqlquery(dbc,stmt,argv[2]);
 | 
			
		||||
       }
 | 
			
		||||
      else
 | 
			
		||||
       {
 | 
			
		||||
         /*sql cmd from stdin */
 | 
			
		||||
         if( isatty(0) ){ printf(".tables - list table\n.q - exit\nsql>"); }
 | 
			
		||||
         while(fgets(qbuf,63000,stdin) != NULL )
 | 
			
		||||
         {
 | 
			
		||||
          ptr=strrchr(qbuf,';');
 | 
			
		||||
          if (ptr!=NULL)
 | 
			
		||||
           {
 | 
			
		||||
            sqlquery(dbc,stmt,qbuf);
 | 
			
		||||
           }
 | 
			
		||||
          else
 | 
			
		||||
           {
 | 
			
		||||
            /*cmd exit*/
 | 
			
		||||
            if (strstr(qbuf,".q")){ break; };
 | 
			
		||||
 | 
			
		||||
            /*cmd table list*/
 | 
			
		||||
            if (strstr(qbuf,".tables")) 
 | 
			
		||||
             {
 | 
			
		||||
              retcod=SQLAllocStmt(dbc, &stmt);
 | 
			
		||||
              if(retcod!=SQL_SUCCESS){ PrintError(env,dbc,stmt,retcod); }
 | 
			
		||||
              else
 | 
			
		||||
               {
 | 
			
		||||
                retcod=SQLTables(stmt,NULL,0,NULL,0,NULL,0,NULL,0);
 | 
			
		||||
                if(retcod !=SQL_SUCCESS) { PrintError(env,dbc,stmt,retcod);}
 | 
			
		||||
                while(SQLFetch(stmt)==SQL_SUCCESS)
 | 
			
		||||
                 {
 | 
			
		||||
                   SQLGetData(stmt,3,SQL_CHAR,data_buf,BUF_LENGTH,&OutData);
 | 
			
		||||
                   printf("%s|",data_buf);
 | 
			
		||||
 | 
			
		||||
                   /*list columns */
 | 
			
		||||
                   retcod=SQLAllocStmt(dbc, &cstmt);
 | 
			
		||||
                   retcod=SQLColumns(cstmt,NULL,0,NULL,0,data_buf,strlen(data_buf),NULL,0);
 | 
			
		||||
 | 
			
		||||
                   if(retcod !=SQL_SUCCESS) { PrintError(env,dbc,stmt,retcod);}
 | 
			
		||||
                   else
 | 
			
		||||
                   {
 | 
			
		||||
                     printf("create table %s (",data_buf);
 | 
			
		||||
                     while(SQLFetch(cstmt)==SQL_SUCCESS)
 | 
			
		||||
                      {
 | 
			
		||||
                       SQLGetData(cstmt,4,SQL_CHAR,data_buf,BUF_LENGTH,&OutData);
 | 
			
		||||
                       printf("%s ",data_buf);
 | 
			
		||||
                       SQLGetData(cstmt,6,SQL_CHAR,data_buf,BUF_LENGTH,&OutData);
 | 
			
		||||
                       printf("%s, ",data_buf);
 | 
			
		||||
                      }
 | 
			
		||||
                     printf(");\n");
 | 
			
		||||
                     SQLFreeStmt( cstmt, SQL_DROP );
 | 
			
		||||
                   }/*end list columns*/
 | 
			
		||||
               
 | 
			
		||||
                 }/*end while SQLFetch */
 | 
			
		||||
                SQLFreeStmt( stmt, SQL_DROP );
 | 
			
		||||
               }
 | 
			
		||||
 | 
			
		||||
             }/*end if (strstr(qbuf,".tables")) */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
           } /*end else cmd*/
 | 
			
		||||
          if( isatty(0) ){ printf("sql>"); }
 | 
			
		||||
         } /*end while*/
 | 
			
		||||
       }
 | 
			
		||||
     }
 | 
			
		||||
  SQLDisconnect(dbc);
 | 
			
		||||
 } /* if (argc > 2) */
 | 
			
		||||
 else
 | 
			
		||||
 {
 | 
			
		||||
  printf("isqlodbc dsn[[,user][,pass]] [\"SQLCMD\"]\n");
 | 
			
		||||
 }
 | 
			
		||||
 | 
			
		||||
 SQLFreeConnect( dbc );
 | 
			
		||||
 SQLFreeEnv( env );
 | 
			
		||||
 return 0;
 | 
			
		||||
}
 | 
			
		||||
@ -1,22 +0,0 @@
 | 
			
		||||
 | 
			
		||||
create table log (ldate date,ltime time,username char (30),userip char (16),bytein integer (10),byteout integer (10),service char (8), host char(255), hostport integer (10), url char (255) );
 | 
			
		||||
 | 
			
		||||
create index idate on log (ldate);
 | 
			
		||||
create index iusername on log (username);
 | 
			
		||||
create index iuserip on log (userip);
 | 
			
		||||
create index ihost on log (host);
 | 
			
		||||
 | 
			
		||||
create table services (port integer(10),service char(100),description char (100)); 
 | 
			
		||||
 | 
			
		||||
INSERT INTO services values (80,'PROXY', 'Access to Web Server');
 | 
			
		||||
INSERT INTO services values (21,'PROXY', 'Access to Ftp Server via HTTP proxy');
 | 
			
		||||
INSERT INTO services values (5190,'PROXY', 'Access to ICQ via HTTP proxy');
 | 
			
		||||
INSERT INTO services values (0, 'POP3P', 'Received Mail via POP3');
 | 
			
		||||
INSERT INTO services values (0,'FTPPR', 'Access to Ftp server via FTP proxy');
 | 
			
		||||
INSERT INTO services values (0,'SOCKS4', 'Access to external server via Socks v4');
 | 
			
		||||
INSERT INTO services values (0,'SOCKS5', 'Access to external server via Socks v5');
 | 
			
		||||
INSERT INTO services values (0,'TCPPM', 'Access to external server via TCP mapping');
 | 
			
		||||
INSERT INTO services values (0,'UDPPM', 'Access to external server via UDP mapping');
 | 
			
		||||
INSERT INTO services values (0, 0, NULL, 'Unknown');
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -1,63 +0,0 @@
 | 
			
		||||
------------------------------ KOI8-R ------------------------------------
 | 
			
		||||
  Этот архив содержит набор CGI cкриптов и программ для получения 
 | 
			
		||||
статистики работы пользователей прокси сервера "3proxy", посредством анализа
 | 
			
		||||
лога расположенного в ODBC источнике(базе), через Web интерфейс.                      
 | 
			
		||||
 | 
			
		||||
stat.awk - основной CGI скрипт (Для его испольнения под Win9X/2000 необходима 
 | 
			
		||||
           программа awk.exe ,в linux/freebsd она как правило входит в сиситему
 | 
			
		||||
           по умолчанию).    
 | 
			
		||||
isqlodbc - программа для выполнения SQL запросов к базам ODBC 
 | 
			
		||||
           (вызывается из stat.awk). компилируется gcc и работает как в 
 | 
			
		||||
           win9X/2000 так и в linux/freebsd. (Так же может 
 | 
			
		||||
           использоваться независимо от stat.awk как отдельная 
 | 
			
		||||
           программа..)
 | 
			
		||||
log.sql  - SQL скрипт создания базы для лога сервера.           
 | 
			
		||||
awk.exe  - awk интерпретатор  под Win9X/2000.  
 | 
			
		||||
 | 
			
		||||
                        Настройка скриптов статистики .
 | 
			
		||||
 | 
			
		||||
Для работы вам потребуется:
 | 
			
		||||
1) любой http сервер подерживающий CGI
 | 
			
		||||
2) odbc менеджер (под win32 ) или iodbc менеджер (под unix)
 | 
			
		||||
   любая база данных например : sqlite, mysql, postgress или любые другие 
 | 
			
		||||
   имеющие ODBC драйвера.(Как настраивать iODBC под linux/freebsd смотрите в
 | 
			
		||||
   файле iodbc.txt в  каталоге /doc/ru архива 3proxy.)
 | 
			
		||||
 | 
			
		||||
 Шаг настройки N1:
 | 
			
		||||
Создаем базу данных и DSN для хранения лога. ( в нашем случае DSN будет 
 | 
			
		||||
называться "sqlite".) далее выполняя скрипт log.sql создаем необходимые 
 | 
			
		||||
таблицы и индексы:
 | 
			
		||||
 | 
			
		||||
isqlodbc sqlite < log.sql
 | 
			
		||||
 | 
			
		||||
 Шаг настройки N2:
 | 
			
		||||
Устанавливаем DSN и формат таблицы с логом в файле 3proxy.cfg следующего вида:
 | 
			
		||||
-----------
 | 
			
		||||
# create table log (
 | 
			
		||||
#    ldate date,
 | 
			
		||||
#    ltime time,
 | 
			
		||||
#    username char (30),
 | 
			
		||||
#    userip char (16),
 | 
			
		||||
#    bytein integer (10),
 | 
			
		||||
#    byteout integer (10),
 | 
			
		||||
#    service char (8),
 | 
			
		||||
#    host char(255),
 | 
			
		||||
#    hostport integer (10),
 | 
			
		||||
#    url char (255)
 | 
			
		||||
#   );
 | 
			
		||||
 | 
			
		||||
log &sqlite
 | 
			
		||||
logformat "Linsert into log values ('%Y-%m-%d','%H:%M:%S','%U','%C','%I','%O','%N','%n','%r','%T');"
 | 
			
		||||
-----------
 | 
			
		||||
 | 
			
		||||
 Шаг настройки N3:
 | 
			
		||||
Копируем файлы isqlodbc и stat.awk в каталог с CGI скриптами http сервера 
 | 
			
		||||
и меняем в stat.awk путь вызова и DSN на свои значения , например:
 | 
			
		||||
isql="./isqlodbc.exe sqlite " 
 | 
			
		||||
 | 
			
		||||
 Шаг настройки N4:
 | 
			
		||||
Пробуем вызвать скрипт из web браузера , например 
 | 
			
		||||
 | 
			
		||||
http://localhost/cgi/stat.awk?
 | 
			
		||||
 | 
			
		||||
------------------------------ KOI8-R ------------------------------------
 | 
			
		||||
@ -1,129 +0,0 @@
 | 
			
		||||
#!/usr/bin/awk -f 
 | 
			
		||||
BEGIN { 
 | 
			
		||||
  scriptname = ENVIRON["SCRIPT_NAME"]
 | 
			
		||||
  #for win32
 | 
			
		||||
  isql=".\\isqlodbc.exe sqlite " 
 | 
			
		||||
 | 
			
		||||
  #for unix
 | 
			
		||||
  #isql="./isqlodbc sqlite " 
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  print "Content-Type: text/html; charset=koi8-r \n\n"
 | 
			
		||||
  print "<HTML>\n<BODY>\n";
 | 
			
		||||
 | 
			
		||||
  # query parse
 | 
			
		||||
  query_str = ENVIRON["QUERY_STRING"]
 | 
			
		||||
  n = split(query_str, querys, "&")
 | 
			
		||||
  for (i=1; i<=n; i++) 
 | 
			
		||||
   {
 | 
			
		||||
    split(querys[i], data, "=")
 | 
			
		||||
    qr[data[1]] = data[2]
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
  printf "<FORM METHOD=PUT action=\"" scriptname "?rep=1\">"
 | 
			
		||||
  printf "datefrom:<INPUT name=\"datefrom\" value=\"2004-06-01\"> "
 | 
			
		||||
  printf "dateto:<INPUT name=\"dateto\" value=\"2004-07-30\"> <br>"
 | 
			
		||||
  printf "<INPUT type=\"radio\" name=\"userid\" value=\"username\" checked> LOGIN user <br>"
 | 
			
		||||
  printf "<INPUT type=\"radio\" name=\"userid\" value=\"userip\"> IP user  <br>"
 | 
			
		||||
  printf "<INPUT type=\"hidden\" name=\"rep\" value=\"user\">"  
 | 
			
		||||
  printf "<INPUT type=\"submit\" value=\"Report\">"
 | 
			
		||||
  printf "</FORM>"
 | 
			
		||||
 
 | 
			
		||||
   
 | 
			
		||||
  #printf "query_str=%s\n<br>",query_str
 | 
			
		||||
  #print  qr["rep"]
 | 
			
		||||
 | 
			
		||||
  if(qr["rep"]=="user")
 | 
			
		||||
   {
 | 
			
		||||
    cmd = isql " \"select " qr["userid"] ",sum(bytein),sum(byteout),sum(bytein+byteout) from log \
 | 
			
		||||
        where ldate > '" qr["datefrom"] "'  AND ldate < '" qr["dateto"] \
 | 
			
		||||
        "' group by " qr["userid"] " order by sum(bytein+byteout) desc;\""
 | 
			
		||||
    printf " <table WIDTH=100%%  BORDER=1><tr><td><b>user</b></td> <td><b>bytein</b></td> <td><b>byteout</b> </td> <td> <b>bytesum</b></td></tr>"
 | 
			
		||||
    while( (cmd|getline result)>0)
 | 
			
		||||
     { 
 | 
			
		||||
      split(result, rt, "|")
 | 
			
		||||
      printf "<tr> <td><a href=\"%s?rep=host&datefrom=%s&dateto=%s&userid=%s&selectid=%s\"> %s <\/a></td><td>%d</td><td>%d</td><td>%d</td></tr>",
 | 
			
		||||
      scriptname,qr["datefrom"],qr["dateto"],qr["userid"],rt[1],rt[1],rt[2],rt[3],rt[4]
 | 
			
		||||
      totalbytein=totalbytein+rt[2];
 | 
			
		||||
      totalbyteout=totalbyteout+rt[3];
 | 
			
		||||
      totalbytesum=totalbytesum+rt[4];
 | 
			
		||||
     } 
 | 
			
		||||
    printf "<tr> <td><br>Total users</td> <td><br>%d</td> <td><br>%d</td> \
 | 
			
		||||
    <td><br>%d</td></tr> </table> ",totalbytein,totalbyteout, totalbytesum
 | 
			
		||||
    close(cmd)
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  if(qr["rep"]=="host")
 | 
			
		||||
   {
 | 
			
		||||
    cmd = isql "\"select sum(bytein+byteout), sum(bytein), sum(byteout),host from log \
 | 
			
		||||
        where ldate > '" qr["datefrom"] "' AND ldate < '"qr["dateto"] \
 | 
			
		||||
        "' AND " qr["userid"] " = '" qr["selectid"] \
 | 
			
		||||
        "' group by host order by sum(bytein+byteout) desc;\"" 
 | 
			
		||||
 | 
			
		||||
    printf "<center><b>Detail statistic for user: %s</b></center>",qr["selectid"]
 | 
			
		||||
    printf " <table WIDTH=100%%  BORDER=1> <tr><td><b>sum byte</b></td> <td><b>bytein</b></td> <td><b>byteout</b></td><td><b>host</b></td></tr>"
 | 
			
		||||
    while( (cmd|getline result)>0)
 | 
			
		||||
     { 
 | 
			
		||||
      split(result, rt, "|")
 | 
			
		||||
      printf "<tr><td>%d</td><td>%d</td><td>%d</td><td>%s</td></tr>",rt[1],rt[2],rt[3],rt[4] 
 | 
			
		||||
      totalbytein=totalbytein+rt[1];
 | 
			
		||||
      totalbyteout=totalbyteout+rt[2];
 | 
			
		||||
      totalbytesum=totalbytesum+rt[3];
 | 
			
		||||
 | 
			
		||||
     }
 | 
			
		||||
    printf "<tr> <td><br>%d</td> <td><br>%d</td> \
 | 
			
		||||
    <td><br>%d</td><td><br>Total host</td></tr> </table> ",totalbytein,totalbyteout, totalbytesum
 | 
			
		||||
    printf " </table> "
 | 
			
		||||
    close(cmd)
 | 
			
		||||
    
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
  printf " </BODY> </HTML>";
 | 
			
		||||
} # end BEGIN 
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# decode urlencoded string
 | 
			
		||||
function decode(text,   hex, i, hextab, decoded, len, c, c1, c2, code) {
 | 
			
		||||
    
 | 
			
		||||
    split("0 1 2 3 4 5 6 7 8 9 a b c d e f", hex, " ")
 | 
			
		||||
    for (i=0; i<16; i++) hextab[hex[i+1]] = i
 | 
			
		||||
 | 
			
		||||
    # urldecode function from Heiner Steven
 | 
			
		||||
    # http://www.shelldorado.com/scripts/cmds/urldecode
 | 
			
		||||
 | 
			
		||||
    # decode %xx to ASCII char 
 | 
			
		||||
    decoded = ""
 | 
			
		||||
    i = 1
 | 
			
		||||
    len = length(text)
 | 
			
		||||
    
 | 
			
		||||
    while ( i <= len ) {
 | 
			
		||||
        c = substr (text, i, 1)
 | 
			
		||||
        if ( c == "%" ) 
 | 
			
		||||
             {
 | 
			
		||||
           if ( i+2 <= len ) 
 | 
			
		||||
                {
 | 
			
		||||
              c1 = tolower(substr(text, i+1, 1))
 | 
			
		||||
          c2 = tolower(substr(text, i+2, 1))
 | 
			
		||||
          if ( hextab [c1] != "" || hextab [c2] != "" ) {
 | 
			
		||||
          if ( (c1 >= 2 && (c1 != 7 && c2 != "F")) || (c1 == 0 && c2 ~ "[9acd]") )
 | 
			
		||||
                   {
 | 
			
		||||
             code = 0 + hextab [c1] * 16 + hextab [c2] + 0
 | 
			
		||||
             c = sprintf ("%c", code)
 | 
			
		||||
           } 
 | 
			
		||||
                  else { c = " " }
 | 
			
		||||
          i = i + 2
 | 
			
		||||
        }
 | 
			
		||||
         }
 | 
			
		||||
        } else if ( c == "+" ) {    # special handling: "+" means " "
 | 
			
		||||
            c = " "
 | 
			
		||||
        }
 | 
			
		||||
        decoded = decoded c
 | 
			
		||||
        ++i
 | 
			
		||||
    }
 | 
			
		||||
    # change linebreaks to \n
 | 
			
		||||
    gsub(/\r\n/, "\n", decoded)
 | 
			
		||||
    # remove last linebreak
 | 
			
		||||
    sub(/[\n\r]*$/,"",decoded)
 | 
			
		||||
    return decoded
 | 
			
		||||
}
 | 
			
		||||
@ -1,185 +0,0 @@
 | 
			
		||||
#!/usr/bin/perl
 | 
			
		||||
eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
 | 
			
		||||
    if $running_under_some_shell;
 | 
			
		||||
			# this emulates #! processing on NIH machines.
 | 
			
		||||
			# (remove #! line above if indigestible)
 | 
			
		||||
 | 
			
		||||
eval '$'.$1.'$2;' while $ARGV[0] =~ /^([A-Za-z_0-9]+=)(.*)/ && shift;
 | 
			
		||||
			# process any FOO=bar switches
 | 
			
		||||
 | 
			
		||||
$[ = 1;			# set array base to 1
 | 
			
		||||
$, = ' ';		# set output field separator
 | 
			
		||||
$\ = "\n";		# set output record separator
 | 
			
		||||
 | 
			
		||||
$scriptname = $ENVIRON{'SCRIPT_NAME'};
 | 
			
		||||
#for win32
 | 
			
		||||
$isql = ".\\isqlodbc.exe sqlite ";
 | 
			
		||||
 | 
			
		||||
#for unix
 | 
			
		||||
#isql="./isqlodbc sqlite " 
 | 
			
		||||
 | 
			
		||||
print "Content-Type: text/html; charset=koi8-r \n\n";
 | 
			
		||||
print "<HTML>\n<BODY>\n";
 | 
			
		||||
 | 
			
		||||
# query parse
 | 
			
		||||
$query_str = $ENVIRON{'QUERY_STRING'};
 | 
			
		||||
$n = (@querys = split(/&/, $query_str, 9999));
 | 
			
		||||
for ($i = 1; $i <= $n; $i++) {
 | 
			
		||||
    @data = split(/=/, $querys[$i], 9999);
 | 
			
		||||
    $qr{$data[1]} = $data[2];
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
printf "<FORM METHOD=PUT action=\"" . $scriptname . "?rep=1\">";
 | 
			
		||||
printf "datefrom:<INPUT name=\"datefrom\" value=\"2004-06-01\"> ";
 | 
			
		||||
printf "dateto:<INPUT name=\"dateto\" value=\"2004-07-30\"> <br>";
 | 
			
		||||
printf
 | 
			
		||||
 | 
			
		||||
  "<INPUT type=\"radio\" name=\"userid\" value=\"username\" checked> LOGIN user <br>";
 | 
			
		||||
printf
 | 
			
		||||
 | 
			
		||||
  "<INPUT type=\"radio\" name=\"userid\" value=\"userip\"> IP user  <br>";
 | 
			
		||||
printf "<INPUT type=\"hidden\" name=\"rep\" value=\"user\">";
 | 
			
		||||
printf "<INPUT type=\"submit\" value=\"Report\">";
 | 
			
		||||
printf '</FORM>';
 | 
			
		||||
 | 
			
		||||
#printf "query_str=%s\n<br>",query_str
 | 
			
		||||
#print  qr["rep"]
 | 
			
		||||
 | 
			
		||||
if ($qr{'rep'} eq 'user') {
 | 
			
		||||
    $cmd = $isql . " \"select " . $qr{'userid'} .
 | 
			
		||||
 | 
			
		||||
      ",sum(bytein),sum(byteout),sum(bytein+byteout) from log         where ldate > '"
 | 
			
		||||
 | 
			
		||||
      . $qr{'datefrom'} . "'  AND ldate < '" . $qr{'dateto'} . "' group by " .
 | 
			
		||||
 | 
			
		||||
      $qr{'userid'} . " order by sum(bytein+byteout) desc;\"";
 | 
			
		||||
    printf
 | 
			
		||||
 | 
			
		||||
      ' <table WIDTH=100%%  BORDER=1><tr><td><b>user</b></td> <td><b>bytein</b></td> <td><b>byteout</b> </td> <td> <b>bytesum</b></td></tr>';
 | 
			
		||||
    while ((($result = &Getline3($cmd, '|'),$getline_ok)) > 0) {
 | 
			
		||||
	@rt = split(/\|/, $result, 9999);
 | 
			
		||||
	printf
 | 
			
		||||
 | 
			
		||||
	  "<tr> <td><a href=\"%s?rep=host&datefrom=%s&dateto=%s&userid=%s&selectid=%s\"> %s <\\/a></td><td>%d</td><td>%d</td><td>%d</td></tr>",
 | 
			
		||||
 | 
			
		||||
	  
 | 
			
		||||
	$scriptname, $qr{'datefrom'}, $qr{'dateto'}, $qr{'userid'}, $rt[1],
 | 
			
		||||
 | 
			
		||||
	  $rt[1], $rt[2], $rt[3], $rt[4];
 | 
			
		||||
	$totalbytein = $totalbytein + $rt[2];
 | 
			
		||||
	$totalbyteout = $totalbyteout + $rt[3];
 | 
			
		||||
	$totalbytesum = $totalbytesum + $rt[4];
 | 
			
		||||
    }
 | 
			
		||||
    printf
 | 
			
		||||
 | 
			
		||||
      '<tr> <td><br>Total users</td> <td><br>%d</td> <td><br>%d</td>     <td><br>%d</td></tr> </table> ',
 | 
			
		||||
 | 
			
		||||
      $totalbytein, $totalbyteout, $totalbytesum;
 | 
			
		||||
    delete $opened{$cmd} && close($cmd);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
if ($qr{'rep'} eq 'host') {
 | 
			
		||||
    $cmd = $isql .
 | 
			
		||||
 | 
			
		||||
      "\"select sum(bytein+byteout), sum(bytein), sum(byteout),host from log         where ldate > '"
 | 
			
		||||
 | 
			
		||||
      . $qr{'datefrom'} . "' AND ldate < '" . $qr{'dateto'} . "' AND " .
 | 
			
		||||
 | 
			
		||||
      $qr{'userid'} . " = '" . $qr{'selectid'} .
 | 
			
		||||
 | 
			
		||||
      "' group by host order by sum(bytein+byteout) desc;\"";
 | 
			
		||||
 | 
			
		||||
    printf '<center><b>Detail statistic for user: %s</b></center>',
 | 
			
		||||
 | 
			
		||||
      $qr{'selectid'};
 | 
			
		||||
    printf
 | 
			
		||||
 | 
			
		||||
      ' <table WIDTH=100%%  BORDER=1> <tr><td><b>sum byte</b></td> <td><b>bytein</b></td> <td><b>byteout</b></td><td><b>host</b></td></tr>';
 | 
			
		||||
    while ((($result = &Getline3($cmd, '|'),$getline_ok)) > 0) {
 | 
			
		||||
	@rt = split(/\|/, $result, 9999);
 | 
			
		||||
	printf '<tr><td>%d</td><td>%d</td><td>%d</td><td>%s</td></tr>',
 | 
			
		||||
 | 
			
		||||
	  $rt[1], $rt[2], $rt[3], $rt[4];
 | 
			
		||||
	$totalbytein = $totalbytein + $rt[1];
 | 
			
		||||
	$totalbyteout = $totalbyteout + $rt[2];
 | 
			
		||||
	$totalbytesum = $totalbytesum + $rt[3];
 | 
			
		||||
    }
 | 
			
		||||
    printf
 | 
			
		||||
 | 
			
		||||
      '<tr> <td><br>%d</td> <td><br>%d</td>     <td><br>%d</td><td><br>Total host</td></tr> </table> ',
 | 
			
		||||
 | 
			
		||||
      $totalbytein, $totalbyteout, $totalbytesum;
 | 
			
		||||
    printf ' </table> ';
 | 
			
		||||
    delete $opened{$cmd} && close($cmd);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
printf ' </BODY> </HTML>';
 | 
			
		||||
 | 
			
		||||
# end BEGIN 
 | 
			
		||||
 | 
			
		||||
# decode urlencoded string
 | 
			
		||||
 | 
			
		||||
sub decode {
 | 
			
		||||
    local($text, *Hex, $i, *hextab, $decoded, $len, $c, $c1, $c2, $code) = @_;
 | 
			
		||||
    @Hex = split(' ', '0 1 2 3 4 5 6 7 8 9 a b c d e f', 9999);
 | 
			
		||||
    for ($i = 0; $i < 16; $i++) {
 | 
			
		||||
	$hextab{$Hex[$i + 1]} = $i;
 | 
			
		||||
 | 
			
		||||
	# urldecode function from Heiner Steven
 | 
			
		||||
	# http://www.shelldorado.com/scripts/cmds/urldecode
 | 
			
		||||
 | 
			
		||||
	# decode %xx to ASCII char 
 | 
			
		||||
	;
 | 
			
		||||
    }
 | 
			
		||||
    $decoded = '';
 | 
			
		||||
    $i = 1;
 | 
			
		||||
    $len = length($text);
 | 
			
		||||
 | 
			
		||||
    while ($i <= $len) {	#???
 | 
			
		||||
	$c = substr($text, $i, 1);
 | 
			
		||||
	if ($c eq '%') {
 | 
			
		||||
	    if ($i + 2 <= $len) {
 | 
			
		||||
		$c1 = &tolower(substr($text, $i + 1, 1));
 | 
			
		||||
		$c2 = &tolower(substr($text, $i + 2, 1));
 | 
			
		||||
		if ($hextab{$c1} ne '' || $hextab{$c2} ne '') {
 | 
			
		||||
		    if (($c1 >= 2 && ($c1 != 7 && $c2 ne 'F')) ||
 | 
			
		||||
 | 
			
		||||
		      ($c1 == 0 && $c2 =~ '[9acd]')) {
 | 
			
		||||
			$code = 0 + $hextab{$c1} * 16 + $hextab{$c2} + 0;
 | 
			
		||||
			$c = sprintf('%c', $code);
 | 
			
		||||
		    }
 | 
			
		||||
		    else {
 | 
			
		||||
			$c = ' ';
 | 
			
		||||
		    }
 | 
			
		||||
		    $i = $i + 2;
 | 
			
		||||
		}
 | 
			
		||||
	    }
 | 
			
		||||
	}
 | 
			
		||||
	elsif ($c eq '+') {
 | 
			
		||||
	    # special handling: "+" means " "
 | 
			
		||||
	    $c = ' ';
 | 
			
		||||
	}
 | 
			
		||||
	$decoded = $decoded . $c;
 | 
			
		||||
	++$i;
 | 
			
		||||
    }
 | 
			
		||||
    # change linebreaks to \n
 | 
			
		||||
    $decoded =~ s/\r\n/\n/g;
 | 
			
		||||
    # remove last linebreak
 | 
			
		||||
    $decoded =~ s/[\n\r]*$//;
 | 
			
		||||
    $decoded;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub Getline3 {
 | 
			
		||||
    &Pick('',@_);
 | 
			
		||||
    local($_);
 | 
			
		||||
    if ($getline_ok = (($_ = <$fh>) ne '')) {
 | 
			
		||||
	;
 | 
			
		||||
    }
 | 
			
		||||
    $_;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub Pick {
 | 
			
		||||
    local($mode,$name,$pipe) = @_;
 | 
			
		||||
    $fh = $name;
 | 
			
		||||
    open($name,$mode.$name.$pipe) unless $opened{$name}++;
 | 
			
		||||
}
 | 
			
		||||
@ -287,10 +287,10 @@ logformat "L%t.%. %N.%p %E %U %C:%c %R:%r %O %I %h %T"
 | 
			
		||||
<p>
 | 
			
		||||
	If ODBC used, logformat should specify SQL command,
 | 
			
		||||
	to insert record into log, for example
 | 
			
		||||
<p><font face="courier">
 | 
			
		||||
logformat "GINSERT INTO proxystat  VALUES (%t, '%c', '%U', %I)"
 | 
			
		||||
</font>
 | 
			
		||||
<p><pre>
 | 
			
		||||
logformat "-\'+_GINSERT INTO proxystat  VALUES (%t, '%c', '%U', %I)"</pre>
 | 
			
		||||
<br>(no line breaks)
 | 
			
		||||
<br>-\'+_ instructs to replace characters \ and ' with _
 | 
			
		||||
</p>
 | 
			
		||||
		<li><A NAME="LOGANALIZERS">How to use log analizers with 3proxy</A>
 | 
			
		||||
<p>
 | 
			
		||||
 | 
			
		||||
@ -304,7 +304,9 @@
 | 
			
		||||
  При использовании ODBC, logformat должен задавать формат SQL команды,
 | 
			
		||||
  которую необходимо дать для внесения записи в журнал, например:
 | 
			
		||||
  <pre>
 | 
			
		||||
  logformat "GINSERT INTO proxystat VALUES (%t, '%c', '%U', %I)"</pre>
 | 
			
		||||
  logformat "-\'+_GINSERT INTO proxystat VALUES (%t, '%c', '%U', %I)"</pre>
 | 
			
		||||
  префикс -\'+_ указывает, что символы \ и ' следует заменить на _ .
 | 
			
		||||
 | 
			
		||||
  </p>
 | 
			
		||||
  <li><a name="LOGANALIZERS"><i>Как использовать лог-анализаторы с 3proxy</i></a>
 | 
			
		||||
  <p>
 | 
			
		||||
 | 
			
		||||
@ -2,10 +2,10 @@
 | 
			
		||||
<h3>3proxy strings substitution plugin</h3>
 | 
			
		||||
May be used to make interface more pretty or to translate proxy server
 | 
			
		||||
messages to different language. All messages are taken from proxy.c and
 | 
			
		||||
moved to external text file (e.g. rus-win1251.3ps). On the moment of
 | 
			
		||||
moved to external text file (e.g. rus.3ps). On the moment of
 | 
			
		||||
writing there are 15 sections. Sections are delimited with "[end]".
 | 
			
		||||
<h4>Example:</h4>
 | 
			
		||||
<pre>plugin "StringsPlugin.dll" start c:\3proxy\bin\rus-win1251.3ps
 | 
			
		||||
<pre>plugin "StringsPlugin.dll" start c:\3proxy\bin\rus.3ps
 | 
			
		||||
</pre>
 | 
			
		||||
 | 
			
		||||
<h4>Download:</h4>
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										256
									
								
								rus.3ps
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										256
									
								
								rus.3ps
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,256 @@
 | 
			
		||||
[--admin--]
 | 
			
		||||
HTTP/1.0 401 Authentication Required\n
 | 
			
		||||
WWW-Authenticate: Basic realm="proxy", encoding="utf-8"\n
 | 
			
		||||
Connection: close\n
 | 
			
		||||
Content-type: text/html; charset=utf-8\n
 | 
			
		||||
\n
 | 
			
		||||
<html><head><title>401 Authentication Required</title></head>\n
 | 
			
		||||
<body><h2>401 Authentication Required</h2>
 | 
			
		||||
<h3>Access to requested resource disallowed by administrator or you need valid username/password to use this resource<br><hr>
 | 
			
		||||
Доступ запрещен администратором или Вы ввели неправильное имя/пароль.
 | 
			
		||||
</h3></body></html>\n
 | 
			
		||||
[end]
 | 
			
		||||
HTTP/1.0 200 OK\n
 | 
			
		||||
Connection: close\n
 | 
			
		||||
Expires: Thu, 01 Dec 1994 16:00:00 GMT\n
 | 
			
		||||
Cache-Control: no-cache\n
 | 
			
		||||
Content-type: text/html; charset=utf-8\n
 | 
			
		||||
\n
 | 
			
		||||
<http><head><title>%s Страница конфигурации</title></head>\n
 | 
			
		||||
<table width='100%%' border='0'>\n
 | 
			
		||||
<tr><td width='150' valign='top'>\n
 | 
			
		||||
<h2>         
 | 
			
		||||
         </h2>\n
 | 
			
		||||
<A HREF='/C'>Счетчики</A><br><br>\n
 | 
			
		||||
<A HREF='/R'>Перезагрузка конфигурации сервера</A><br><br>\n
 | 
			
		||||
<A HREF='/S'>Запущенные сервисы</A><br><br>\n
 | 
			
		||||
<A HREF='/F'>Настройка сервера</A>\n
 | 
			
		||||
</td><td>
 | 
			
		||||
<h2>%s %s Конфигурация</h2>
 | 
			
		||||
[end]
 | 
			
		||||
HTTP/1.0 200 OK\n
 | 
			
		||||
Connection: close\n
 | 
			
		||||
Cache-Control: no-cache\n
 | 
			
		||||
Content-type: text/xml; charset=utf-8 \n
 | 
			
		||||
\n
 | 
			
		||||
<?xml version="1.0"?>\n
 | 
			
		||||
<?xml-stylesheet href="/SX" type="text/css"?>\n
 | 
			
		||||
<services>\n
 | 
			
		||||
<description>Текущие запущенные сервисы и подключившиеся клиенты</description>\n
 | 
			
		||||
[end]
 | 
			
		||||
</services>\n
 | 
			
		||||
[end]
 | 
			
		||||
HTTP/1.0 200 OK\n
 | 
			
		||||
Connection: close\n
 | 
			
		||||
Cache-Control: no-cache\n
 | 
			
		||||
Content-type: text/css\n
 | 
			
		||||
\n
 | 
			
		||||
services {\n
 | 
			
		||||
	display: block;\n
 | 
			
		||||
	margin: 10px auto 10px auto;\n
 | 
			
		||||
	width: 80%;\n
 | 
			
		||||
	background: black;\n"
 | 
			
		||||
	font-family: sans-serif;\n
 | 
			
		||||
	font-size: small;\n
 | 
			
		||||
	color: silver;\n
 | 
			
		||||
	}\n
 | 
			
		||||
item {\n
 | 
			
		||||
	display: block;\n
 | 
			
		||||
	margin-bottom: 10px;\n
 | 
			
		||||
	border: 2px solid #CCC;\n
 | 
			
		||||
	padding: 10px;\n
 | 
			
		||||
	spacing: 2px;\n
 | 
			
		||||
	}\n
 | 
			
		||||
parameter {\n
 | 
			
		||||
	display: block;\n
 | 
			
		||||
	padding: 2px;\n
 | 
			
		||||
	margin-top: 10px;\n
 | 
			
		||||
	border: 1px solid grey;\n
 | 
			
		||||
	background: #EEE;\n
 | 
			
		||||
	color: black;\n
 | 
			
		||||
	}\n
 | 
			
		||||
name {\n
 | 
			
		||||
	display: inline;\n
 | 
			
		||||
	float: left;\n
 | 
			
		||||
	margin-right: 5px;\n
 | 
			
		||||
	font-weight: bold;\n
 | 
			
		||||
	}\n
 | 
			
		||||
type {\n
 | 
			
		||||
	display: inline;\n
 | 
			
		||||
	font-size: x-small;\n
 | 
			
		||||
	margin-right: 5px;\n
 | 
			
		||||
	color: #666;\n
 | 
			
		||||
	white-space: nowrap;\n
 | 
			
		||||
	font-style: italic;\n
 | 
			
		||||
	}\n
 | 
			
		||||
description {\n
 | 
			
		||||
	display: inline;\n
 | 
			
		||||
	margin-right: 5px;\n
 | 
			
		||||
	white-space: nowrap;\n
 | 
			
		||||
	}\n
 | 
			
		||||
value {\n
 | 
			
		||||
	display: block;\n
 | 
			
		||||
	margin-right: 5px;\n
 | 
			
		||||
	}\n
 | 
			
		||||
[end]
 | 
			
		||||
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />\n
 | 
			
		||||
<pre><font size='-2'><b>
 | 
			
		||||
(c)3APA3A, Владимир Дубровин и <A href='http://3proxy.ru/'>3proxy.ru</A>\n
 | 
			
		||||
</b></font>\n
 | 
			
		||||
</td></tr></table></body></html>
 | 
			
		||||
[end]
 | 
			
		||||
<h3>Счетчики</h3>\n
 | 
			
		||||
<table border = '1'>\n
 | 
			
		||||
<tr align='center'><td>Описание</td><td>Активный</td>
 | 
			
		||||
<td>Пользователи</td><td>Адрес источника</td><td>Адрес назначения</td>
 | 
			
		||||
<td>Порты</td>
 | 
			
		||||
<td>Лимит</td><td>Ед.</td><td>Значение</td>
 | 
			
		||||
<td>Дата сброса</td><td>Дата обновения</td><td>Номер</td></tr>\n
 | 
			
		||||
[end]
 | 
			
		||||
</table>\n
 | 
			
		||||
[end]
 | 
			
		||||
[/--admin--]
 | 
			
		||||
[--proxy--]
 | 
			
		||||
HTTP/1.0 400 Bad Request\n
 | 
			
		||||
Proxy-Connection: close\n
 | 
			
		||||
Content-type: text/html; charset=utf-8\n
 | 
			
		||||
\n
 | 
			
		||||
<html><head><title>400 Bad Request</title></head>\n
 | 
			
		||||
<body><h2>400 Bad Request</h2>
 | 
			
		||||
<h2>400 Ошибка: Неправильный запрос.</h2>
 | 
			
		||||
</body>
 | 
			
		||||
</html>\n
 | 
			
		||||
[end]
 | 
			
		||||
HTTP/1.0 502 Bad Gateway\n
 | 
			
		||||
Proxy-Connection: close\n
 | 
			
		||||
Content-type: text/html; charset=utf-8\n
 | 
			
		||||
\n
 | 
			
		||||
<html><head><title>502 Bad Gateway</title></head>\n
 | 
			
		||||
<body><h2>502 Bad Gateway</h2><h3>Host Not Found or connection failed <br><hr>
 | 
			
		||||
Ошибка: Удалённый сервер не найден или не удалось связаться с ним.</h3>
 | 
			
		||||
</body></html>\n
 | 
			
		||||
[end]
 | 
			
		||||
HTTP/1.0 503 Service Unavailable\n
 | 
			
		||||
Proxy-Connection: close\n
 | 
			
		||||
Content-type: text/html; charset=utf-8\n
 | 
			
		||||
\n
 | 
			
		||||
<html><head><title>503 Service Unavailable</title></head>\n
 | 
			
		||||
<body><h2>503 Service Unavailable</h2><h3>You have exceeded your traffic limit <br><hr> 
 | 
			
		||||
Вы превысили свой лимит трафика.
 | 
			
		||||
</h3></body></html>\n
 | 
			
		||||
[end]
 | 
			
		||||
HTTP/1.0 503 Service Unavailable\n
 | 
			
		||||
Proxy-Connection: close\n
 | 
			
		||||
Content-type: text/html; charset=utf-8\n
 | 
			
		||||
\n
 | 
			
		||||
<html><head><title>503 Service Unavailable</title></head>\n
 | 
			
		||||
<body><h2>503 Service Unavailable</h2><h3>Recursion detected<br><hr>
 | 
			
		||||
Ошибка: Сервис не доступен, обнаружена рекурсия
 | 
			
		||||
</h3></body></html>\n
 | 
			
		||||
[end]
 | 
			
		||||
HTTP/1.0 501 Not Implemented\n
 | 
			
		||||
Proxy-Connection: close\n
 | 
			
		||||
Content-type: text/html; charset=utf-8\n
 | 
			
		||||
\n
 | 
			
		||||
<html><head><title>501 Not Implemented</title></head>\n
 | 
			
		||||
<body><h2>501 Not Implemented</h2><h3>Required action is not supported by proxy server <br><hr>
 | 
			
		||||
Ошибка: Действие не поддерживается в данном proxy сервере
 | 
			
		||||
</h3></body></html>\n
 | 
			
		||||
[end]
 | 
			
		||||
HTTP/1.0 502 Bad Gateway\n
 | 
			
		||||
Proxy-Connection: close\n
 | 
			
		||||
Content-type: text/html; charset=utf-8\n
 | 
			
		||||
\n
 | 
			
		||||
<html><head><title>502 Bad Gateway</title></head>\n
 | 
			
		||||
<body><h2>502 Bad Gateway</h2><h3>Failed to connect parent proxy <br><hr>
 | 
			
		||||
Ошибка: Невозможно соединиться c вышестоящим proxy сервером
 | 
			
		||||
</h3></body></html>\n",
 | 
			
		||||
[end]
 | 
			
		||||
HTTP/1.0 500 Internal Error\n
 | 
			
		||||
Proxy-Connection: close\n
 | 
			
		||||
Content-type: text/html; charset=utf-8\n
 | 
			
		||||
\n
 | 
			
		||||
<html><head><title>500 Internal Error</title></head>\n
 | 
			
		||||
<body><h2>500 Internal Error</h2><h3>Internal proxy error during processing your request <br><hr>
 | 
			
		||||
Ошибка: Возникла внутренняя ошибка proxy сервера при обработке вашего запроса
 | 
			
		||||
</h3></body></html>\n
 | 
			
		||||
[end]
 | 
			
		||||
HTTP/1.0 407 Proxy Authentication Required\n
 | 
			
		||||
Proxy-Authenticate: Basic realm="proxy", encoding="utf-8"\n
 | 
			
		||||
Proxy-Connection: close\n
 | 
			
		||||
Content-type: text/html; charset=utf-8\n
 | 
			
		||||
\n
 | 
			
		||||
<html><head><title>407 Proxy Authentication Required</title></head>\n
 | 
			
		||||
<body><h2>407 Proxy Authentication Required</h2><h3>Access to requested resource disallowed by administrator or you need valid username/password to use this resource.<br><hr>
 | 
			
		||||
Доступ запрещен администратором или Вы ввели неправильное имя/пароль.
 | 
			
		||||
</h3></body></html>\n
 | 
			
		||||
[end]
 | 
			
		||||
HTTP/1.0 200 Connection established\n\n
 | 
			
		||||
[end]
 | 
			
		||||
HTTP/1.0 200 Connection established\n
 | 
			
		||||
Content-Type: text/html\n\n
 | 
			
		||||
[end]
 | 
			
		||||
HTTP/1.0 404 Not Found\n
 | 
			
		||||
Proxy-Connection: close\n
 | 
			
		||||
Content-type: text/html; charset=utf-8\n
 | 
			
		||||
\n
 | 
			
		||||
<html><head><title>404 Not Found</title></head>\n
 | 
			
		||||
<body><h2>404 Not Found</h2><h3>File not found <br><hr>
 | 
			
		||||
Файл не найден
 | 
			
		||||
</h3></body></html>\n
 | 
			
		||||
[end]	
 | 
			
		||||
HTTP/1.0 403 Forbidden\n
 | 
			
		||||
Proxy-Connection: close\n
 | 
			
		||||
Content-type: text/html; charset=utf-8\n
 | 
			
		||||
\n
 | 
			
		||||
<html><head><title>403 Access Denied</title></head>\n
 | 
			
		||||
<body><h2>403 Access Denied</h2><h3>Access control list denies you to access this resource.<br><hr>
 | 
			
		||||
Доступ к данному ресурсу запрещен списком доступа на proxy сервер. 
 | 
			
		||||
Если Вы считаете, что это ошибка обратитесь к администратору
 | 
			
		||||
</h3></body></html>\n
 | 
			
		||||
[end]
 | 
			
		||||
HTTP/1.0 407 Proxy Authentication Required\n
 | 
			
		||||
Proxy-Authenticate: NTLM\n
 | 
			
		||||
Proxy-Authenticate: basic realm="proxy", encoding="utf-8"\n
 | 
			
		||||
Proxy-Connection: close\n
 | 
			
		||||
Content-type: text/html; charset=utf-8\n
 | 
			
		||||
\n
 | 
			
		||||
<html><head><title>407 Proxy Authentication Required</title></head>\n
 | 
			
		||||
<body><h2>407 Proxy Authentication Required</h2><h3>Access to requested resource disallowed by administrator or you need valid username/password to use this resource.<br><hr>
 | 
			
		||||
Доступ запрещен администратором или Вы ввели неправильное имя/пароль.
 | 
			
		||||
</h3></body></html>\n
 | 
			
		||||
[end]
 | 
			
		||||
HTTP/1.0 407 Proxy Authentication Required\n
 | 
			
		||||
Proxy-Connection: keep-alive\n
 | 
			
		||||
Content-Length: 0\n
 | 
			
		||||
Proxy-Authenticate: NTLM 
 | 
			
		||||
[end]
 | 
			
		||||
HTTP/1.0 403 Forbidden\n
 | 
			
		||||
Proxy-Connection: close\n
 | 
			
		||||
Content-type: text/html; charset=us-ascii\n
 | 
			
		||||
\n
 | 
			
		||||
<pre>
 | 
			
		||||
[end]
 | 
			
		||||
HTTP/1.0 503 Service Unavailable\n
 | 
			
		||||
Proxy-Connection: close\n
 | 
			
		||||
Content-type: text/html; charset=utf-8\n
 | 
			
		||||
\n
 | 
			
		||||
<html><head><title>503 Service Unavailable</title></head>\n
 | 
			
		||||
<body><h2>503 Service Unavailable</h2><h3>Your request violates configured policy<br><hr>
 | 
			
		||||
Запрос не сответствует сконфигурированной политике.
 | 
			
		||||
</h3></body></html>\n
 | 
			
		||||
[end]
 | 
			
		||||
HTTP/1.0 401 Authentication Required\n
 | 
			
		||||
WWW-Authenticate: basic realm="FTP Server", encoding="utf-8"\n
 | 
			
		||||
Proxy-Connection: close\n
 | 
			
		||||
Content-type: text/html; charset=utf-8\n
 | 
			
		||||
\n
 | 
			
		||||
<html><head><title>401 FTP Server requires authentication</title></head>\n
 | 
			
		||||
<body><h2>401 FTP Server requires authentication</h2><h3>This FTP server rejects anonymous access<br><hr>
 | 
			
		||||
Этот  FTP  сервер отвергает анонимный доступ.
 | 
			
		||||
</h3></body></html>\n
 | 
			
		||||
[end]
 | 
			
		||||
HTTP/1.1 100 Continue\n
 | 
			
		||||
\n
 | 
			
		||||
[end]
 | 
			
		||||
[/--proxy--]
 | 
			
		||||
							
								
								
									
										7
									
								
								src/plugins/LdapPlugin/Makefile.inc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								src/plugins/LdapPlugin/Makefile.inc
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,7 @@
 | 
			
		||||
all: $(BUILDDIR)ldapauth$(DLSUFFICS)
 | 
			
		||||
 | 
			
		||||
ldapauth$(OBJSUFFICS): ldapauth.c
 | 
			
		||||
	$(CC) $(DCFLAGS) $(CFLAGS) ldapauth.c
 | 
			
		||||
 | 
			
		||||
$(BUILDDIR)ldapauth$(DLSUFFICS): ldapauth$(OBJSUFFICS)
 | 
			
		||||
	$(LN) $(LNOUT)../../$(BUILDDIR)ldapauth$(DLSUFFICS) $(LDFLAGS) $(DLFLAGS) $(LIBSPREFIX)ladp$(LIBSSUFFIX) ldapauth$(OBJSUFFICS)
 | 
			
		||||
@ -4,4 +4,4 @@ pamauth$(OBJSUFFICS): pamauth.c
 | 
			
		||||
	$(CC) $(DCFLAGS) $(CFLAGS) pamauth.c
 | 
			
		||||
 | 
			
		||||
$(BUILDDIR)pamauth$(DLSUFFICS): pamauth$(OBJSUFFICS)
 | 
			
		||||
	$(LN) $(LNOUT)../../$(BUILDDIR)pamauth$(DLSUFFICS) $(LDFLAGS) $(DLFLAGS) -lpam pamauth$(OBJSUFFICS)
 | 
			
		||||
	$(LN) $(LNOUT)../../$(BUILDDIR)pamauth$(DLSUFFICS) $(LDFLAGS) $(DLFLAGS) $(LIBSPREFIX)pam$(LIBSSUFFIX) pamauth$(OBJSUFFICS)
 | 
			
		||||
 | 
			
		||||
@ -124,7 +124,7 @@ int start(struct pluginlink * pluginlink, int argc, unsigned char** argv)
 | 
			
		||||
 if(argc < 2) return 1;
 | 
			
		||||
 pl = pluginlink;
 | 
			
		||||
 if(service) pl->myfree(service);
 | 
			
		||||
 service=pl->mystrdup(argv[1]); 
 | 
			
		||||
 service=(unsigned char *)pl->mystrdup((char *)argv[1]); 
 | 
			
		||||
 | 
			
		||||
 if (already_loaded) { return (0); }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										28
									
								
								src/proxy.c
									
									
									
									
									
								
							
							
						
						
									
										28
									
								
								src/proxy.c
									
									
									
									
									
								
							@ -14,49 +14,49 @@
 | 
			
		||||
char * proxy_stringtable[] = {
 | 
			
		||||
/* 0 */	"HTTP/1.0 400 Bad Request\r\n"
 | 
			
		||||
	"Proxy-Connection: close\r\n"
 | 
			
		||||
	"Content-type: text/html; charset=us-ascii\r\n"
 | 
			
		||||
	"Content-type: text/html; charset=utf-8\r\n"
 | 
			
		||||
	"\r\n"
 | 
			
		||||
	"<html><head><title>400 Bad Request</title></head>\r\n"
 | 
			
		||||
	"<body><h2>400 Bad Request</h2></body></html>\r\n",
 | 
			
		||||
 | 
			
		||||
/* 1 */	"HTTP/1.0 502 Bad Gateway\r\n"
 | 
			
		||||
	"Proxy-Connection: close\r\n"
 | 
			
		||||
	"Content-type: text/html; charset=us-ascii\r\n"
 | 
			
		||||
	"Content-type: text/html; charset=utf-8\r\n"
 | 
			
		||||
	"\r\n"
 | 
			
		||||
	"<html><head><title>502 Bad Gateway</title></head>\r\n"
 | 
			
		||||
	"<body><h2>502 Bad Gateway</h2><h3>Host Not Found or connection failed</h3></body></html>\r\n",
 | 
			
		||||
 | 
			
		||||
/* 2 */	"HTTP/1.0 503 Service Unavailable\r\n"
 | 
			
		||||
	"Proxy-Connection: close\r\n"
 | 
			
		||||
	"Content-type: text/html; charset=us-ascii\r\n"
 | 
			
		||||
	"Content-type: text/html; charset=utf-8\r\n"
 | 
			
		||||
	"\r\n"
 | 
			
		||||
	"<html><head><title>503 Service Unavailable</title></head>\r\n"
 | 
			
		||||
	"<body><h2>503 Service Unavailable</h2><h3>You have exceeded your traffic limit</h3></body></html>\r\n",
 | 
			
		||||
 | 
			
		||||
/* 3 */	"HTTP/1.0 503 Service Unavailable\r\n"
 | 
			
		||||
	"Proxy-Connection: close\r\n"
 | 
			
		||||
	"Content-type: text/html; charset=us-ascii\r\n"
 | 
			
		||||
	"Content-type: text/html; charset=utf-8\r\n"
 | 
			
		||||
	"\r\n"
 | 
			
		||||
	"<html><head><title>503 Service Unavailable</title></head>\r\n"
 | 
			
		||||
	"<body><h2>503 Service Unavailable</h2><h3>Recursion detected</h3></body></html>\r\n",
 | 
			
		||||
 | 
			
		||||
/* 4 */	"HTTP/1.0 501 Not Implemented\r\n"
 | 
			
		||||
	"Proxy-Connection: close\r\n"
 | 
			
		||||
	"Content-type: text/html; charset=us-ascii\r\n"
 | 
			
		||||
	"Content-type: text/html; charset=utf-8\r\n"
 | 
			
		||||
	"\r\n"
 | 
			
		||||
	"<html><head><title>501 Not Implemented</title></head>\r\n"
 | 
			
		||||
	"<body><h2>501 Not Implemented</h2><h3>Required action is not supported by proxy server</h3></body></html>\r\n",
 | 
			
		||||
 | 
			
		||||
/* 5 */	"HTTP/1.0 502 Bad Gateway\r\n"
 | 
			
		||||
	"Proxy-Connection: close\r\n"
 | 
			
		||||
	"Content-type: text/html; charset=us-ascii\r\n"
 | 
			
		||||
	"Content-type: text/html; charset=utf-8\r\n"
 | 
			
		||||
	"\r\n"
 | 
			
		||||
	"<html><head><title>502 Bad Gateway</title></head>\r\n"
 | 
			
		||||
	"<body><h2>502 Bad Gateway</h2><h3>Failed to connect parent proxy</h3></body></html>\r\n",
 | 
			
		||||
 | 
			
		||||
/* 6 */	"HTTP/1.0 500 Internal Error\r\n"
 | 
			
		||||
	"Proxy-Connection: close\r\n"
 | 
			
		||||
	"Content-type: text/html; charset=us-ascii\r\n"
 | 
			
		||||
	"Content-type: text/html; charset=utf-8\r\n"
 | 
			
		||||
	"\r\n"
 | 
			
		||||
	"<html><head><title>500 Internal Error</title></head>\r\n"
 | 
			
		||||
	"<body><h2>500 Internal Error</h2><h3>Internal proxy error during processing your request</h3></body></html>\r\n",
 | 
			
		||||
@ -64,7 +64,7 @@ char * proxy_stringtable[] = {
 | 
			
		||||
/* 7 */	"HTTP/1.0 407 Proxy Authentication Required\r\n"
 | 
			
		||||
	"Proxy-Authenticate: Basic realm=\"proxy\"\r\n"
 | 
			
		||||
	"Proxy-Connection: close\r\n"
 | 
			
		||||
	"Content-type: text/html; charset=us-ascii\r\n"
 | 
			
		||||
	"Content-type: text/html; charset=utf-8\r\n"
 | 
			
		||||
	"\r\n"
 | 
			
		||||
	"<html><head><title>407 Proxy Authentication Required</title></head>\r\n"
 | 
			
		||||
	"<body><h2>407 Proxy Authentication Required</h2><h3>Access to requested resource disallowed by administrator or you need valid username/password to use this resource</h3></body></html>\r\n",
 | 
			
		||||
@ -76,14 +76,14 @@ char * proxy_stringtable[] = {
 | 
			
		||||
 | 
			
		||||
/* 10*/	"HTTP/1.0 404 Not Found\r\n"
 | 
			
		||||
	"Proxy-Connection: close\r\n"
 | 
			
		||||
	"Content-type: text/html; charset=us-ascii\r\n"
 | 
			
		||||
	"Content-type: text/html; charset=utf-8\r\n"
 | 
			
		||||
	"\r\n"
 | 
			
		||||
	"<html><head><title>404 Not Found</title></head>\r\n"
 | 
			
		||||
	"<body><h2>404 Not Found</h2><h3>File not found</body></html>\r\n",
 | 
			
		||||
	
 | 
			
		||||
/* 11*/	"HTTP/1.0 403 Forbidden\r\n"
 | 
			
		||||
	"Proxy-Connection: close\r\n"
 | 
			
		||||
	"Content-type: text/html; charset=us-ascii\r\n"
 | 
			
		||||
	"Content-type: text/html; charset=utf-8\r\n"
 | 
			
		||||
	"\r\n"
 | 
			
		||||
	"<html><head><title>403 Access Denied</title></head>\r\n"
 | 
			
		||||
	"<body><h2>403 Access Denied</h2><h3>Access control list denies you to access this resource</body></html>\r\n",
 | 
			
		||||
@ -94,7 +94,7 @@ char * proxy_stringtable[] = {
 | 
			
		||||
#endif
 | 
			
		||||
	"Proxy-Authenticate: basic realm=\"proxy\"\r\n"
 | 
			
		||||
	"Proxy-Connection: close\r\n"
 | 
			
		||||
	"Content-type: text/html; charset=us-ascii\r\n"
 | 
			
		||||
	"Content-type: text/html; charset=utf-8\r\n"
 | 
			
		||||
	"\r\n"
 | 
			
		||||
	"<html><head><title>407 Proxy Authentication Required</title></head>\r\n"
 | 
			
		||||
	"<body><h2>407 Proxy Authentication Required</h2><h3>Access to requested resource disallowed by administrator or you need valid username/password to use this resource</h3></body></html>\r\n",
 | 
			
		||||
@ -106,13 +106,13 @@ char * proxy_stringtable[] = {
 | 
			
		||||
 | 
			
		||||
/* 14*/	"HTTP/1.0 403 Forbidden\r\n"
 | 
			
		||||
	"Proxy-Connection: close\r\n"
 | 
			
		||||
	"Content-type: text/html; charset=us-ascii\r\n"
 | 
			
		||||
	"Content-type: text/html; charset=utf-8\r\n"
 | 
			
		||||
	"\r\n"
 | 
			
		||||
	"<pre>",
 | 
			
		||||
 | 
			
		||||
/* 15*/	"HTTP/1.0 503 Service Unavailable\r\n"
 | 
			
		||||
	"Proxy-Connection: close\r\n"
 | 
			
		||||
	"Content-type: text/html; charset=us-ascii\r\n"
 | 
			
		||||
	"Content-type: text/html; charset=utf-8\r\n"
 | 
			
		||||
	"\r\n"
 | 
			
		||||
	"<html><head><title>503 Service Unavailable</title></head>\r\n"
 | 
			
		||||
	"<body><h2>503 Service Unavailable</h2><h3>Your request violates configured policy</h3></body></html>\r\n",
 | 
			
		||||
@ -120,7 +120,7 @@ char * proxy_stringtable[] = {
 | 
			
		||||
/* 16*/	"HTTP/1.0 401 Authentication Required\r\n"
 | 
			
		||||
	"WWW-Authenticate: basic realm=\"FTP Server\"\r\n"
 | 
			
		||||
	"Proxy-Connection: close\r\n"
 | 
			
		||||
	"Content-type: text/html; charset=us-ascii\r\n"
 | 
			
		||||
	"Content-type: text/html; charset=utf-8\r\n"
 | 
			
		||||
	"\r\n"
 | 
			
		||||
	"<html><head><title>401 FTP Server requires authentication</title></head>\r\n"
 | 
			
		||||
	"<body><h2>401 FTP Server requires authentication</h2><h3>This FTP server rejects anonymous access</h3></body></html>\r\n",
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user