Remove -vv, restore -v and add -ci

bug/bundler_fix
OJ 2016-01-29 11:52:21 +10:00
parent 69d9ff7958
commit 7b4f3f8148
2 changed files with 21 additions and 20 deletions

View File

@ -524,20 +524,18 @@ class ReadableText
def self.dump_sessions(framework, opts={})
ids = (opts[:session_ids] || framework.sessions.keys).sort
verbose = opts[:verbose] || false
extended = opts[:extended] || false
show_checkin = opts[:show_checkin] || false
indent = opts[:indent] || DefaultIndent
col = opts[:col] || DefaultColumnWrap
return dump_sessions_verbose(framework, opts) if verbose
columns =
[
'Id',
'Type',
'Information',
'Connection'
]
columns << 'Checkin?' if extended
columns = []
columns << 'Id'
columns << 'Type'
columns << 'Checkin?' if show_checkin
columns << 'Information'
columns << 'Connection'
tbl = Rex::Ui::Text::Table.new(
'Indent' => indent,
@ -553,12 +551,12 @@ class ReadableText
sinfo = sinfo[0,77] + "..."
end
row = [ session.sid.to_s, session.type.to_s, sinfo, session.tunnel_to_s + " (#{session.session_host})" ]
if session.respond_to?(:platform)
row[1] << (" " + session.platform)
end
row = []
row << session.sid.to_s
row << session.type.to_s
row[-1] << (" " + session.platform) if session.respond_to?(:platform)
if extended
if show_checkin
if session.respond_to?(:last_checkin) && session.last_checkin
row << "#{(Time.now.to_i - session.last_checkin.to_i)}s ago"
else
@ -566,6 +564,9 @@ class ReadableText
end
end
row << sinfo
row << session.tunnel_to_s + " (#{session.session_host})"
tbl << row
}

View File

@ -35,11 +35,11 @@ class Core
# Session command options
@@sessions_opts = Rex::Parser::Arguments.new(
"-c" => [ true, "Run a command on the session given with -i, or all" ],
"-ci" => [ false, "Show the last checkin time in the session table" ],
"-h" => [ false, "Help banner" ],
"-i" => [ true, "Interact with the supplied session ID " ],
"-l" => [ false, "List all active sessions" ],
"-v" => [ false, "List extended fields" ],
"-vv" => [ false, "Render in verbose mode" ],
"-v" => [ false, "List sessions in verbose mode" ],
"-q" => [ false, "Quiet mode" ],
"-k" => [ true, "Terminate sessions by session ID and/or range" ],
"-K" => [ false, "Terminate all sessions" ],
@ -1760,7 +1760,7 @@ class Core
begin
method = nil
quiet = false
extended = false
show_checkin = false
verbose = false
sid = nil
cmds = []
@ -1781,9 +1781,9 @@ class Core
when "-c"
method = 'cmd'
cmds << val if val
when "-ci"
show_checkin = true
when "-v"
extended = true
when "-vv"
verbose = true
# Do something with the supplied session identifier instead of
# all sessions.
@ -2045,7 +2045,7 @@ class Core
end
when 'list',nil
print_line
print(Serializer::ReadableText.dump_sessions(framework, :extended => extended, :verbose => verbose))
print(Serializer::ReadableText.dump_sessions(framework, :show_checkin => show_checkin, :verbose => verbose))
print_line
end