mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-09 17:38:00 +00:00
Log outgoing address + port numbers in the Event Log.
This is the payoff from the previous three commits. If you run 'netstat' or 'ss' or equivalent, and see multiple outgoing SSH connections from your machine, and you want to match them up to the instances of PuTTY you can see on your desktop, how would you do it? On Linux you can trace each socket to an owning pid via 'ss -p', but tracing the pid in turn to a window isn't so easy. On Windows even the first step is hard. Now it shouldn't be too hard, because the Event Log mentions the IP address and ephemeral port number of the local end of a connection, after that connection is established, if that information is available. So now you can connect the local port numbers shown in the 'netstat' or 'ss' output with the ones in the GUI's Event Log. (This might be useful if, for example, one connection was showing a backlog in netstat, and you wanted to investigate the corresponding GUI.)
This commit is contained in:
parent
c1d9da67a2
commit
7618e079f5
@ -30,6 +30,16 @@ void backend_socket_log(Seat *seat, LogContext *logctx, Socket *sock,
|
|||||||
else /* fallback if address unavailable */
|
else /* fallback if address unavailable */
|
||||||
sprintf(addrbuf, "remote host");
|
sprintf(addrbuf, "remote host");
|
||||||
msg = dupprintf("Connected to %s", addrbuf);
|
msg = dupprintf("Connected to %s", addrbuf);
|
||||||
|
if (sock) {
|
||||||
|
SocketEndpointInfo *local_end = sk_endpoint_info(sock, false);
|
||||||
|
if (local_end) {
|
||||||
|
char *newmsg = dupprintf("%s (from %s)", msg,
|
||||||
|
local_end->log_text);
|
||||||
|
sfree(msg);
|
||||||
|
msg = newmsg;
|
||||||
|
sk_free_endpoint_info(local_end);
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case PLUGLOG_PROXY_MSG: {
|
case PLUGLOG_PROXY_MSG: {
|
||||||
/* Proxy-related log messages have their own identifying
|
/* Proxy-related log messages have their own identifying
|
||||||
|
Loading…
Reference in New Issue
Block a user