CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/lib/metasploit/framework/login_scanner/axis2.rb
Views: 1904
1
2
require 'metasploit/framework/login_scanner/http'
3
4
module Metasploit
5
module Framework
6
module LoginScanner
7
8
# Tomcat Manager login scanner
9
class Axis2 < HTTP
10
11
DEFAULT_PORT = 8080
12
# Inherit LIKELY_PORTS,LIKELY_SERVICE_NAMES, and REALM_KEY from HTTP
13
14
CAN_GET_SESSION = true
15
PRIVATE_TYPES = [ :password ]
16
17
# (see Base#attempt_login)
18
def attempt_login(credential)
19
result_opts = {
20
credential: credential,
21
host: host,
22
port: port,
23
protocol: 'tcp'
24
}
25
if ssl
26
result_opts[:service_name] = 'https'
27
else
28
result_opts[:service_name] = 'http'
29
end
30
31
begin
32
# Refactor to access Metasploit::Framework::LoginScanner::HTTP#send_request()
33
# to send request to the HTTP server and obtain a response
34
response = send_request({
35
'uri' => uri,
36
'method' => 'POST',
37
'vars_post' =>
38
{
39
'userName' => credential.public,
40
'password' => credential.private,
41
'submit' => '+Login+'
42
}
43
})
44
45
if response && response.code == 200 && response.body.include?("upload")
46
result_opts.merge!(status: Metasploit::Model::Login::Status::SUCCESSFUL, proof: response)
47
else
48
result_opts.merge!(status: Metasploit::Model::Login::Status::INCORRECT, proof: response)
49
end
50
rescue ::EOFError, Rex::ConnectionError, ::Timeout::Error => e
51
result_opts.merge!(status: Metasploit::Model::Login::Status::UNABLE_TO_CONNECT, proof: e)
52
end
53
54
Result.new(result_opts)
55
56
end
57
58
# (see Base#set_sane_defaults)
59
def set_sane_defaults
60
self.uri = "/axis2/axis2-admin/login" if self.uri.nil?
61
@method = "POST".freeze
62
63
super
64
end
65
66
# The method *must* be "POST", so don't let the user change it
67
# @raise [RuntimeError]
68
def method=(_)
69
raise RuntimeError, "Method must be POST for Axis2"
70
end
71
72
end
73
end
74
end
75
end
76
77
78