Skip to content

Instantly share code, notes, and snippets.

@zbuc
Last active August 29, 2015 14:07
Show Gist options
  • Save zbuc/862e481d4dde2faa2e25 to your computer and use it in GitHub Desktop.
Save zbuc/862e481d4dde2faa2e25 to your computer and use it in GitHub Desktop.
dsniff csin patch
--- sshmitm.c.orig 2014-10-20 11:45:13.000000000 -0400
+++ sshmitm.c 2014-10-20 11:45:41.000000000 -0400
@@ -41,7 +41,7 @@
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 @@
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 @@
}
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 @@
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 @@
}
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) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment