Lines 1-26
Link Here
|
1 |
--- ./webmitm.c.orig 2001-03-17 09:35:05.000000000 +0100 |
1 |
--- webmitm.c.orig 2019-05-13 13:40:23 UTC |
2 |
+++ ./webmitm.c 2014-07-22 13:20:14.000000000 +0200 |
2 |
+++ webmitm.c |
3 |
@@ -43,7 +43,7 @@ |
3 |
@@ -43,7 +43,7 @@ int http_fd, https_fd; |
4 |
int client_fd, server_fd; |
4 |
int client_fd, server_fd; |
5 |
SSL_CTX *ssl_client_ctx, *ssl_server_ctx; |
5 |
SSL_CTX *ssl_client_ctx, *ssl_server_ctx; |
6 |
SSL *ssl_client, *ssl_server; |
6 |
SSL *ssl_client, *ssl_server; |
7 |
-struct sockaddr_in csin, ssin; |
7 |
-struct sockaddr_in csin, ssin; |
8 |
+struct sockaddr_in ________csin, ssin; |
8 |
+struct sockaddr_in _________csin, ssin; |
9 |
int do_ssl, sig_pipe[2]; |
9 |
int do_ssl, sig_pipe[2]; |
10 |
in_addr_t static_host = 0; |
10 |
in_addr_t static_host = 0; |
11 |
|
11 |
|
12 |
@@ -101,8 +101,8 @@ |
12 |
@@ -101,8 +101,8 @@ grep_passwords(char *buf, int len) |
13 |
char obuf[1024]; |
13 |
char obuf[1024]; |
14 |
|
14 |
|
15 |
if ((len = decode_http(buf, len, obuf, sizeof(obuf))) > 0) { |
15 |
if ((len = decode_http(buf, len, obuf, sizeof(obuf))) > 0) { |
16 |
- record(csin.sin_addr.s_addr, ssin.sin_addr.s_addr, |
16 |
- record(csin.sin_addr.s_addr, ssin.sin_addr.s_addr, |
17 |
- IPPROTO_TCP, ntohs(csin.sin_port), ntohs(ssin.sin_port), |
17 |
- IPPROTO_TCP, ntohs(csin.sin_port), ntohs(ssin.sin_port), |
18 |
+ record(________csin.sin_addr.s_addr, ssin.sin_addr.s_addr, |
18 |
+ record(_________csin.sin_addr.s_addr, ssin.sin_addr.s_addr, |
19 |
+ IPPROTO_TCP, ntohs(________csin.sin_port), ntohs(ssin.sin_port), |
19 |
+ IPPROTO_TCP, ntohs(_________csin.sin_port), ntohs(ssin.sin_port), |
20 |
"http", obuf, len); |
20 |
"http", obuf, len); |
21 |
} |
21 |
} |
22 |
} |
22 |
} |
23 |
@@ -242,7 +242,7 @@ |
23 |
@@ -242,7 +242,7 @@ server_init(char *buf, int size) |
24 |
word = buf_tok(&msg, "/", 1); |
24 |
word = buf_tok(&msg, "/", 1); |
25 |
vhost = buf_strdup(word); |
25 |
vhost = buf_strdup(word); |
26 |
} |
26 |
} |
Lines 29-85
Link Here
|
29 |
free(vhost); |
29 |
free(vhost); |
30 |
|
30 |
|
31 |
if (ssin.sin_addr.s_addr == ntohl(INADDR_LOOPBACK) || |
31 |
if (ssin.sin_addr.s_addr == ntohl(INADDR_LOOPBACK) || |
32 |
@@ -355,7 +355,7 @@ |
32 |
@@ -355,7 +355,7 @@ mitm_child(void) |
33 |
|
33 |
|
34 |
if (Opt_debug) |
34 |
if (Opt_debug) |
35 |
warnx("new connection from %s.%d", |
35 |
warnx("new connection from %s.%d", |
36 |
- inet_ntoa(csin.sin_addr), ntohs(csin.sin_port)); |
36 |
- inet_ntoa(csin.sin_addr), ntohs(csin.sin_port)); |
37 |
+ inet_ntoa(________csin.sin_addr), ntohs(________csin.sin_port)); |
37 |
+ inet_ntoa(_________csin.sin_addr), ntohs(_________csin.sin_port)); |
38 |
|
38 |
|
39 |
client_init(); |
39 |
client_init(); |
40 |
|
40 |
|
41 |
@@ -363,7 +363,7 @@ |
41 |
@@ -363,7 +363,7 @@ mitm_child(void) |
42 |
err(1, "client_request"); |
42 |
err(1, "client_request"); |
43 |
|
43 |
|
44 |
if (Opt_debug) |
44 |
if (Opt_debug) |
45 |
- warnx("%d bytes from %s", i, inet_ntoa(csin.sin_addr)); |
45 |
- warnx("%d bytes from %s", i, inet_ntoa(csin.sin_addr)); |
46 |
+ warnx("%d bytes from %s", i, inet_ntoa(________csin.sin_addr)); |
46 |
+ warnx("%d bytes from %s", i, inet_ntoa(_________csin.sin_addr)); |
47 |
|
47 |
|
48 |
if (Opt_debug > 1) |
48 |
if (Opt_debug > 1) |
49 |
write(STDERR_FILENO, buf, i); |
49 |
write(STDERR_FILENO, buf, i); |
50 |
@@ -393,7 +393,7 @@ |
50 |
@@ -393,7 +393,7 @@ mitm_child(void) |
51 |
|
51 |
|
52 |
if (Opt_debug) |
52 |
if (Opt_debug) |
53 |
warnx("%d bytes from %s", |
53 |
warnx("%d bytes from %s", |
54 |
- i, inet_ntoa(csin.sin_addr)); |
54 |
- i, inet_ntoa(csin.sin_addr)); |
55 |
+ i, inet_ntoa(________csin.sin_addr)); |
55 |
+ i, inet_ntoa(_________csin.sin_addr)); |
56 |
|
56 |
|
57 |
if (Opt_debug > 1) |
57 |
if (Opt_debug > 1) |
58 |
write(STDERR_FILENO, buf, i); |
58 |
write(STDERR_FILENO, buf, i); |
59 |
@@ -456,7 +456,7 @@ |
59 |
@@ -456,7 +456,7 @@ mitm_run(void) |
60 |
if (errno != EINTR) |
60 |
if (errno != EINTR) |
61 |
err(1, "select"); |
61 |
err(1, "select"); |
62 |
} |
62 |
} |
63 |
- i = sizeof(csin); |
63 |
- i = sizeof(csin); |
64 |
+ i = sizeof(________csin); |
64 |
+ i = sizeof(_________csin); |
65 |
|
65 |
|
66 |
if (FD_ISSET(sig_pipe[0], &fds)) { |
66 |
if (FD_ISSET(sig_pipe[0], &fds)) { |
67 |
while (read(sig_pipe[0], &i, 1) == 1) |
67 |
while (read(sig_pipe[0], &i, 1) == 1) |
68 |
@@ -466,11 +466,11 @@ |
68 |
@@ -466,11 +466,11 @@ mitm_run(void) |
69 |
continue; |
69 |
continue; |
70 |
} |
70 |
} |
71 |
if (FD_ISSET(http_fd, &fds)) { |
71 |
if (FD_ISSET(http_fd, &fds)) { |
72 |
- client_fd = accept(http_fd, (struct sockaddr *)&csin, &i); |
72 |
- client_fd = accept(http_fd, (struct sockaddr *)&csin, &i); |
73 |
+ client_fd = accept(http_fd, (struct sockaddr *)&________csin, &i); |
73 |
+ client_fd = accept(http_fd, (struct sockaddr *)&_________csin, &i); |
74 |
do_ssl = 0; |
74 |
do_ssl = 0; |
75 |
} |
75 |
} |
76 |
else if (FD_ISSET(https_fd, &fds)) { |
76 |
else if (FD_ISSET(https_fd, &fds)) { |
77 |
- client_fd = accept(https_fd, (struct sockaddr *)&csin, &i); |
77 |
- client_fd = accept(https_fd, (struct sockaddr *)&csin, &i); |
78 |
+ client_fd = accept(https_fd, (struct sockaddr *)&________csin, &i); |
78 |
+ client_fd = accept(https_fd, (struct sockaddr *)&_________csin, &i); |
79 |
do_ssl = 1; |
79 |
do_ssl = 1; |
80 |
} |
80 |
} |
81 |
else errx(1, "select failure"); |
81 |
else errx(1, "select failure"); |
82 |
@@ -510,7 +510,7 @@ |
82 |
@@ -510,7 +510,7 @@ main(int argc, char *argv[]) |
83 |
argv += optind; |
83 |
argv += optind; |
84 |
|
84 |
|
85 |
if (argc == 1) { |
85 |
if (argc == 1) { |