From 5547890002a8cbce20b433949dfa96267e5801a4 Mon Sep 17 00:00:00 2001 From: William Vu Date: Tue, 28 Oct 2014 03:07:46 -0500 Subject: [PATCH] Add support for sessions -d ranges --- lib/msf/ui/console/command_dispatcher/core.rb | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/msf/ui/console/command_dispatcher/core.rb b/lib/msf/ui/console/command_dispatcher/core.rb index 9fcb469f04..32d349f2f8 100644 --- a/lib/msf/ui/console/command_dispatcher/core.rb +++ b/lib/msf/ui/console/command_dispatcher/core.rb @@ -1733,13 +1733,16 @@ class Core end when 'detach' - if ((session = framework.sessions.get(sid))) - print_status("Detaching session #{sid}") - if (session.interactive?) - session.detach() + session_list = build_sessions_array(sid) + print_status("Detaching the following session(s): #{session_list.join(', ')}") + session_list.each do |sess| + session = framework.sessions.get(sess) + if session + print_status("Detaching session #{sess}") + session.detach + else + print_error("Invalid session identifier: #{sess}") end - else - print_error("Invalid session identifier: #{sid}") end when 'interact'