class Rex::Post::Meterpreter::Ui::Console::CommandDispatcher::Extapi::Adsi
Extended API ADSI management user interface.
Constants
- DEFAULT_MAX_RESULTS
Zero indicates “no limit”
- DEFAULT_PAGE_SIZE
- Klass
Public Instance Methods
adsi_computer_enum_usage()
click to toggle source
# File lib/rex/post/meterpreter/ui/console/command_dispatcher/extapi/adsi.rb, line 91 def adsi_computer_enum_usage print( "\nUsage: adsi_computer_enum <domain> [-h] [-m maxresults] [-p pagesize]\n\n" + "Enumerate the computers on the target domain.\n\n" + "Enumeration returns information such as the computer name, desc, and comment.\n" + @@adsi_computer_enum_opts.usage) end
adsi_domain_query_usage()
click to toggle source
# File lib/rex/post/meterpreter/ui/console/command_dispatcher/extapi/adsi.rb, line 130 def adsi_domain_query_usage print( "\nUsage: adsi_domain_query <domain> <filter> <field 1> [field 2 [field ..]] [-h] [-m maxresults] [-p pagesize]\n\n" + "Enumerate the objects on the target domain.\n\n" + "Enumeration returns the set of fields that are specified.\n" + @@adsi_domain_query_opts.usage) end
adsi_user_enum_usage()
click to toggle source
# File lib/rex/post/meterpreter/ui/console/command_dispatcher/extapi/adsi.rb, line 50 def adsi_user_enum_usage print( "\nUsage: adsi_user_enum <domain> [-h] [-m maxresults] [-p pagesize]\n\n" + "Enumerate the users on the target domain.\n\n" + "Enumeration returns information such as the user name, SAM account name, locked\n" + "status, desc, and comment.\n" + @@adsi_user_enum_opts.usage) end
cmd_adsi_computer_enum(*args)
click to toggle source
Enumerate domain computers.
# File lib/rex/post/meterpreter/ui/console/command_dispatcher/extapi/adsi.rb, line 102 def cmd_adsi_computer_enum(*args) args.unshift("-h") if args.length == 0 if args.include?("-h") adsi_computer_enum_usage return true end domain = args.shift filter = "(objectClass=computer)" fields = [ "name", "distinguishedname", "description", "comment" ] args = [domain, filter] + fields + args return cmd_adsi_domain_query(*args) end
cmd_adsi_domain_query(*args)
click to toggle source
Enumerate domain objects.
# File lib/rex/post/meterpreter/ui/console/command_dispatcher/extapi/adsi.rb, line 141 def cmd_adsi_domain_query(*args) page_size = DEFAULT_PAGE_SIZE max_results = DEFAULT_MAX_RESULTS args.unshift("-h") if args.length < 3 @@adsi_domain_query_opts.parse(args) { |opt, idx, val| case opt when "-p" page_size = val.to_i when "-m" max_results = val.to_i when "-h" adsi_domain_query_usage return true end } # Assume that the flags are passed in at the end. Safe? switch_index = args.index { |a| a.start_with?("-") } if switch_index args = args.first(switch_index) end domain = args.shift filter = args.shift objects = client.extapi.adsi.domain_query(domain, filter, max_results, page_size, args) table = Rex::Ui::Text::Table.new( 'Header' => "#{domain} Objects", 'Indent' => 0, 'SortIndex' => 0, 'Columns' => objects[:fields] ) objects[:results].each do |c| table << c end print_line print_line(table.to_s) print_line("Total objects: #{objects[:results].length}") print_line return true end
cmd_adsi_user_enum(*args)
click to toggle source
Enumerate domain users.
# File lib/rex/post/meterpreter/ui/console/command_dispatcher/extapi/adsi.rb, line 62 def cmd_adsi_user_enum(*args) args.unshift("-h") if args.length == 0 if args.include?("-h") adsi_user_enum_usage return true end domain = args.shift filter = "(objectClass=user)" fields = [ "samaccountname", "name", "distinguishedname", "description", "comment" ] args = [domain, filter] + fields + args return cmd_adsi_domain_query(*args) end
commands()
click to toggle source
List of supported commands.
# File lib/rex/post/meterpreter/ui/console/command_dispatcher/extapi/adsi.rb, line 26 def commands { "adsi_user_enum" => "Enumerate all users on the specified domain.", "adsi_computer_enum" => "Enumerate all computers on the specified domain.", "adsi_domain_query" => "Enumerate all objects on the specified domain that match a filter." } end
name()
click to toggle source
Name for this dispatcher
# File lib/rex/post/meterpreter/ui/console/command_dispatcher/extapi/adsi.rb, line 37 def name "Extapi: ADSI Management" end