Skip to content

Commit ba50f2f

Browse files
committed
Fix nil for empty pass
1 parent 55b9c15 commit ba50f2f

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

modules/auxiliary/gather/advantech_webaccess_creds.rb

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def get_user_cred_detail(sid, user)
9898
html = res.get_html_document
9999
pass_field = html.at('input[@name="Password"]')
100100

101-
pass_field.attributes['value'].text
101+
pass_field ? pass_field.attributes['value'].text : nil
102102
end
103103

104104
def get_users_page(sid)
@@ -158,14 +158,17 @@ def run
158158

159159
users.each do |user|
160160
pass = get_user_cred_detail(cookie, user)
161-
report_cred(
162-
user: user,
163-
password: pass,
164-
status: Metasploit::Model::Login::Status::SUCCESSFUL,
165-
proof: 'AdminPg.asp'
166-
)
167161

168-
print_good("Found password: #{user}:#{pass}")
162+
if pass
163+
report_cred(
164+
user: user,
165+
password: pass,
166+
status: Metasploit::Model::Login::Status::SUCCESSFUL,
167+
proof: 'AdminPg.asp'
168+
)
169+
170+
print_good("Found password: #{user}:#{pass}")
171+
end
169172
end
170173
end
171174

0 commit comments

Comments
 (0)