CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!
CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!
Path: blob/master/lib/metasploit/framework/login_scanner/acpp.rb
Views: 1904
require 'metasploit/framework/tcp/client'1require 'metasploit/framework/login_scanner/base'2require 'metasploit/framework/login_scanner/rex_socket'34module Metasploit5module Framework6module LoginScanner7# This is the LoginScanner class for dealing with the Apple Airport ACPP8# protocol. It is responsible for taking a single target, and a list of9# credentials and attempting them. It then saves the results.10class ACPP11include Metasploit::Framework::LoginScanner::Base12include Metasploit::Framework::LoginScanner::RexSocket13include Metasploit::Framework::Tcp::Client1415#16# CONSTANTS17#18DEFAULT_PORT = Rex::Proto::ACPP::DEFAULT_PORT19LIKELY_PORTS = [ DEFAULT_PORT ]20LIKELY_SERVICE_NAMES = [ 'acpp' ]21PRIVATE_TYPES = [ :password ]22REALM_KEY = nil232425# This method attempts a single login with a single credential against the target26# @param credential [Credential] The credential object to attempt to login with27# @return [Metasploit::Framework::LoginScanner::Result] The LoginScanner Result object28def attempt_login(credential)29result_options = {30credential: credential,31host: host,32port: port,33protocol: 'tcp',34service_name: 'acpp'35}3637begin38# Make our initial socket to the target39disconnect if self.sock40connect4142client = Rex::Proto::ACPP::Client.new(sock)4344auth_response = client.authenticate(credential.private)45if auth_response.successful?46status = Metasploit::Model::Login::Status::SUCCESSFUL47else48status = Metasploit::Model::Login::Status::INCORRECT49end50result_options.merge!(51proof: "Status code #{auth_response.status}",52status: status53)54rescue ::EOFError, Errno::ENOTCONN, Rex::ConnectionError, ::Timeout::Error => e55result_options.merge!(56proof: e.message,57status: Metasploit::Model::Login::Status::UNABLE_TO_CONNECT58)59ensure60disconnect61end6263::Metasploit::Framework::LoginScanner::Result.new(result_options)64end65end66end67end68end697071