Skip to content

Commit a1efa30

Browse files
committed
comments adjustments & enum better
1 parent e2fe70d commit a1efa30

File tree

5 files changed

+17
-67
lines changed

5 files changed

+17
-67
lines changed

lib/msf/core/module/auth.rb

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,27 @@ def store_valid_credential(user:, private:, private_type: :password, proof: nil)
55
service_data = service_details
66
end
77

8-
cdata = {
8+
creation_data = {
99
module_fullname: self.fullname,
10-
origin_type: :service,
1110
username: user,
1211
private_data: private,
1312
private_type: private_type,
1413
workspace_id: myworkspace_id
1514
}.merge(service_data)
1615

1716
if service_data.empty?
18-
cdata[:origin_type] = :import
19-
cdata[:filename] ='msfconsole' # default as values provided on the console
20-
end
21-
22-
23-
core = create_credential(cdata)
24-
unless service_data.empty?
17+
cred_data = {
18+
origin_type: :import,
19+
filename: 'msfconsole' # default as values provided on the console
20+
}.merge(creation_data)
21+
create_credential(cred_data)
22+
else
2523
login_data = {
26-
core: core,
2724
proof: proof,
2825
last_attempted_at: DateTime.now,
2926
status: Metasploit::Model::Login::Status::SUCCESSFUL
30-
}.merge(cdata)
31-
create_credential_login(login_data)
27+
}.merge(creation_data)
28+
create_credential_and_login(login_data)
3229
end
3330

3431
nil

modules/auxiliary/admin/http/wp_custom_contact_forms.rb

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -62,21 +62,6 @@ def get_table_prefix
6262
table_prefix
6363
end
6464

65-
def service_details
66-
{
67-
address: rhost,
68-
port: rport,
69-
service_name: (ssl ? "https": "http"), # changed from "WorkPress" here
70-
protocol: 'tcp',
71-
workspace_id: myworkspace_id,
72-
module_fullname: fullname,
73-
origin_type: :service
74-
# moved to Msf::Module::Auth
75-
# last_attempted_at: DateTime.now,
76-
# status: Metasploit::Model::Login::Status::SUCCESSFUL
77-
}
78-
end
79-
8065
def run
8166
username = Rex::Text.rand_text_alpha(10)
8267
password = Rex::Text.rand_text_alpha(20)

modules/auxiliary/dos/http/wordpress_long_password_dos.rb

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -66,20 +66,6 @@ def timeout
6666
datastore['TIMEOUT']
6767
end
6868

69-
def service_details
70-
{
71-
service_name: (ssl ? 'https' : 'http'),
72-
address: rhost,
73-
port: rport,
74-
protocol: 'tcp',
75-
origin_type: :service,
76-
module_fullname: fullname
77-
# moved to Msf::Module::Auth
78-
# last_attempted_at: DateTime.now,
79-
# status: Metasploit::Model::Login::Status::SUCCESSFUL
80-
}
81-
end
82-
8369
def user_exists(user)
8470
exists = wordpress_user_exists?(user)
8571
if exists

modules/auxiliary/scanner/http/cisco_ironport_enum.rb

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -116,14 +116,7 @@ def is_app_ironport?
116116
end
117117

118118
def service_details
119-
{
120-
address: rhost,
121-
port: rport,
122-
service_name: 'Cisco IronPort Appliance',
123-
protocol: 'tcp',
124-
origin_type: :service,
125-
module_fullname: fullname
126-
}
119+
super.merge({service_name: 'Cisco IronPort Appliance'})
127120
end
128121

129122
#

modules/auxiliary/scanner/http/wordpress_login_enum.rb

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -100,30 +100,19 @@ def run_host(ip)
100100
end
101101
end
102102

103-
def service_details
104-
{
105-
address: rhost,
106-
port: rport,
107-
service_name: ssl ? 'https' : 'http',
108-
protocol: 'tcp',
109-
workspace_id: myworkspace_id,
110-
module_fullname: fullname,
111-
origin_type: :service,
112-
last_attempted_at: DateTime.now,
113-
# infer status from state when called
114-
status: (@validate_only ? Metasploit::Model::Login::Status::UNTRIED : Metasploit::Model::Login::Status::SUCCESSFUL)
115-
}
116-
end
117-
118103
def validate_user(user=nil)
119104
print_status("#{target_uri} - WordPress User-Validation - Checking Username:'#{user}'")
120105

121106
exists = wordpress_user_exists?(user)
122107
if exists
123108
print_good("#{target_uri} - WordPress User-Validation - Username: '#{user}' - is VALID")
124-
@validate_only = true
125-
store_valid_credential(user: user, private: nil)
126-
@validate_only = false
109+
connection_details = {
110+
module_fullname: self.fullname,
111+
username: user,
112+
workspace_id: myworkspace_id,
113+
status: Metasploit::Model::Login::Status::UNTRIED
114+
}.merge(service_details)
115+
create_credential_and_login(connection_details)
127116
@users_found[user] = :reported
128117
return :next_user
129118
else

0 commit comments

Comments
 (0)