Code tidying and defaulting to empty strings for table format

bug/bundler_fix
OJ 2014-03-19 16:19:23 +10:00
parent 959cedb9b1
commit 84728c9fc9
1 changed files with 20 additions and 12 deletions

View File

@ -180,7 +180,9 @@ class Console::CommandDispatcher::Kiwi
return true return true
end end
# default to not exporting
export = false export = false
# default to the current folder for dumping tickets
export_path = "." export_path = "."
@@kerberos_ticket_list_opts.parse(args) { |opt, idx, val| @@kerberos_ticket_list_opts.parse(args) { |opt, idx, val|
@ -215,6 +217,7 @@ class Console::CommandDispatcher::Kiwi
"#{t[:flags].to_s(16).rjust(8, '0')} (#{flag_list})" "#{t[:flags].to_s(16).rjust(8, '0')} (#{flag_list})"
] ]
# write out each ticket to disk if export is enabled.
if export if export
path = "<no data retrieved>" path = "<no data retrieved>"
if t[:raw] if t[:raw]
@ -244,6 +247,8 @@ class Console::CommandDispatcher::Kiwi
def cmd_kerberos_ticket_purge(*args) def cmd_kerberos_ticket_purge(*args)
client.kiwi.keberos_ticket_purge client.kiwi.keberos_ticket_purge
print_good("Kerberos tickets purged") print_good("Kerberos tickets purged")
return true
end end
# #
@ -260,9 +265,12 @@ class Console::CommandDispatcher::Kiwi
::File.open(target, 'rb') do |f| ::File.open(target, 'rb') do |f|
ticket += f.read(f.stat.size) ticket += f.read(f.stat.size)
end end
print_status("Using Kerberos ticket stored in #{target}, #{ticket.length} bytes") print_status("Using Kerberos ticket stored in #{target}, #{ticket.length} bytes")
client.kiwi.kerberos_ticket_use(ticket) client.kiwi.kerberos_ticket_use(ticket)
print_good("Kerberos ticket applied successfully") print_good("Kerberos ticket applied successfully")
return true
end end
# #
@ -362,7 +370,7 @@ protected
table = Rex::Ui::Text::Table.new( table = Rex::Ui::Text::Table.new(
'Header' => "#{provider} credentials", 'Header' => "#{provider} credentials",
'Indent' => 0, 'Indent' => 0,
'SortIndex' => 4, 'SortIndex' => 0,
'Columns' => 'Columns' =>
[ [
'Domain', 'User', 'Password', 'Auth Id', 'LM Hash', 'NTLM Hash' 'Domain', 'User', 'Password', 'Auth Id', 'LM Hash', 'NTLM Hash'
@ -371,12 +379,12 @@ protected
accounts.each do |acc| accounts.each do |acc|
table << [ table << [
acc[:domain], acc[:domain] || "",
acc[:username], acc[:username] || "",
acc[:password], acc[:password] || "",
"#{acc[:auth_hi]} ; #{acc[:auth_lo]}", "#{acc[:auth_hi]} ; #{acc[:auth_lo]}",
acc[:lm], acc[:lm] || "",
acc[:ntlm] acc[:ntlm] || ""
] ]
end end