initial import to git

This commit is contained in:
z3APA3A committed 2014-04-08 13:03:21 +04:00
commit a060376f1e
217 files changed
+64253

No files matched your search

@@ -0,0 +1 @@
D
@@ -0,0 +1 @@
3proxy-0.5a/src/plugins/TransparentPlugin
+1
View File
@@ -0,0 +1 @@
/cygdrive/m/MEDIA/H/CVS
+1
View File
@@ -0,0 +1 @@
include Makefile.var
@@ -0,0 +1,10 @@
all: $(BUILDDIR)TransparentPlugin$(DLSUFFICS)
transparent_plugin$(OBJSUFFICS): transparent_plugin.c
$(CC) $(DCFLAGS) $(CFLAGS) transparent_plugin.c
$(BUILDDIR)TransparentPlugin$(DLSUFFICS): transparent_plugin$(OBJSUFFICS)
$(LN) $(LNOUT)../../$(BUILDDIR)TransparentPlugin$(DLSUFFICS) $(LDFLAGS) $(DLFLAGS) transparent_plugin$(OBJSUFFICS)
@@ -0,0 +1,35 @@
#$Id: Makefile.win,v 1.9 2007/08/20 15:26:27 vlad Exp $
#
# 3 proxy Makefile for GCC/windows
#
# 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
BUILDDIR = ../bin/
CC = gcc
CFLAGS = -Wall -O2 -s -c -mno-cygwin -mthreads -DWITH_STD_MALLOC
COUT = -o
LN = gcc
LDFLAGS = -Wall -O2 -s -mno-cygwin -mthreads
DLFLAGS = -shared
DLSUFFICS = .dll
LIBS = -lws2_32 -lodbc32 -ladvapi32
LNOUT = -o
EXESUFFICS = .exe
OBJSUFFICS = .o
DEFINEOPTION = -D
COMPFILES = *.tmp
REMOVECOMMAND = rm -f
TYPECOMMAND = cat
COMPATLIBS =
MAKEFILE = Makefile.win
PLUGINS = utf8tocp1251 WindowsAuthentication TrafficPlugin StringsPlugin PCREPlugin
include Makefile.inc
allplugins:
@list='$(PLUGINS)'; for p in $$list; do cp Makefile Makefile.var plugins/$$p; cd plugins/$$p ; make ; rm *.o ; cd ../.. ; done
@@ -0,0 +1,114 @@
/*
3APA3A simpliest proxy server
(c) 2007-2008 by ZARAZA <3APA3A@security.nnov.ru>
please read License Agreement
$Id: transparent_plugin.c,v 1.9 2010-11-11 11:32:33 v.dubrovin Exp $
*/
#include <sys/utsname.h>
#include "../../structures.h"
#include "../../proxy.h"
#include <sys/types.h>
#include <sys/socket.h>
#include <limits.h>
#include <linux/netfilter_ipv4.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifndef isnumber
#define isnumber(i_n_arg) ((i_n_arg>='0')&&(i_n_arg<='9'))
#endif
static struct pluginlink * pl;
static pthread_mutex_t transparent_mutex;
static int transparent_loaded = 0;
static void* transparent_filter_open(void * idata, struct srvparam * param){
return idata;
}
static FILTER_ACTION transparent_filter_client(void *fo, struct clientparam * param, void** fc){
#ifdef SO_ORIGINAL_DST
struct sockaddr_in addr;
socklen_t len;
unsigned u;
unsigned short p;
char addrbuf[24];
len = sizeof(addr);
if(getsockopt(param->clisock, SOL_IP, SO_ORIGINAL_DST,(struct sockaddr *) &addr, &len) || !addr.sin_addr.s_addr){
perror("getsockopt()");
return PASS;
}
u = ntohl(addr.sin_addr.s_addr);
p = ntohs(addr.sin_port);
sprintf(addrbuf, "%u.%u.%u.%u:%hu",
((u&0xFF000000)>>24),
((u&0x00FF0000)>>16),
((u&0x0000FF00)>>8),
((u&0x000000FF)),
p);
param->srv->logfunc(param, (unsigned char *)"transparent_filter_client() Success");
param->srv->logfunc(param, (unsigned char *)addrbuf);
pl->parsehostname(addrbuf, param, 0);
return PASS;
#else
#error No SO_ORIGINAL_DST defined
param->srv->logfunc(param, (unsigned char *)"transparent_plugin: No SO_ORIGINAL_DST defined");
return REJECT;
#endif
return PASS;
}
static void transparent_filter_clear(void *fo){
}
static void transparent_filter_close(void *fo){
}
static struct filter transparent_filter = {
NULL,
"Transparent filter",
"Transparent filter",
transparent_filter_open,
transparent_filter_client,
NULL, NULL, NULL, NULL, NULL, NULL,
transparent_filter_clear,
transparent_filter_close
};
#ifdef _WIN32
__declspec(dllexport)
#endif
int transparent_plugin (struct pluginlink * pluginlink,
int argc, char** argv){
pl = pluginlink;
if(!transparent_loaded){
transparent_loaded = 1;
pthread_mutex_init(&transparent_mutex, NULL);
transparent_filter.next = pl->conf->filters;
pl->conf->filters = &transparent_filter;
}
return 0;
}
#ifdef __cplusplus
}
#endif