Module: Msf::Auxiliary::Brocade
- Includes:
- Report
- Defined in:
- lib/msf/core/auxiliary/brocade.rb
Overview
This module provides methods for working with Brocade equipment
Instance Method Summary collapse
- #brocade_config_eater(thost, tport, config) ⇒ Object
- #create_credential_and_login(opts = {}) ⇒ Object
Methods included from Report
#active_db?, #create_cracked_credential, #create_credential, #create_credential_login, #db, #db_warning_given?, #get_client, #get_host, #inside_workspace_boundary?, #invalidate_login, #mytask, #myworkspace, #myworkspace_id, #report_auth_info, #report_client, #report_exploit, #report_host, #report_loot, #report_note, #report_service, #report_vuln, #report_web_form, #report_web_page, #report_web_site, #report_web_vuln, #store_cred, #store_local, #store_loot
Methods included from Metasploit::Framework::Require
optionally, optionally_active_record_railtie, optionally_include_metasploit_credential_creation, #optionally_include_metasploit_credential_creation, optionally_require_metasploit_db_gem_engines
Instance Method Details
#brocade_config_eater(thost, tport, config) ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
# File 'lib/msf/core/auxiliary/brocade.rb', line 48 def brocade_config_eater(thost, tport, config) # this is for brocade type devices. # It is similar to cisco # Docs: enable password-display -> http://wwwaem.brocade.com/content/html/en/command-reference-guide/fastiron-08040-commandref/GUID-169889CD-1A74-4A23-AC78-38796692374F.html if framework.db.active credential_data = { address: thost, port: tport, protocol: 'tcp', workspace_id: myworkspace_id, origin_type: :service, private_type: :nonreplayable_hash, service_name: '', module_fullname: fullname, status: Metasploit::Model::Login::Status::UNTRIED } end store_loot('brocade.config', 'text/plain', thost, config.strip, 'config.txt', 'Brocade Configuration') # Brocade has this one configuration called "password display". With it, we get hashes. With out it, just ... if config =~ /enable password-display/ print_good('password-display is enabled, hashes will be displayed in config') else print_bad('password-display is disabled, no password hashes displayed in config') end # enable password # Example lines: # enable super-user-password 8 $1$QP3H93Wm$uxYAs2HmAK01QiP3ig5tm. config.scan(/enable super-user-password 8 (?<admin_password_hash>.+)/i).each do |result| admin_hash = result[0].strip next if admin_hash == '.....' print_good("enable password hash #{admin_hash}") next unless framework.db.active cred = credential_data.dup cred[:username] = 'enable' cred[:private_data] = admin_hash create_credential_and_login(cred) end # user account # Example lines: # username brocade password 8 $1$YBaHUWpr$PzeUrP0XmVOyVNM5rYy99/ config.scan(%r{username "?(?<user_name>[a-z0-9]+)"? password (?<user_type>\w+) (?<user_hash>[0-9a-z=\$/\.]{34})}i).each do |result| user_name = result[0].strip user_type = result[1].strip user_hash = result[2].strip next if user_hash == '.....' print_good("User #{user_name} of type #{user_type} found with password hash #{user_hash}.") next unless framework.db.active cred = credential_data.dup cred[:username] = user_name cred[:private_data] = user_hash create_credential_and_login(cred) end # snmp # Example lines: # snmp-server community 1 $Si2^=d rw # these at times look base64 encoded, which they may be, but are also encrypted config.scan(/snmp-server community (?<snmp_id>[\d]+) (?<snmp_community>.+) (?<snmp_permissions>rw|ro)/i).each do |result| snmp_community = result[1].strip = result[2].strip next if snmp_community == '.....' print_good("#{'ENCRYPTED ' if snmp_community.start_with?('$')}SNMP community #{snmp_community} with permissions #{}") next unless framework.db.active cred = credential_data.dup cred[:protocol] = 'udp' cred[:port] = 161 cred[:service_name] = 'snmp' cred[:private_data] = snmp_community create_credential_and_login(cred) end end |
#create_credential_and_login(opts = {}) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/msf/core/auxiliary/brocade.rb', line 12 def create_credential_and_login(opts = {}) return nil unless active_db? if respond_to?(:[]) && self[:task] opts[:task_id] ||= self[:task].record.id end core = opts.fetch(:core, create_credential(opts)) access_level = opts.fetch(:access_level, nil) last_attempted_at = opts.fetch(:last_attempted_at, nil) status = opts.fetch(:status, Metasploit::Model::Login::Status::UNTRIED) login_object = nil retry_transaction do service_object = create_credential_service(opts) login_object = Metasploit::Credential::Login.where(core_id: core.id, service_id: service_object.id).first_or_initialize if opts[:task_id] login_object.tasks << Mdm::Task.find(opts[:task_id]) end login_object.access_level = access_level if access_level login_object.last_attempted_at = last_attempted_at if last_attempted_at if status == Metasploit::Model::Login::Status::UNTRIED if login_object.last_attempted_at.nil? login_object.status = status end else login_object.status = status end login_object.save! end login_object end |