Skip to content

Commit 5547890

Browse files
committed
Add support for sessions -d ranges
1 parent 36c85b7 commit 5547890

File tree

1 file changed

+9
-6
lines changed
  • lib/msf/ui/console/command_dispatcher

1 file changed

+9
-6
lines changed

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

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1733,13 +1733,16 @@ def cmd_sessions(*args)
17331733
end
17341734

17351735
when 'detach'
1736-
if ((session = framework.sessions.get(sid)))
1737-
print_status("Detaching session #{sid}")
1738-
if (session.interactive?)
1739-
session.detach()
1736+
session_list = build_sessions_array(sid)
1737+
print_status("Detaching the following session(s): #{session_list.join(', ')}")
1738+
session_list.each do |sess|
1739+
session = framework.sessions.get(sess)
1740+
if session
1741+
print_status("Detaching session #{sess}")
1742+
session.detach
1743+
else
1744+
print_error("Invalid session identifier: #{sess}")
17401745
end
1741-
else
1742-
print_error("Invalid session identifier: #{sid}")
17431746
end
17441747

17451748
when 'interact'

0 commit comments

Comments
 (0)