From 4ae45cb20b0509ea82625ccaec77cc6e70b150c7 Mon Sep 17 00:00:00 2001 From: Brent Cook Date: Fri, 12 Oct 2018 02:12:30 -0500 Subject: [PATCH] comment around why we do this, make check more explicit --- lib/msf/core/exploit/tcp.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/msf/core/exploit/tcp.rb b/lib/msf/core/exploit/tcp.rb index e414c58c98..3acc41e62c 100644 --- a/lib/msf/core/exploit/tcp.rb +++ b/lib/msf/core/exploit/tcp.rb @@ -194,9 +194,13 @@ module Exploit::Remote::Tcp super disconnect end - + def print_prefix - if rhost && rhost.split(' ').length < 2 + # Only inject a host/port prefix if we have exactly one entry. + # Otherwise we are logging in the global context where rhost can be any + # size (being an alias for rhosts), which is not very useful to insert into + # a single log line. + if rhost && rhost.split(' ').length == 1 super + peer + ' - ' else super