diff --git a/changes.txt b/changes.txt index cc38eef..9a263b2 100644 --- a/changes.txt +++ b/changes.txt @@ -49,3 +49,7 @@ ipban : added ipban ipset. place domains banned by ip to zapret-hosts-user-ipban these IPs must be soxified for both http and https ISP support : tiera support ISP support : added DNS filtering to ubuntu and debian scripts + +v10 + +tpws : added split-pos option. split every message at specified position diff --git a/nfq/Makefile b/nfq/Makefile index 37b1994..f05f4b3 100644 --- a/nfq/Makefile +++ b/nfq/Makefile @@ -1,13 +1,12 @@ -CFLAGS=-Wall -LIBS=-lnetfilter_queue -lnfnetlink +CC = gcc +CFLAGS = -s +LIBS = -lnetfilter_queue -lnfnetlink +SRC_FILES = *.c all: nfqws -nfqws: nfqws.o - $(CC) $(CFLAGS) -o "$@" $< $(LIBS) - -nfqws.o: nfqws.c - $(CC) $(CFLAGS) -c $< +nfqws: $(SRC_FILES) + $(CC) $(CFLAGS) -o $@ $^ $(LIBS) clean: - rm -f *.o nfqws + rm -f nfqws *.o diff --git a/readme.txt b/readme.txt index 1b9f030..d4d92b4 100644 --- a/readme.txt +++ b/readme.txt @@ -1,5 +1,4 @@ -zapret v.9 - +zapret v.10 Для чего это надо ----------------- @@ -111,6 +110,7 @@ tpws - это transparent proxy. --daemon ; демонизировать прогу --user= ; менять uid процесса --split-http-req=method|host ; способ разделения http запросов на сегменты : около метода (GET,POST) или около заголовка Host + --split-pos= ; делить все посылы на сегменты в указанной позиции. Если отсыл длинее 8Kb (размер буфера приема), то будет разделен каждый блок по 8Kb. --hostcase ; замена "Host:" => "host:" --hostdot ; добавление точки после имени хоста : "Host: kinozal.tv." --methodspace ; добавить пробел после метода : "GET /" => "GET /" diff --git a/tpws/Makefile b/tpws/Makefile index 0d5ef60..1ddcaa6 100644 --- a/tpws/Makefile +++ b/tpws/Makefile @@ -1,5 +1,5 @@ CC = gcc -CFLAGS = +CFLAGS = -s LIBS = SRC_FILES = *.c @@ -10,5 +10,3 @@ tpws: $(SRC_FILES) clean: rm -f tpws *.o - -.PHONY: clean diff --git a/tpws/tpws.c b/tpws/tpws.c index ea305e0..d5ccf41 100644 --- a/tpws/tpws.c +++ b/tpws/tpws.c @@ -35,6 +35,7 @@ struct params_s bool daemon; bool hostcase,hostdot,methodspace; enum splithttpreq split_http_req; + int split_pos; int maxconn; }; @@ -150,30 +151,38 @@ bool handle_epollin(tproxy_conn_t *conn,int *data_transferred){ } } } - switch (params.split_http_req) + if (params.split_pos) { - case split_method: - // do we have already split position ? if so use it without another search - if (method_split_pos) - { - split_array = NULL; - split_pos = method_split_pos; - } - else - split_array = http_split_methods; - break; - case split_host: - if (host_split_pos) - { - split_array = NULL; - split_pos = host_split_pos; - } - else - split_array = http_split_host; - break; - default: split_array = NULL; - split_pos=0; + split_pos = params.split_pos|\n --port=\n --maxconn=\n --split-http-req=method|host\n --hostcase\t\t; change Host: => host:\n --hostdot\t\t; add \".\" after Host: name\n --methodspace\t\t; add extra space after method\n --daemon\t\t; daemonize\n --user=\t; drop root privs\n"); + printf(" --bind-addr=|\n --port=\n --maxconn=\n --split-http-req=method|host\n --split-pos=\t split at specified pos. invalidates split-http-req.\n --hostcase\t\t; change Host: => host:\n --hostdot\t\t; add \".\" after Host: name\n --methodspace\t\t; add extra space after method\n --daemon\t\t; daemonize\n --user=\t; drop root privs\n"); exit(1); } @@ -407,7 +416,8 @@ void parse_params(int argc, char *argv[]) {"hostcase",no_argument,0,0},// optidx=7 {"hostdot",no_argument,0,0},// optidx=8 {"split-http-req",required_argument,0,0},// optidx=9 - {"methodspace",no_argument,0,0},// optidx=10 + {"split-pos",required_argument,0,0},// optidx=10 + {"methodspace",no_argument,0,0},// optidx=11 {NULL,0,NULL,0} }; while ((v=getopt_long_only(argc,argv,"",long_options,&option_index))!=-1) @@ -472,7 +482,17 @@ void parse_params(int argc, char *argv[]) exit(1); } break; - case 10: /* methodspace */ + case 10: /* split-pos */ + i = atoi(optarg); + if (i) + params.split_pos = i; + else + { + fprintf(stderr,"Invalid argument for split-pos\n"); + exit(1); + } + break; + case 11: /* methodspace */ params.methodspace = true; break; }