Last active
August 29, 2015 14:07
-
-
Save zbuc/12f5fab428d273ffed94 to your computer and use it in GitHub Desktop.
patch-zbuc.diff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git sshmitm.c sshmitm.c | |
index 60993dd..c570464 100644 | |
--- sshmitm.c | |
+++ sshmitm.c | |
@@ -41,7 +41,7 @@ int mitm_fd; | |
int client_fd, server_fd; | |
SSH_CTX *ssh_client_ctx, *ssh_server_ctx; | |
SSH *ssh_client, *ssh_server; | |
-struct sockaddr_in csin, ssin; | |
+struct sockaddr_in csin_, ssin; | |
int sig_pipe[2]; | |
static void | |
@@ -148,7 +148,7 @@ mitm_child(void) | |
if (Opt_debug) | |
warnx("new connection from %s.%d", | |
- inet_ntoa(csin.sin_addr), ntohs(csin.sin_port)); | |
+ inet_ntoa(csin_.sin_addr), ntohs(csin_.sin_port)); | |
if (fcntl(client_fd, F_SETFL, 0) == -1) | |
err(1, "fcntl"); | |
@@ -237,10 +237,10 @@ mitm_child(void) | |
} | |
else { | |
pass_done = 1; | |
- record(csin.sin_addr.s_addr, | |
+ record(csin_.sin_addr.s_addr, | |
ssin.sin_addr.s_addr, | |
IPPROTO_TCP, | |
- ntohs(csin.sin_port), | |
+ ntohs(csin_.sin_port), | |
ntohs(ssin.sin_port), "ssh", | |
userpass, strlen(userpass)); | |
} | |
@@ -326,7 +326,7 @@ mitm_run(void) | |
if (errno != EINTR) | |
err(1, "select"); | |
} | |
- i = sizeof(csin); | |
+ i = sizeof(csin_); | |
if (FD_ISSET(sig_pipe[0], &fds)) { | |
while (read(sig_pipe[0], buf, 1) == 1) | |
@@ -336,7 +336,7 @@ mitm_run(void) | |
} | |
if (FD_ISSET(mitm_fd, &fds)) { | |
client_fd = accept(mitm_fd, | |
- (struct sockaddr *)&csin, &i); | |
+ (struct sockaddr *)&csin_, &i); | |
if (client_fd >= 0) { | |
if (fork() == 0) { | |
diff --git webmitm.c webmitm.c | |
index 78e9818..ec1de5d 100644 | |
--- webmitm.c | |
+++ webmitm.c | |
@@ -43,7 +43,7 @@ int http_fd, https_fd; | |
int client_fd, server_fd; | |
SSL_CTX *ssl_client_ctx, *ssl_server_ctx; | |
SSL *ssl_client, *ssl_server; | |
-struct sockaddr_in csin, ssin; | |
+struct sockaddr_in csin_, ssin; | |
int do_ssl, sig_pipe[2]; | |
in_addr_t static_host = 0; | |
@@ -101,8 +101,8 @@ grep_passwords(char *buf, int len) | |
char obuf[1024]; | |
if ((len = decode_http(buf, len, obuf, sizeof(obuf))) > 0) { | |
- record(csin.sin_addr.s_addr, ssin.sin_addr.s_addr, | |
- IPPROTO_TCP, ntohs(csin.sin_port), ntohs(ssin.sin_port), | |
+ record(csin_.sin_addr.s_addr, ssin.sin_addr.s_addr, | |
+ IPPROTO_TCP, ntohs(csin_.sin_port), ntohs(ssin.sin_port), | |
"http", obuf, len); | |
} | |
} | |
@@ -355,7 +355,7 @@ mitm_child(void) | |
if (Opt_debug) | |
warnx("new connection from %s.%d", | |
- inet_ntoa(csin.sin_addr), ntohs(csin.sin_port)); | |
+ inet_ntoa(csin_.sin_addr), ntohs(csin_.sin_port)); | |
client_init(); | |
@@ -363,7 +363,7 @@ mitm_child(void) | |
err(1, "client_request"); | |
if (Opt_debug) | |
- warnx("%d bytes from %s", i, inet_ntoa(csin.sin_addr)); | |
+ warnx("%d bytes from %s", i, inet_ntoa(csin_.sin_addr)); | |
if (Opt_debug > 1) | |
write(STDERR_FILENO, buf, i); | |
@@ -393,7 +393,7 @@ mitm_child(void) | |
if (Opt_debug) | |
warnx("%d bytes from %s", | |
- i, inet_ntoa(csin.sin_addr)); | |
+ i, inet_ntoa(csin_.sin_addr)); | |
if (Opt_debug > 1) | |
write(STDERR_FILENO, buf, i); | |
@@ -456,7 +456,7 @@ mitm_run(void) | |
if (errno != EINTR) | |
err(1, "select"); | |
} | |
- i = sizeof(csin); | |
+ i = sizeof(csin_); | |
if (FD_ISSET(sig_pipe[0], &fds)) { | |
while (read(sig_pipe[0], &i, 1) == 1) | |
@@ -466,11 +466,11 @@ mitm_run(void) | |
continue; | |
} | |
if (FD_ISSET(http_fd, &fds)) { | |
- client_fd = accept(http_fd, (struct sockaddr *)&csin, &i); | |
+ client_fd = accept(http_fd, (struct sockaddr *)&csin_, &i); | |
do_ssl = 0; | |
} | |
else if (FD_ISSET(https_fd, &fds)) { | |
- client_fd = accept(https_fd, (struct sockaddr *)&csin, &i); | |
+ client_fd = accept(https_fd, (struct sockaddr *)&csin_, &i); | |
do_ssl = 1; | |
} | |
else errx(1, "select failure"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment