Skip to content

Commit c3090a4

Browse files
author
Brent Cook
committed
Land rapid7#8601, make session logging more useful, don't lose characters
2 parents fdd62ab + 03b3675 commit c3090a4

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

lib/msf/core/session.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,9 @@ def log_file_name
214214

215215
dstr = sprintf("%.4d%.2d%.2d", dt.year, dt.mon, dt.mday)
216216
rhost = session_host.gsub(':', '_')
217+
sname = name.to_s.gsub(/\W+/,'_')
217218

218-
"#{dstr}_#{rhost}_#{type}"
219+
"#{dstr}_#{sname}_#{rhost}_#{type}"
219220
end
220221

221222
#

lib/rex/logging/sinks/timestamp_flatfile.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class TimestampFlatfile < Flatfile
1313

1414
def log(sev, src, level, msg, from) # :nodoc:
1515
return unless msg.present?
16-
msg = msg.chop.gsub(/\x1b\[[0-9;]*[mG]/,'').gsub(/[\x01-\x02]/, " ")
16+
msg = msg.gsub(/\x1b\[[0-9;]*[mG]/,'').gsub(/[\x01-\x02]/, ' ').gsub(/\s+$/,'')
1717
fd.write("[#{get_current_timestamp}] #{msg}\n")
1818
fd.flush
1919
end

0 commit comments

Comments
 (0)