Remove shebang, code tidy, as per @jlee-r7's gripes

bug/bundler_fix
OJ 2013-11-07 07:32:04 +10:00
parent d1e008387a
commit 6422e1d6e8
3 changed files with 83 additions and 84 deletions

View File

@ -57,13 +57,12 @@ class Console::CommandDispatcher::Extapi::Clipboard
download_content = false
@@get_data_opts.parse(args) { |opt, idx, val|
case opt
when "-d"
download_content = true
when "-h"
print_clipboard_get_data_usage
return true
end
}
when "-d"
download_content = true
when "-h"
print_clipboard_get_data_usage
return true
end }
# currently we only support text values
results = client.extapi.clipboard.get_data(download_content)
@ -75,61 +74,61 @@ class Console::CommandDispatcher::Extapi::Clipboard
results.each { |r|
case r[:type]
when :text
print_line
print_line( "Current Clipboard Text" )
print_line( "======================" )
print_line
print_line( r[:data] )
when :text
print_line
print_line( "Current Clipboard Text" )
print_line( "======================" )
print_line
print_line( r[:data] )
when :jpg
print_line
print_line( "Clipboard Image Dimensions: #{r[:width]}x#{r[:height]}" )
when :jpg
print_line
print_line( "Clipboard Image Dimensions: #{r[:width]}x#{r[:height]}" )
if download_content
loot_dir = generate_loot_dir( true )
file = Rex::Text.rand_text_alpha(8) + ".jpg"
path = File.join( loot_dir, file )
path = ::File.expand_path( path )
::File.open( path, 'wb' ) do |f|
f.write r[:data]
end
print_good( "Clipboard image saved to #{path}" )
else
print_line( "Re-run with -d to download image." )
if download_content
loot_dir = generate_loot_dir( true )
file = Rex::Text.rand_text_alpha(8) + ".jpg"
path = File.join( loot_dir, file )
path = ::File.expand_path( path )
::File.open( path, 'wb' ) do |f|
f.write r[:data]
end
print_good( "Clipboard image saved to #{path}" )
else
print_line( "Re-run with -d to download image." )
end
when :files
if download_content
loot_dir = generate_loot_dir( true )
print_line
print_status( "Downloading Clipboard Files ..." )
r[:data].each { |f|
download_file( loot_dir, f[:name] )
}
print_good( "Downloaded #{r[:data].length} file(s)." )
print_line
else
table = Rex::Ui::Text::Table.new(
'Header' => 'Current Clipboard Files',
'Indent' => 0,
'SortIndex' => 0,
'Columns' => [
'File Path', 'Size (bytes)'
]
)
when :files
if download_content
loot_dir = generate_loot_dir( true )
print_line
print_status( "Downloading Clipboard Files ..." )
r[:data].each { |f|
download_file( loot_dir, f[:name] )
}
print_good( "Downloaded #{r[:data].length} file(s)." )
print_line
else
table = Rex::Ui::Text::Table.new(
'Header' => 'Current Clipboard Files',
'Indent' => 0,
'SortIndex' => 0,
'Columns' => [
'File Path', 'Size (bytes)'
]
)
total = 0
r[:data].each { |f|
table << [f[:name], f[:size]]
total += f[:size]
}
total = 0
r[:data].each { |f|
table << [f[:name], f[:size]]
total += f[:size]
}
print_line
print_line(table.to_s)
print_line
print_line(table.to_s)
print_line( "#{r[:data].length} file(s) totalling #{total} bytes" )
end
print_line( "#{r[:data].length} file(s) totalling #{total} bytes" )
end
end
print_line
@ -158,9 +157,9 @@ class Console::CommandDispatcher::Extapi::Clipboard
@@set_text_opts.parse(args) { |opt, idx, val|
case opt
when "-h"
clipboard_set_text_usage
return true
when "-h"
clipboard_set_text_usage
return true
end
}

View File

@ -46,14 +46,14 @@ class Console::CommandDispatcher::Extapi::Service
def cmd_service_enum(*args)
@@service_enum_opts.parse(args) { |opt, idx, val|
case opt
when "-h"
print(
"\nUsage: service_enum [-h]\n\n" +
"Enumerate services installed on the target.\n\n" +
"Enumeration returns the Process ID, Status, and name of each installed\n" +
"service that was enumerated. The 'Int' value indicates if the service is\n" +
"able to interact with the desktop.\n\n")
return true
when "-h"
print(
"\nUsage: service_enum [-h]\n\n" +
"Enumerate services installed on the target.\n\n" +
"Enumeration returns the Process ID, Status, and name of each installed\n" +
"service that was enumerated. The 'Int' value indicates if the service is\n" +
"able to interact with the desktop.\n\n")
return true
end
}
@ -111,13 +111,13 @@ class Console::CommandDispatcher::Extapi::Service
@@service_query_opts.parse(args) { |opt, idx, val|
case opt
when "-h"
print(
"\nUsage: service_query [-h] <servicename>\n" +
" <servicename>: The name of the service to query.\n\n" +
"Gets details information about a particular Windows service, including\n" +
"binary path, DACL, load order group, start type and more.\n\n")
return true
when "-h"
print(
"\nUsage: service_query [-h] <servicename>\n" +
" <servicename>: The name of the service to query.\n\n" +
"Gets details information about a particular Windows service, including\n" +
"binary path, DACL, load order group, start type and more.\n\n")
return true
end
}

View File

@ -48,7 +48,7 @@ class Console::CommandDispatcher::Extapi::Window
"Enumerate the windows on the target.\n\n" +
"Enumeration returns the Process ID and Window Handle for each window\n" +
"found. The Window Handle can be used for further calls to window_enum\n" +
"or the the railgun API.\n" +
"or the railgun API.\n" +
@@window_enum_opts.usage +
"Note: Not all windows can be enumerated. An attempt to enumerate\n" +
" the children of such a window will result in a failure with the\n"+
@ -64,23 +64,23 @@ class Console::CommandDispatcher::Extapi::Window
@@window_enum_opts.parse(args) { |opt, idx, val|
case opt
when "-u"
include_unknown = true
when "-p"
parent_window = val.to_i
if parent_window == 0
window_enum_usage
return true
end
when "-h"
when "-u"
include_unknown = true
when "-p"
parent_window = val.to_i
if parent_window == 0
window_enum_usage
return true
end
when "-h"
window_enum_usage
return true
end
}
windows = client.extapi.window.enumerate(include_unknown, parent_window)
header = parent_window.nil? ? "Top-level windows" : "Child windows of #{parent_window}"
header = parent_window ? "Child windows of #{parent_window}" : "Top-level windows"
table = Rex::Ui::Text::Table.new(
'Header' => header,