Path: blob/master/modules/auxiliary/scanner/http/buffalo_login.rb
19535 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45require 'metasploit/framework/credential_collection'6require 'metasploit/framework/login_scanner/buffalo'78class MetasploitModule < Msf::Auxiliary9include Msf::Exploit::Remote::HttpClient10include Msf::Auxiliary::Scanner11include Msf::Auxiliary::Report12include Msf::Auxiliary::AuthBrute1314def initialize15super(16'Name' => 'Buffalo NAS Login Utility',17'Description' => %q{18This module simply attempts to login to a Buffalo NAS instance using a specific19username and password. It has been confirmed to work on version 1.6820},21'Author' => [ 'Nicholas Starke <starke.nicholas[at]gmail.com>' ],22'License' => MSF_LICENSE23)2425register_options(26[27Opt::RPORT(80)28]29)30end3132def run_host(ip)33cred_collection = build_credential_collection(34username: datastore['USERNAME'],35password: datastore['PASSWORD']36)3738scanner = Metasploit::Framework::LoginScanner::Buffalo.new(39configure_http_login_scanner(40cred_details: cred_collection,41stop_on_success: datastore['STOP_ON_SUCCESS'],42bruteforce_speed: datastore['BRUTEFORCE_SPEED'],43connection_timeout: 10,44http_username: datastore['HttpUsername'],45http_password: datastore['HttpPassword']46)47)4849scanner.scan! do |result|50credential_data = result.to_h51credential_data.merge!(52module_fullname: fullname,53workspace_id: myworkspace_id54)55if result.success?56credential_core = create_credential(credential_data)57credential_data[:core] = credential_core58create_credential_login(credential_data)5960print_good "#{ip}:#{rport} - Login Successful: #{result.credential}"61else62invalidate_login(credential_data)63vprint_error "#{ip}:#{rport} - LOGIN FAILED: #{result.credential} (#{result.status})"64end65end66end67end686970