Remove -vv, restore -v and add -ci
parent
69d9ff7958
commit
7b4f3f8148
|
@ -524,20 +524,18 @@ class ReadableText
|
||||||
def self.dump_sessions(framework, opts={})
|
def self.dump_sessions(framework, opts={})
|
||||||
ids = (opts[:session_ids] || framework.sessions.keys).sort
|
ids = (opts[:session_ids] || framework.sessions.keys).sort
|
||||||
verbose = opts[:verbose] || false
|
verbose = opts[:verbose] || false
|
||||||
extended = opts[:extended] || false
|
show_checkin = opts[:show_checkin] || false
|
||||||
indent = opts[:indent] || DefaultIndent
|
indent = opts[:indent] || DefaultIndent
|
||||||
col = opts[:col] || DefaultColumnWrap
|
col = opts[:col] || DefaultColumnWrap
|
||||||
|
|
||||||
return dump_sessions_verbose(framework, opts) if verbose
|
return dump_sessions_verbose(framework, opts) if verbose
|
||||||
|
|
||||||
columns =
|
columns = []
|
||||||
[
|
columns << 'Id'
|
||||||
'Id',
|
columns << 'Type'
|
||||||
'Type',
|
columns << 'Checkin?' if show_checkin
|
||||||
'Information',
|
columns << 'Information'
|
||||||
'Connection'
|
columns << 'Connection'
|
||||||
]
|
|
||||||
columns << 'Checkin?' if extended
|
|
||||||
|
|
||||||
tbl = Rex::Ui::Text::Table.new(
|
tbl = Rex::Ui::Text::Table.new(
|
||||||
'Indent' => indent,
|
'Indent' => indent,
|
||||||
|
@ -553,12 +551,12 @@ class ReadableText
|
||||||
sinfo = sinfo[0,77] + "..."
|
sinfo = sinfo[0,77] + "..."
|
||||||
end
|
end
|
||||||
|
|
||||||
row = [ session.sid.to_s, session.type.to_s, sinfo, session.tunnel_to_s + " (#{session.session_host})" ]
|
row = []
|
||||||
if session.respond_to?(:platform)
|
row << session.sid.to_s
|
||||||
row[1] << (" " + session.platform)
|
row << session.type.to_s
|
||||||
end
|
row[-1] << (" " + session.platform) if session.respond_to?(:platform)
|
||||||
|
|
||||||
if extended
|
if show_checkin
|
||||||
if session.respond_to?(:last_checkin) && session.last_checkin
|
if session.respond_to?(:last_checkin) && session.last_checkin
|
||||||
row << "#{(Time.now.to_i - session.last_checkin.to_i)}s ago"
|
row << "#{(Time.now.to_i - session.last_checkin.to_i)}s ago"
|
||||||
else
|
else
|
||||||
|
@ -566,6 +564,9 @@ class ReadableText
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
row << sinfo
|
||||||
|
row << session.tunnel_to_s + " (#{session.session_host})"
|
||||||
|
|
||||||
tbl << row
|
tbl << row
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,11 +35,11 @@ class Core
|
||||||
# Session command options
|
# Session command options
|
||||||
@@sessions_opts = Rex::Parser::Arguments.new(
|
@@sessions_opts = Rex::Parser::Arguments.new(
|
||||||
"-c" => [ true, "Run a command on the session given with -i, or all" ],
|
"-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" ],
|
"-h" => [ false, "Help banner" ],
|
||||||
"-i" => [ true, "Interact with the supplied session ID " ],
|
"-i" => [ true, "Interact with the supplied session ID " ],
|
||||||
"-l" => [ false, "List all active sessions" ],
|
"-l" => [ false, "List all active sessions" ],
|
||||||
"-v" => [ false, "List extended fields" ],
|
"-v" => [ false, "List sessions in verbose mode" ],
|
||||||
"-vv" => [ false, "Render in verbose mode" ],
|
|
||||||
"-q" => [ false, "Quiet mode" ],
|
"-q" => [ false, "Quiet mode" ],
|
||||||
"-k" => [ true, "Terminate sessions by session ID and/or range" ],
|
"-k" => [ true, "Terminate sessions by session ID and/or range" ],
|
||||||
"-K" => [ false, "Terminate all sessions" ],
|
"-K" => [ false, "Terminate all sessions" ],
|
||||||
|
@ -1760,7 +1760,7 @@ class Core
|
||||||
begin
|
begin
|
||||||
method = nil
|
method = nil
|
||||||
quiet = false
|
quiet = false
|
||||||
extended = false
|
show_checkin = false
|
||||||
verbose = false
|
verbose = false
|
||||||
sid = nil
|
sid = nil
|
||||||
cmds = []
|
cmds = []
|
||||||
|
@ -1781,9 +1781,9 @@ class Core
|
||||||
when "-c"
|
when "-c"
|
||||||
method = 'cmd'
|
method = 'cmd'
|
||||||
cmds << val if val
|
cmds << val if val
|
||||||
|
when "-ci"
|
||||||
|
show_checkin = true
|
||||||
when "-v"
|
when "-v"
|
||||||
extended = true
|
|
||||||
when "-vv"
|
|
||||||
verbose = true
|
verbose = true
|
||||||
# Do something with the supplied session identifier instead of
|
# Do something with the supplied session identifier instead of
|
||||||
# all sessions.
|
# all sessions.
|
||||||
|
@ -2045,7 +2045,7 @@ class Core
|
||||||
end
|
end
|
||||||
when 'list',nil
|
when 'list',nil
|
||||||
print_line
|
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
|
print_line
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue