It supports reading the same parameters in the configuration file (such as strrep and regrep)
This commit is contained in:
parent
cb68da2b3c
commit
c0e238eb0c
16
13.txt
Executable file
16
13.txt
Executable file
@ -0,0 +1,16 @@
|
|||||||
|
==1384== Memcheck, a memory error detector
|
||||||
|
==1384== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
|
||||||
|
==1384== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
|
||||||
|
==1384== Command: ./CProxy
|
||||||
|
==1384== Parent PID: 74
|
||||||
|
==1384==
|
||||||
|
==1384== error calling PR_SET_PTRACER, vgdb might block
|
||||||
|
==1384==
|
||||||
|
==1384== HEAP SUMMARY:
|
||||||
|
==1384== in use at exit: 0 bytes in 0 blocks
|
||||||
|
==1384== total heap usage: 43 allocs, 43 frees, 10,762 bytes allocated
|
||||||
|
==1384==
|
||||||
|
==1384== All heap blocks were freed -- no leaks are possible
|
||||||
|
==1384==
|
||||||
|
==1384== For lists of detected and suppressed errors, rerun with: -s
|
||||||
|
==1384== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
|
21
CProxy.conf
21
CProxy.conf
@ -9,25 +9,24 @@ global {
|
|||||||
}
|
}
|
||||||
|
|
||||||
http {
|
http {
|
||||||
http_ip="2001:19f0:4401:2f:5400:3ff:fec4:e376";
|
http_ip="47.240.75.93";
|
||||||
http_port=127;
|
http_port=129;
|
||||||
http_del="Host";
|
http_del="Host";
|
||||||
http_first="[M] http://[host][U] [V]\r\nHost: [H]\r\n";
|
http_first="[M] http://[host][U] [V]\r\nHost: [H]\r\n";
|
||||||
strrep="Windows NT 10.0" -> "Linux";
|
strrep = "(Windows NT 10.0; Win64; x64)" -> "Android";
|
||||||
strrep="XiaoMi MIX 2S" -> "Linux";
|
regrep = "Host*.+?" -> "Host: [host]";
|
||||||
regrep="Host:*.+?" -> "Host: [host]:80";
|
|
||||||
regrep="Host:*.+?" -> "host: [host]:80";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
https {
|
https {
|
||||||
https_ip="2001:19f0:4401:2f:5400:3ff:fec4:e376";
|
https_ip="2001:19f0:4401:2f:5400:3ff:fec4:e376";
|
||||||
https_port=127;
|
https_port=129;
|
||||||
https_del="Host,host,x-online-host";
|
https_del="Host,host,x-online-host";
|
||||||
https_first="[M] [U] [V]\r\nHost: [host]\r\n";
|
https_first="[M] [U] [V]\r\nHost: [host]\r\n";
|
||||||
strrep = "Windows NT 10.0" -> "Linux1";
|
strrep = "HTTP/1.1" -> "HTTP/1.3";
|
||||||
strrep = "XiaoMi MIX 2S" -> "Linux2";
|
strrep = "HTTP/1.3" -> "HTTP/1.1";
|
||||||
regrep = "Host*.+?" -> "host: [host]:443";
|
regrep = "host*.+?" -> "Host: [host]";
|
||||||
regrep = "Host*.+?" -> "Host: [host]:443";
|
regrep = "Host*.+?" -> "host: [host]";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
httpdns {
|
httpdns {
|
||||||
|
87
conf.c
87
conf.c
@ -221,6 +221,7 @@ static void parse_http_module(char *content, conf * p)
|
|||||||
int val_begin_len;
|
int val_begin_len;
|
||||||
tcp *http_node = NULL;
|
tcp *http_node = NULL;
|
||||||
char *p1 = NULL, *s = NULL, *t = NULL;
|
char *p1 = NULL, *s = NULL, *t = NULL;
|
||||||
|
char *p2 = NULL;
|
||||||
|
|
||||||
while ((lineEnd = set_var_val_lineEnd(content, &var, &val_begin, &val_end)) != NULL) {
|
while ((lineEnd = set_var_val_lineEnd(content, &var, &val_begin, &val_end)) != NULL) {
|
||||||
if (strcasecmp(var, "http_ip") == 0) {
|
if (strcasecmp(var, "http_ip") == 0) {
|
||||||
@ -248,10 +249,13 @@ static void parse_http_module(char *content, conf * p)
|
|||||||
return ;
|
return ;
|
||||||
memset(http_node, 0, sizeof(struct tcp));
|
memset(http_node, 0, sizeof(struct tcp));
|
||||||
http_node->strrep = strdup(val_begin);
|
http_node->strrep = strdup(val_begin);
|
||||||
|
http_node->strrep_len = val_end - val_begin;
|
||||||
|
|
||||||
p1 = strstr(val_begin, "->");
|
p1 = strstr(val_begin, "->");
|
||||||
for (t = p1; *t != '"'; ++t) ;
|
for (t = p1; *t != '"'; ++t) ;
|
||||||
http_node->strrep_t = strdup(t + 1);
|
http_node->strrep_t = strdup(t + 1);
|
||||||
|
p2 = strchr(t+1, '\0');
|
||||||
|
http_node->strrep_t_len = p2 - (t + 1);
|
||||||
|
|
||||||
for (s = p1 - 1; *s == ' '; s--) {
|
for (s = p1 - 1; *s == ' '; s--) {
|
||||||
if (s == val_begin)
|
if (s == val_begin)
|
||||||
@ -261,6 +265,7 @@ static void parse_http_module(char *content, conf * p)
|
|||||||
s--;
|
s--;
|
||||||
|
|
||||||
http_node->strrep_s = strndup(val_begin, s - val_begin + 1);
|
http_node->strrep_s = strndup(val_begin, s - val_begin + 1);
|
||||||
|
http_node->strrep_s_len = s - val_begin + 1;
|
||||||
|
|
||||||
http_node->next = NULL;
|
http_node->next = NULL;
|
||||||
if (http_head == NULL) {
|
if (http_head == NULL) {
|
||||||
@ -275,10 +280,13 @@ static void parse_http_module(char *content, conf * p)
|
|||||||
return ;
|
return ;
|
||||||
memset(http_node, 0, sizeof(struct tcp));
|
memset(http_node, 0, sizeof(struct tcp));
|
||||||
http_node->regrep = strdup(val_begin);
|
http_node->regrep = strdup(val_begin);
|
||||||
|
http_node->regrep_len = val_end - val_begin;
|
||||||
|
|
||||||
p1 = strstr(val_begin, "->");
|
p1 = strstr(val_begin, "->");
|
||||||
for (t = p1; *t != '"'; ++t) ;
|
for (t = p1; *t != '"'; ++t) ;
|
||||||
http_node->regrep_t = strdup(t + 1);
|
http_node->regrep_t = strdup(t + 1);
|
||||||
|
p2 = strchr(t+1, '\0');
|
||||||
|
http_node->regrep_t_len = p2 - (t + 1);
|
||||||
|
|
||||||
for (s = p1 - 1; *s == ' '; s--) {
|
for (s = p1 - 1; *s == ' '; s--) {
|
||||||
if (s == val_begin)
|
if (s == val_begin)
|
||||||
@ -288,6 +296,7 @@ static void parse_http_module(char *content, conf * p)
|
|||||||
s--;
|
s--;
|
||||||
|
|
||||||
http_node->regrep_s = strndup(val_begin, s - val_begin + 1);
|
http_node->regrep_s = strndup(val_begin, s - val_begin + 1);
|
||||||
|
http_node->regrep_s_len = s - val_begin + 1;
|
||||||
|
|
||||||
http_node->next = NULL;
|
http_node->next = NULL;
|
||||||
if (http_head == NULL) {
|
if (http_head == NULL) {
|
||||||
@ -308,6 +317,7 @@ static void parse_https_module(char *content, conf * p)
|
|||||||
int val_begin_len;
|
int val_begin_len;
|
||||||
tcp *https_node = NULL;
|
tcp *https_node = NULL;
|
||||||
char *p1 = NULL, *s = NULL, *t = NULL;
|
char *p1 = NULL, *s = NULL, *t = NULL;
|
||||||
|
char *p2 = NULL;
|
||||||
|
|
||||||
while ((lineEnd = set_var_val_lineEnd(content, &var, &val_begin, &val_end)) != NULL) {
|
while ((lineEnd = set_var_val_lineEnd(content, &var, &val_begin, &val_end)) != NULL) {
|
||||||
if (strcasecmp(var, "https_ip") == 0) {
|
if (strcasecmp(var, "https_ip") == 0) {
|
||||||
@ -336,10 +346,13 @@ static void parse_https_module(char *content, conf * p)
|
|||||||
return ;
|
return ;
|
||||||
memset(https_node, 0, sizeof(struct tcp));
|
memset(https_node, 0, sizeof(struct tcp));
|
||||||
https_node->strrep = strdup(val_begin);
|
https_node->strrep = strdup(val_begin);
|
||||||
|
https_node->strrep_len = val_end - val_begin;
|
||||||
|
|
||||||
p1 = strstr(val_begin, "->");
|
p1 = strstr(val_begin, "->");
|
||||||
for (t = p1; *t != '"'; ++t) ;
|
for (t = p1; *t != '"'; ++t) ;
|
||||||
https_node->strrep_t = strdup(t + 1);
|
https_node->strrep_t = strdup(t + 1);
|
||||||
|
p2 = strchr(t+1, '\0');
|
||||||
|
https_node->strrep_t_len = p2 - (t + 1);
|
||||||
|
|
||||||
for (s = p1 - 1; *s == ' '; s--) {
|
for (s = p1 - 1; *s == ' '; s--) {
|
||||||
if (s == val_begin)
|
if (s == val_begin)
|
||||||
@ -349,13 +362,18 @@ static void parse_https_module(char *content, conf * p)
|
|||||||
s--;
|
s--;
|
||||||
|
|
||||||
https_node->strrep_s = strndup(val_begin, s - val_begin + 1);
|
https_node->strrep_s = strndup(val_begin, s - val_begin + 1);
|
||||||
|
https_node->strrep_s_len = s - val_begin + 1;
|
||||||
|
|
||||||
https_node->next = NULL;
|
https_node->next = NULL;
|
||||||
|
|
||||||
if (https_head == NULL) {
|
if (https_head == NULL) {
|
||||||
https_head = https_node;
|
https_head = https_node;
|
||||||
} else {
|
} else {
|
||||||
https_node->next = https_head;
|
//https_node->next = https_head;
|
||||||
https_head = https_node;
|
//https_head = https_node;
|
||||||
|
|
||||||
|
https_node->next = https_head->next;
|
||||||
|
https_head->next = https_node;
|
||||||
}
|
}
|
||||||
} else if (strcasecmp(var, "regrep") == 0) {
|
} else if (strcasecmp(var, "regrep") == 0) {
|
||||||
https_node = (tcp *) malloc(sizeof(struct tcp));
|
https_node = (tcp *) malloc(sizeof(struct tcp));
|
||||||
@ -363,10 +381,13 @@ static void parse_https_module(char *content, conf * p)
|
|||||||
return ;
|
return ;
|
||||||
memset(https_node, 0, sizeof(struct tcp));
|
memset(https_node, 0, sizeof(struct tcp));
|
||||||
https_node->regrep = strdup(val_begin);
|
https_node->regrep = strdup(val_begin);
|
||||||
|
https_node->regrep_len = val_end - val_begin;
|
||||||
|
|
||||||
p1 = strstr(val_begin, "->");
|
p1 = strstr(val_begin, "->");
|
||||||
for (t = p1; *t != '"'; ++t) ;
|
for (t = p1; *t != '"'; ++t) ;
|
||||||
https_node->regrep_t = strdup(t + 1);
|
https_node->regrep_t = strdup(t + 1);
|
||||||
|
p2 = strchr(t+1, '\0');
|
||||||
|
https_node->regrep_t_len = p2 - (t + 1);
|
||||||
|
|
||||||
for (s = p1 - 1; *s == ' '; s--) {
|
for (s = p1 - 1; *s == ' '; s--) {
|
||||||
if (s == val_begin)
|
if (s == val_begin)
|
||||||
@ -376,6 +397,7 @@ static void parse_https_module(char *content, conf * p)
|
|||||||
s--;
|
s--;
|
||||||
|
|
||||||
https_node->regrep_s = strndup(val_begin, s - val_begin + 1);
|
https_node->regrep_s = strndup(val_begin, s - val_begin + 1);
|
||||||
|
https_node->regrep_s_len = s - val_begin + 1;
|
||||||
|
|
||||||
https_node->next = NULL;
|
https_node->next = NULL;
|
||||||
if (https_head == NULL) {
|
if (https_head == NULL) {
|
||||||
@ -383,6 +405,9 @@ static void parse_https_module(char *content, conf * p)
|
|||||||
} else {
|
} else {
|
||||||
https_node->next = https_head;
|
https_node->next = https_head;
|
||||||
https_head = https_node;
|
https_head = https_node;
|
||||||
|
|
||||||
|
//https_node->next = https_head->next;
|
||||||
|
//https_head->next = https_node;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -390,56 +415,54 @@ static void parse_https_module(char *content, conf * p)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 打印链表
|
// 打印tcp链表
|
||||||
void print_tcp(tcp * p)
|
void print_tcp(tcp * p)
|
||||||
{
|
{
|
||||||
tcp *temp = p;
|
tcp *temp = p;
|
||||||
while (temp) {
|
while (temp) {
|
||||||
if (temp->strrep)
|
if (temp->strrep)
|
||||||
;//printf("%s\n", temp->strrep);
|
printf("%s %d\n", temp->strrep, temp->strrep_len);
|
||||||
if (temp->strrep_s)
|
if (temp->strrep_s)
|
||||||
printf("%s\n", temp->strrep_s);
|
printf("%s %d\n", temp->strrep_s, temp->strrep_s_len);
|
||||||
if (temp->strrep_t)
|
if (temp->strrep_t)
|
||||||
printf("%s\n", temp->strrep_t);
|
printf("%s %d\n", temp->strrep_t, temp->strrep_t_len);
|
||||||
|
|
||||||
if (temp->regrep)
|
if (temp->regrep)
|
||||||
;//printf("%s\n", temp->regrep);
|
printf("%s %d\n", temp->regrep, temp->regrep_len);
|
||||||
if (temp->regrep_s)
|
if (temp->regrep_s)
|
||||||
printf("%s\n", temp->regrep_s);
|
printf("%s %d\n", temp->regrep_s, temp->regrep_s_len);
|
||||||
if (temp->regrep_t)
|
if (temp->regrep_t)
|
||||||
printf("%s\n", temp->regrep_t);
|
printf("%s %d\n", temp->regrep_t, temp->regrep_t_len);
|
||||||
|
|
||||||
temp = temp->next;
|
temp = temp->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// free链表
|
// Free tcp 链表
|
||||||
void free_tcp(tcp * p)
|
void free_tcp(tcp **conf_head)
|
||||||
{
|
{
|
||||||
while (p) {
|
tcp *t;
|
||||||
tcp *temp = p;
|
while(*conf_head != NULL)
|
||||||
|
{
|
||||||
|
t=*conf_head;
|
||||||
|
*conf_head=t->next;
|
||||||
|
|
||||||
if (temp->strrep)
|
if (t->strrep)
|
||||||
free(temp->strrep);
|
free(t->strrep);
|
||||||
if (temp->strrep_s)
|
if (t->strrep_s)
|
||||||
free(temp->strrep_s);
|
free(t->strrep_s);
|
||||||
if (temp->strrep_t)
|
if (t->strrep_t)
|
||||||
free(temp->strrep_t);
|
free(t->strrep_t);
|
||||||
|
|
||||||
if (temp->regrep)
|
if (t->regrep)
|
||||||
free(temp->regrep);
|
free(t->regrep);
|
||||||
if (temp->regrep_s)
|
if (t->regrep_s)
|
||||||
free(temp->regrep_s);
|
free(t->regrep_s);
|
||||||
if (temp->regrep_t)
|
if (t->regrep_t)
|
||||||
free(temp->regrep_t);
|
free(t->regrep_t);
|
||||||
|
if (t)
|
||||||
if (temp)
|
free(t);
|
||||||
free(temp);
|
|
||||||
|
|
||||||
p = p->next;
|
|
||||||
}
|
}
|
||||||
free(p);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void parse_httpdns_module(char *content, conf * p)
|
static void parse_httpdns_module(char *content, conf * p)
|
||||||
|
7
conf.h
7
conf.h
@ -45,10 +45,14 @@ typedef struct CONF {
|
|||||||
|
|
||||||
typedef struct tcp {
|
typedef struct tcp {
|
||||||
char *strrep;
|
char *strrep;
|
||||||
|
int strrep_len;
|
||||||
char *strrep_s, *strrep_t;
|
char *strrep_s, *strrep_t;
|
||||||
|
int strrep_s_len, strrep_t_len;
|
||||||
|
|
||||||
char *regrep;
|
char *regrep;
|
||||||
|
int regrep_len;
|
||||||
char *regrep_s, *regrep_t;
|
char *regrep_s, *regrep_t;
|
||||||
|
int regrep_s_len, regrep_t_len;
|
||||||
|
|
||||||
struct tcp *next;
|
struct tcp *next;
|
||||||
} tcp;
|
} tcp;
|
||||||
@ -59,7 +63,8 @@ extern tcp *http_node;
|
|||||||
extern tcp *https_head;
|
extern tcp *https_head;
|
||||||
extern tcp *https_node;
|
extern tcp *https_node;
|
||||||
extern void print_tcp(tcp *p);
|
extern void print_tcp(tcp *p);
|
||||||
extern void free_tcp(tcp *p);
|
extern void free_tcp(tcp **p);
|
||||||
|
|
||||||
|
|
||||||
char *strncpy_(char *dest, const char *src, size_t n);
|
char *strncpy_(char *dest, const char *src, size_t n);
|
||||||
void read_conf(char *file, conf *p);
|
void read_conf(char *file, conf *p);
|
||||||
|
@ -336,6 +336,7 @@ void tcp_in(conn_t * in, conf * configure)
|
|||||||
if (request_type(in->incomplete_data) == HTTP_TYPE) {
|
if (request_type(in->incomplete_data) == HTTP_TYPE) {
|
||||||
in->incomplete_data = request_head(in, configure);
|
in->incomplete_data = request_head(in, configure);
|
||||||
server->fd = create_connection6(remote_host, remote_port);
|
server->fd = create_connection6(remote_host, remote_port);
|
||||||
|
|
||||||
if (server->fd < 0)
|
if (server->fd < 0)
|
||||||
printf("remote->fd ERROR!\n");
|
printf("remote->fd ERROR!\n");
|
||||||
fcntl(server->fd, F_SETFL, O_NONBLOCK);
|
fcntl(server->fd, F_SETFL, O_NONBLOCK);
|
||||||
|
BIN
http_proxy.o
BIN
http_proxy.o
Binary file not shown.
@ -212,9 +212,11 @@ int extract_host(char *header, char *host, char *port)
|
|||||||
} else {
|
} else {
|
||||||
|
|
||||||
char *p = strstr(header, "Host:");
|
char *p = strstr(header, "Host:");
|
||||||
if (!p) {
|
char *p0 = strstr(header, "host:");
|
||||||
|
if (!p && !p0) { // 都为空的时候返回 -1
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *p1 = strchr(p, '\n');
|
char *p1 = strchr(p, '\n');
|
||||||
if (!p1) {
|
if (!p1) {
|
||||||
return -1;
|
return -1;
|
||||||
@ -229,8 +231,8 @@ int extract_host(char *header, char *host, char *port)
|
|||||||
char *p4 = NULL;
|
char *p4 = NULL;
|
||||||
if (p3)
|
if (p3)
|
||||||
p4 = strchr(p3 + 1, ':');
|
p4 = strchr(p3 + 1, ':');
|
||||||
|
{ // IPV6
|
||||||
if (p4 != NULL) { // IPV6
|
if (p4 != NULL) {
|
||||||
char *p5 = NULL;
|
char *p5 = NULL;
|
||||||
char *p6 = NULL;
|
char *p6 = NULL;
|
||||||
p5 = strchr(header, ' ');
|
p5 = strchr(header, ' ');
|
||||||
@ -278,6 +280,7 @@ int extract_host(char *header, char *host, char *port)
|
|||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (p2 && p2 < p1) {
|
if (p2 && p2 < p1) {
|
||||||
memcpy(port, p2 + 1, (int)(p1 - p2 - 1));
|
memcpy(port, p2 + 1, (int)(p1 - p2 - 1));
|
||||||
@ -492,8 +495,28 @@ void parse_request_head(char *http_request_line, struct http_request *http_reque
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char *conf_handle(char *str, int str_len, tcp *p)
|
||||||
|
{
|
||||||
|
|
||||||
|
while (p) {
|
||||||
|
if (p->strrep) {
|
||||||
|
str = replace(str, &str_len, p->strrep_s, p->strrep_s_len, p->strrep_t, p->strrep_t_len);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (p->regrep) {
|
||||||
|
str = regrep(str, &str_len, p->regrep_s, p->regrep_t, p->regrep_t_len);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
p = p->next;
|
||||||
|
}
|
||||||
|
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
char *request_head(conn_t * in, conf * configure)
|
char *request_head(conn_t * in, conf * configure)
|
||||||
{
|
{
|
||||||
|
|
||||||
struct http_request *http_request;
|
struct http_request *http_request;
|
||||||
http_request = (struct http_request *)malloc(sizeof(struct http_request));
|
http_request = (struct http_request *)malloc(sizeof(struct http_request));
|
||||||
memset(http_request, 0, sizeof(struct http_request));
|
memset(http_request, 0, sizeof(struct http_request));
|
||||||
@ -525,6 +548,7 @@ char *request_head(conn_t * in, conf * configure)
|
|||||||
delete_head(incomplete_head, result, '\n');
|
delete_head(incomplete_head, result, '\n');
|
||||||
result = strtok(NULL, ",");
|
result = strtok(NULL, ",");
|
||||||
}
|
}
|
||||||
|
|
||||||
splice_head(incomplete_head, "\n", configure->https_first);
|
splice_head(incomplete_head, "\n", configure->https_first);
|
||||||
incomplete_head_len = strlen(incomplete_head);
|
incomplete_head_len = strlen(incomplete_head);
|
||||||
incomplete_head = replace(incomplete_head, &incomplete_head_len, "\\r", 2, "\r", 1);
|
incomplete_head = replace(incomplete_head, &incomplete_head_len, "\\r", 2, "\r", 1);
|
||||||
@ -544,12 +568,9 @@ char *request_head(conn_t * in, conf * configure)
|
|||||||
incomplete_head = replace(incomplete_head, &incomplete_head_len, "[host]", 6, http_request->host, http_request->host_len);
|
incomplete_head = replace(incomplete_head, &incomplete_head_len, "[host]", 6, http_request->host, http_request->host_len);
|
||||||
incomplete_head = replace(incomplete_head, &incomplete_head_len, "[port]", 6, http_request->port, http_request->port_len);
|
incomplete_head = replace(incomplete_head, &incomplete_head_len, "[port]", 6, http_request->port, http_request->port_len);
|
||||||
incomplete_head = replace(incomplete_head, &incomplete_head_len, "[H]", 3, http_request->H, http_request->H_len);
|
incomplete_head = replace(incomplete_head, &incomplete_head_len, "[H]", 3, http_request->H, http_request->H_len);
|
||||||
/*
|
|
||||||
if (configure->https_strrep)
|
incomplete_head = conf_handle(incomplete_head, incomplete_head_len, https_head);
|
||||||
incomplete_head = replace(incomplete_head, &incomplete_head_len, configure->https_strrep_aim, configure->https_strrep_aim_len, configure->https_strrep_obj, configure->https_strrep_obj_len);
|
|
||||||
if (configure->https_regrep)
|
|
||||||
incomplete_head = regrep(incomplete_head, &incomplete_head_len, configure->https_regrep_aim, configure->https_regrep_obj, configure->https_regrep_obj_len);
|
|
||||||
*/
|
|
||||||
incomplete_head = replace(incomplete_head, &incomplete_head_len, "[H]", 3, http_request->H, http_request->H_len);
|
incomplete_head = replace(incomplete_head, &incomplete_head_len, "[H]", 3, http_request->H, http_request->H_len);
|
||||||
incomplete_head = replace(incomplete_head, &incomplete_head_len, "[host]", 6, http_request->host, http_request->host_len);
|
incomplete_head = replace(incomplete_head, &incomplete_head_len, "[host]", 6, http_request->host, http_request->host_len);
|
||||||
incomplete_head = replace(incomplete_head, &incomplete_head_len, "[port]", 6, http_request->port, http_request->port_len);
|
incomplete_head = replace(incomplete_head, &incomplete_head_len, "[port]", 6, http_request->port, http_request->port_len);
|
||||||
@ -609,12 +630,9 @@ char *request_head(conn_t * in, conf * configure)
|
|||||||
incomplete_head = replace(incomplete_head, &incomplete_head_len, "[host]", 6, http_request->host, http_request->host_len);
|
incomplete_head = replace(incomplete_head, &incomplete_head_len, "[host]", 6, http_request->host, http_request->host_len);
|
||||||
incomplete_head = replace(incomplete_head, &incomplete_head_len, "[port]", 6, http_request->port, http_request->port_len);
|
incomplete_head = replace(incomplete_head, &incomplete_head_len, "[port]", 6, http_request->port, http_request->port_len);
|
||||||
incomplete_head = replace(incomplete_head, &incomplete_head_len, "[H]", 3, http_request->H, http_request->H_len);
|
incomplete_head = replace(incomplete_head, &incomplete_head_len, "[H]", 3, http_request->H, http_request->H_len);
|
||||||
/*
|
|
||||||
if (configure->http_strrep)
|
incomplete_head = conf_handle(incomplete_head, incomplete_head_len, http_head);
|
||||||
incomplete_head = replace(incomplete_head, &incomplete_head_len, configure->http_strrep_aim, configure->http_strrep_aim_len, configure->http_strrep_obj, configure->http_strrep_obj_len);
|
|
||||||
if (configure->http_regrep)
|
|
||||||
incomplete_head = regrep(incomplete_head, &incomplete_head_len, configure->http_regrep_aim, configure->http_regrep_obj, configure->http_regrep_obj_len);
|
|
||||||
*/
|
|
||||||
incomplete_head = replace(incomplete_head, &incomplete_head_len, "[host]", 6, http_request->host, http_request->host_len);
|
incomplete_head = replace(incomplete_head, &incomplete_head_len, "[host]", 6, http_request->host, http_request->host_len);
|
||||||
incomplete_head = replace(incomplete_head, &incomplete_head_len, "[port]", 6, http_request->port, http_request->port_len);
|
incomplete_head = replace(incomplete_head, &incomplete_head_len, "[port]", 6, http_request->port, http_request->port_len);
|
||||||
incomplete_head = replace(incomplete_head, &incomplete_head_len, "[H]", 3, http_request->H, http_request->H_len);
|
incomplete_head = replace(incomplete_head, &incomplete_head_len, "[H]", 3, http_request->H, http_request->H_len);
|
||||||
|
BIN
http_request.o
BIN
http_request.o
Binary file not shown.
BIN
libs/arm64-v8a/CProxy
Executable file
BIN
libs/arm64-v8a/CProxy
Executable file
Binary file not shown.
BIN
libs/armeabi-v7a/CProxy
Executable file
BIN
libs/armeabi-v7a/CProxy
Executable file
Binary file not shown.
17
main.c
17
main.c
@ -456,11 +456,16 @@ void _main(int argc, char *argv[])
|
|||||||
memset(configure, 0, sizeof(struct CONF));
|
memset(configure, 0, sizeof(struct CONF));
|
||||||
read_conf(inifile, configure);
|
read_conf(inifile, configure);
|
||||||
|
|
||||||
|
/*
|
||||||
print_tcp(https_head);
|
print_tcp(https_head);
|
||||||
free_tcp(https_head);
|
free_tcp(&https_head);
|
||||||
print_tcp(http_head);
|
//print_tcp(http_head);
|
||||||
free_tcp(http_head);
|
free_tcp(&http_head);
|
||||||
//exit(0);
|
free_conf(configure);
|
||||||
|
free(configure);
|
||||||
|
exit(0);
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
sslEncodeCode = 0; // 默认SSL不转码
|
sslEncodeCode = 0; // 默认SSL不转码
|
||||||
if (configure->sslencoding > 0) // 如果配置文件有sslencoding值,优先使用配置文件读取的值
|
if (configure->sslencoding > 0) // 如果配置文件有sslencoding值,优先使用配置文件读取的值
|
||||||
@ -514,6 +519,8 @@ void _main(int argc, char *argv[])
|
|||||||
process = atoi(optarg);
|
process = atoi(optarg);
|
||||||
break;
|
break;
|
||||||
case 'c':
|
case 'c':
|
||||||
|
free_tcp(&https_head);
|
||||||
|
free_tcp(&http_head);
|
||||||
free_conf(configure);
|
free_conf(configure);
|
||||||
memset(configure, 0, sizeof(struct CONF));
|
memset(configure, 0, sizeof(struct CONF));
|
||||||
read_conf(optarg, configure);
|
read_conf(optarg, configure);
|
||||||
@ -559,7 +566,7 @@ void _main(int argc, char *argv[])
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[], char **env)
|
int main(int argc, char *argv[], char **envp)
|
||||||
{
|
{
|
||||||
_main(argc, argv);
|
_main(argc, argv);
|
||||||
return 0;
|
return 0;
|
||||||
|
BIN
obj/local/arm64-v8a/CProxy
Executable file
BIN
obj/local/arm64-v8a/CProxy
Executable file
Binary file not shown.
BIN
obj/local/arm64-v8a/objs/CProxy/conf.o
Executable file
BIN
obj/local/arm64-v8a/objs/CProxy/conf.o
Executable file
Binary file not shown.
3
obj/local/arm64-v8a/objs/CProxy/conf.o.d
Executable file
3
obj/local/arm64-v8a/objs/CProxy/conf.o.d
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
./obj/local/arm64-v8a/objs/CProxy/conf.o: conf.c conf.h
|
||||||
|
|
||||||
|
conf.h:
|
BIN
obj/local/arm64-v8a/objs/CProxy/help.o
Executable file
BIN
obj/local/arm64-v8a/objs/CProxy/help.o
Executable file
Binary file not shown.
3
obj/local/arm64-v8a/objs/CProxy/help.o.d
Executable file
3
obj/local/arm64-v8a/objs/CProxy/help.o.d
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
./obj/local/arm64-v8a/objs/CProxy/help.o: help.c help.h
|
||||||
|
|
||||||
|
help.h:
|
BIN
obj/local/arm64-v8a/objs/CProxy/http_proxy.o
Executable file
BIN
obj/local/arm64-v8a/objs/CProxy/http_proxy.o
Executable file
Binary file not shown.
8
obj/local/arm64-v8a/objs/CProxy/http_proxy.o.d
Executable file
8
obj/local/arm64-v8a/objs/CProxy/http_proxy.o.d
Executable file
@ -0,0 +1,8 @@
|
|||||||
|
./obj/local/arm64-v8a/objs/CProxy/http_proxy.o: http_proxy.c http_proxy.h \
|
||||||
|
conf.h main.h
|
||||||
|
|
||||||
|
http_proxy.h:
|
||||||
|
|
||||||
|
conf.h:
|
||||||
|
|
||||||
|
main.h:
|
BIN
obj/local/arm64-v8a/objs/CProxy/http_request.o
Executable file
BIN
obj/local/arm64-v8a/objs/CProxy/http_request.o
Executable file
Binary file not shown.
10
obj/local/arm64-v8a/objs/CProxy/http_request.o.d
Executable file
10
obj/local/arm64-v8a/objs/CProxy/http_request.o.d
Executable file
@ -0,0 +1,10 @@
|
|||||||
|
./obj/local/arm64-v8a/objs/CProxy/http_request.o: http_request.c \
|
||||||
|
http_request.h http_proxy.h conf.h main.h
|
||||||
|
|
||||||
|
http_request.h:
|
||||||
|
|
||||||
|
http_proxy.h:
|
||||||
|
|
||||||
|
conf.h:
|
||||||
|
|
||||||
|
main.h:
|
BIN
obj/local/arm64-v8a/objs/CProxy/httpdns.o
Executable file
BIN
obj/local/arm64-v8a/objs/CProxy/httpdns.o
Executable file
Binary file not shown.
12
obj/local/arm64-v8a/objs/CProxy/httpdns.o.d
Executable file
12
obj/local/arm64-v8a/objs/CProxy/httpdns.o.d
Executable file
@ -0,0 +1,12 @@
|
|||||||
|
./obj/local/arm64-v8a/objs/CProxy/httpdns.o: httpdns.c httpdns.h main.h \
|
||||||
|
http_request.h http_proxy.h conf.h
|
||||||
|
|
||||||
|
httpdns.h:
|
||||||
|
|
||||||
|
main.h:
|
||||||
|
|
||||||
|
http_request.h:
|
||||||
|
|
||||||
|
http_proxy.h:
|
||||||
|
|
||||||
|
conf.h:
|
BIN
obj/local/arm64-v8a/objs/CProxy/httpudp.o
Executable file
BIN
obj/local/arm64-v8a/objs/CProxy/httpudp.o
Executable file
Binary file not shown.
12
obj/local/arm64-v8a/objs/CProxy/httpudp.o.d
Executable file
12
obj/local/arm64-v8a/objs/CProxy/httpudp.o.d
Executable file
@ -0,0 +1,12 @@
|
|||||||
|
./obj/local/arm64-v8a/objs/CProxy/httpudp.o: httpudp.c http_request.h \
|
||||||
|
http_proxy.h conf.h main.h httpudp.h
|
||||||
|
|
||||||
|
http_request.h:
|
||||||
|
|
||||||
|
http_proxy.h:
|
||||||
|
|
||||||
|
conf.h:
|
||||||
|
|
||||||
|
main.h:
|
||||||
|
|
||||||
|
httpudp.h:
|
BIN
obj/local/arm64-v8a/objs/CProxy/main.o
Executable file
BIN
obj/local/arm64-v8a/objs/CProxy/main.o
Executable file
Binary file not shown.
16
obj/local/arm64-v8a/objs/CProxy/main.o.d
Executable file
16
obj/local/arm64-v8a/objs/CProxy/main.o.d
Executable file
@ -0,0 +1,16 @@
|
|||||||
|
./obj/local/arm64-v8a/objs/CProxy/main.o: main.c main.h http_proxy.h \
|
||||||
|
conf.h http_request.h httpdns.h httpudp.h help.h
|
||||||
|
|
||||||
|
main.h:
|
||||||
|
|
||||||
|
http_proxy.h:
|
||||||
|
|
||||||
|
conf.h:
|
||||||
|
|
||||||
|
http_request.h:
|
||||||
|
|
||||||
|
httpdns.h:
|
||||||
|
|
||||||
|
httpudp.h:
|
||||||
|
|
||||||
|
help.h:
|
BIN
obj/local/armeabi-v7a/CProxy
Executable file
BIN
obj/local/armeabi-v7a/CProxy
Executable file
Binary file not shown.
BIN
obj/local/armeabi-v7a/objs/CProxy/conf.o
Executable file
BIN
obj/local/armeabi-v7a/objs/CProxy/conf.o
Executable file
Binary file not shown.
3
obj/local/armeabi-v7a/objs/CProxy/conf.o.d
Executable file
3
obj/local/armeabi-v7a/objs/CProxy/conf.o.d
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
./obj/local/armeabi-v7a/objs/CProxy/conf.o: conf.c conf.h
|
||||||
|
|
||||||
|
conf.h:
|
BIN
obj/local/armeabi-v7a/objs/CProxy/help.o
Executable file
BIN
obj/local/armeabi-v7a/objs/CProxy/help.o
Executable file
Binary file not shown.
3
obj/local/armeabi-v7a/objs/CProxy/help.o.d
Executable file
3
obj/local/armeabi-v7a/objs/CProxy/help.o.d
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
./obj/local/armeabi-v7a/objs/CProxy/help.o: help.c help.h
|
||||||
|
|
||||||
|
help.h:
|
BIN
obj/local/armeabi-v7a/objs/CProxy/http_proxy.o
Executable file
BIN
obj/local/armeabi-v7a/objs/CProxy/http_proxy.o
Executable file
Binary file not shown.
8
obj/local/armeabi-v7a/objs/CProxy/http_proxy.o.d
Executable file
8
obj/local/armeabi-v7a/objs/CProxy/http_proxy.o.d
Executable file
@ -0,0 +1,8 @@
|
|||||||
|
./obj/local/armeabi-v7a/objs/CProxy/http_proxy.o: http_proxy.c \
|
||||||
|
http_proxy.h conf.h main.h
|
||||||
|
|
||||||
|
http_proxy.h:
|
||||||
|
|
||||||
|
conf.h:
|
||||||
|
|
||||||
|
main.h:
|
BIN
obj/local/armeabi-v7a/objs/CProxy/http_request.o
Executable file
BIN
obj/local/armeabi-v7a/objs/CProxy/http_request.o
Executable file
Binary file not shown.
10
obj/local/armeabi-v7a/objs/CProxy/http_request.o.d
Executable file
10
obj/local/armeabi-v7a/objs/CProxy/http_request.o.d
Executable file
@ -0,0 +1,10 @@
|
|||||||
|
./obj/local/armeabi-v7a/objs/CProxy/http_request.o: http_request.c \
|
||||||
|
http_request.h http_proxy.h conf.h main.h
|
||||||
|
|
||||||
|
http_request.h:
|
||||||
|
|
||||||
|
http_proxy.h:
|
||||||
|
|
||||||
|
conf.h:
|
||||||
|
|
||||||
|
main.h:
|
BIN
obj/local/armeabi-v7a/objs/CProxy/httpdns.o
Executable file
BIN
obj/local/armeabi-v7a/objs/CProxy/httpdns.o
Executable file
Binary file not shown.
12
obj/local/armeabi-v7a/objs/CProxy/httpdns.o.d
Executable file
12
obj/local/armeabi-v7a/objs/CProxy/httpdns.o.d
Executable file
@ -0,0 +1,12 @@
|
|||||||
|
./obj/local/armeabi-v7a/objs/CProxy/httpdns.o: httpdns.c httpdns.h main.h \
|
||||||
|
http_request.h http_proxy.h conf.h
|
||||||
|
|
||||||
|
httpdns.h:
|
||||||
|
|
||||||
|
main.h:
|
||||||
|
|
||||||
|
http_request.h:
|
||||||
|
|
||||||
|
http_proxy.h:
|
||||||
|
|
||||||
|
conf.h:
|
BIN
obj/local/armeabi-v7a/objs/CProxy/httpudp.o
Executable file
BIN
obj/local/armeabi-v7a/objs/CProxy/httpudp.o
Executable file
Binary file not shown.
12
obj/local/armeabi-v7a/objs/CProxy/httpudp.o.d
Executable file
12
obj/local/armeabi-v7a/objs/CProxy/httpudp.o.d
Executable file
@ -0,0 +1,12 @@
|
|||||||
|
./obj/local/armeabi-v7a/objs/CProxy/httpudp.o: httpudp.c http_request.h \
|
||||||
|
http_proxy.h conf.h main.h httpudp.h
|
||||||
|
|
||||||
|
http_request.h:
|
||||||
|
|
||||||
|
http_proxy.h:
|
||||||
|
|
||||||
|
conf.h:
|
||||||
|
|
||||||
|
main.h:
|
||||||
|
|
||||||
|
httpudp.h:
|
BIN
obj/local/armeabi-v7a/objs/CProxy/main.o
Executable file
BIN
obj/local/armeabi-v7a/objs/CProxy/main.o
Executable file
Binary file not shown.
16
obj/local/armeabi-v7a/objs/CProxy/main.o.d
Executable file
16
obj/local/armeabi-v7a/objs/CProxy/main.o.d
Executable file
@ -0,0 +1,16 @@
|
|||||||
|
./obj/local/armeabi-v7a/objs/CProxy/main.o: main.c main.h http_proxy.h \
|
||||||
|
conf.h http_request.h httpdns.h httpudp.h help.h
|
||||||
|
|
||||||
|
main.h:
|
||||||
|
|
||||||
|
http_proxy.h:
|
||||||
|
|
||||||
|
conf.h:
|
||||||
|
|
||||||
|
http_request.h:
|
||||||
|
|
||||||
|
httpdns.h:
|
||||||
|
|
||||||
|
httpudp.h:
|
||||||
|
|
||||||
|
help.h:
|
Loading…
Reference in New Issue
Block a user