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/axis2.rb
Views: 1904
1require 'metasploit/framework/login_scanner/http'23module Metasploit4module Framework5module LoginScanner67# Tomcat Manager login scanner8class Axis2 < HTTP910DEFAULT_PORT = 808011# Inherit LIKELY_PORTS,LIKELY_SERVICE_NAMES, and REALM_KEY from HTTP1213CAN_GET_SESSION = true14PRIVATE_TYPES = [ :password ]1516# (see Base#attempt_login)17def attempt_login(credential)18result_opts = {19credential: credential,20host: host,21port: port,22protocol: 'tcp'23}24if ssl25result_opts[:service_name] = 'https'26else27result_opts[:service_name] = 'http'28end2930begin31# Refactor to access Metasploit::Framework::LoginScanner::HTTP#send_request()32# to send request to the HTTP server and obtain a response33response = send_request({34'uri' => uri,35'method' => 'POST',36'vars_post' =>37{38'userName' => credential.public,39'password' => credential.private,40'submit' => '+Login+'41}42})4344if response && response.code == 200 && response.body.include?("upload")45result_opts.merge!(status: Metasploit::Model::Login::Status::SUCCESSFUL, proof: response)46else47result_opts.merge!(status: Metasploit::Model::Login::Status::INCORRECT, proof: response)48end49rescue ::EOFError, Rex::ConnectionError, ::Timeout::Error => e50result_opts.merge!(status: Metasploit::Model::Login::Status::UNABLE_TO_CONNECT, proof: e)51end5253Result.new(result_opts)5455end5657# (see Base#set_sane_defaults)58def set_sane_defaults59self.uri = "/axis2/axis2-admin/login" if self.uri.nil?60@method = "POST".freeze6162super63end6465# The method *must* be "POST", so don't let the user change it66# @raise [RuntimeError]67def method=(_)68raise RuntimeError, "Method must be POST for Axis2"69end7071end72end73end74end75767778