File tree Expand file tree Collapse file tree 2 files changed +18
-12
lines changed
rex/post/meterpreter/ui/console/command_dispatcher Expand file tree Collapse file tree 2 files changed +18
-12
lines changed Original file line number Diff line number Diff line change @@ -319,25 +319,28 @@ def is_valid_session?(timeout=10)
319
319
false
320
320
end
321
321
322
+ def update_session_info
323
+ username = self . sys . config . getuid
324
+ sysinfo = self . sys . config . sysinfo
325
+
326
+ safe_info = "#{ username } @ #{ sysinfo [ 'Computer' ] } "
327
+ safe_info . force_encoding ( "ASCII-8BIT" ) if safe_info . respond_to? ( :force_encoding )
328
+ # Should probably be using Rex::Text.ascii_safe_hex but leave
329
+ # this as is for now since "\xNN" is arguably uglier than "_"
330
+ # showing up in various places in the UI.
331
+ safe_info . gsub! ( /[\x00 -\x08 \x0b \x0c \x0e -\x19 \x7f -\xff ]+/n , "_" )
332
+ self . info = safe_info
333
+ end
334
+
322
335
#
323
336
# Populate the session information.
324
337
#
325
338
# Also reports a session_fingerprint note for host os normalization.
326
339
#
327
- def load_session_info ( )
340
+ def load_session_info
328
341
begin
329
342
::Timeout . timeout ( 60 ) do
330
- # Gather username/system information
331
- username = self . sys . config . getuid
332
- sysinfo = self . sys . config . sysinfo
333
-
334
- safe_info = "#{ username } @ #{ sysinfo [ 'Computer' ] } "
335
- safe_info . force_encoding ( "ASCII-8BIT" ) if safe_info . respond_to? ( :force_encoding )
336
- # Should probably be using Rex::Text.ascii_safe_hex but leave
337
- # this as is for now since "\xNN" is arguably uglier than "_"
338
- # showing up in various places in the UI.
339
- safe_info . gsub! ( /[\x00 -\x08 \x0b \x0c \x0e -\x19 \x7f -\xff ]+/n , "_" )
340
- self . info = safe_info
343
+ update_session_info
341
344
342
345
hobj = nil
343
346
Original file line number Diff line number Diff line change @@ -835,6 +835,9 @@ def cmd_migrate(*args)
835
835
836
836
print_status ( "Migration completed successfully." )
837
837
838
+ # Update session info (we may have a new username)
839
+ client . update_session_info
840
+
838
841
unless existing_relays . empty?
839
842
print_status ( "Recreating TCP relay(s)..." )
840
843
existing_relays . each do |r |
You can’t perform that action at this time.
0 commit comments