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/cisco_firepower.rb
Views: 1904
require 'metasploit/framework/login_scanner/http'1require 'digest'23module Metasploit4module Framework5module LoginScanner67class CiscoFirepower < HTTP89DEFAULT_PORT = 44310PRIVATE_TYPES = [ :password ]11LOGIN_STATUS = Metasploit::Model::Login::Status # Shorter name1213def check_setup14res = send_request({15'method' => 'GET',16'uri' => normalize_uri("#{uri}login.cgi")17})1819if res && res.code == 200 && res.body.include?('/img/favicon.png?v=6.0.1-1213')20return true21end2223false24end2526def do_login(cred)27console_user = cred.public28console_pass = cred.private2930res = send_request({31'method' => 'POST',32'uri' => normalize_uri("#{uri}login.cgi"),33'vars_post' => {34'username' => console_user,35'password' => console_pass,36'target' => ''37}38})3940unless res41return {status: LOGIN_STATUS::UNABLE_TO_CONNECT, proof: 'Connection timed out for login.cig'}42end4344if res.code == 302 && res.get_cookies.include?('CGISESSID')45return {status: LOGIN_STATUS::SUCCESSFUL, proof: res.body}46end4748{status: LOGIN_STATUS::INCORRECT, proof: res.body}49end5051# Attempts to login to Cisco. This is called first.52#53# @param credential [Metasploit::Framework::Credential] The credential object54# @return [Result] A Result object indicating success or failure55def attempt_login(credential)56result_opts = {57credential: credential,58status: Metasploit::Model::Login::Status::INCORRECT,59proof: nil,60host: host,61port: port,62protocol: 'tcp'63}6465begin66result_opts.merge!(do_login(credential))67rescue ::Rex::ConnectionError => e68# Something went wrong during login. 'e' knows what's up.69result_opts.merge!(status: LOGIN_STATUS::UNABLE_TO_CONNECT, proof: e.message)70end7172Result.new(result_opts)73end7475end76end77end78end79808182