Skip to content

Commit 4274b76

Browse files
committed
Land rapid7#9119, Fix rapid7#8436, allow session upgrading on meterpreter sessions
2 parents a293093 + ca4feb5 commit 4274b76

File tree

2 files changed

+3
-13
lines changed

2 files changed

+3
-13
lines changed

lib/msf/ui/console/command_dispatcher/core.rb

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1443,14 +1443,9 @@ def cmd_sessions(*args)
14431443
session.response_timeout = response_timeout
14441444
end
14451445
begin
1446-
if ['shell', 'powershell'].include?(session.type)
1447-
session.init_ui(driver.input, driver.output)
1448-
session.execute_script('post/multi/manage/shell_to_meterpreter')
1449-
session.reset_ui
1450-
else
1451-
print_error("Session #{sess_id} is not a command shell session, it is #{session.type}, skipping...")
1452-
next
1453-
end
1446+
session.init_ui(driver.input, driver.output)
1447+
session.execute_script('post/multi/manage/shell_to_meterpreter')
1448+
session.reset_ui
14541449
ensure
14551450
if session.respond_to?(:response_timeout) && last_known_timeout
14561451
session.response_timeout = last_known_timeout

modules/post/multi/manage/shell_to_meterpreter.rb

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,6 @@ def initialize(info = {})
5252
def run
5353
print_status("Upgrading session ID: #{datastore['SESSION']}")
5454

55-
if session.type =~ /meterpreter/
56-
print_error("Shell is already Meterpreter.")
57-
return nil
58-
end
59-
6055
# Try hard to find a valid LHOST value in order to
6156
# make running 'sessions -u' as robust as possible.
6257
if datastore['LHOST']

0 commit comments

Comments
 (0)