Skip to content

Commit f5a920d

Browse files
committed
Use || operator
1 parent 64754a5 commit f5a920d

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

modules/auxiliary/gather/eventlog_cred_disclosure.rb

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -128,15 +128,15 @@ def run
128128
doc.elements.each('Details/Hosts') do |ele|
129129
# Add an empty string if a variable doesn't exist, we have to check it
130130
# somewhere and it's easier to do it here.
131-
host_ipaddress = (ele.attributes["host_ipaddress"] != nil ? ele.attributes["host_ipaddress"] : "")
131+
host_ipaddress = ele.attributes["host_ipaddress"] || ""
132132

133133
ele.elements.each('HostDetails') do |details|
134-
domain_name = (details.attributes["domain_name"] != nil ? details.attributes["domain_name"] : "")
135-
username = (details.attributes["username"] != nil ? details.attributes["username"] : "")
136-
password_encoded = (details.attributes["password"] != nil ? details.attributes["password"] : "")
134+
domain_name = details.attributes["domain_name"] || ""
135+
username = details.attributes["username"] || ""
136+
password_encoded = details.attributes["password"] || ""
137137
password = decode_password(password_encoded)
138-
type = (details.attributes["type"] != nil ? details.attributes["type"] : "")
139-
subtype = (details.attributes["subtype"] != nil ? details.attributes["subtype"] : "")
138+
type = details.attributes["type"] || ""
139+
subtype = details.attributes["subtype"] || ""
140140

141141
if not (type =~ /Windows/ or subtype =~ /Windows/)
142142
# With AS/400 we get some garbage in the domain name even though it doesn't exist
@@ -169,7 +169,6 @@ def run
169169
create_credential_login(host_login_data)
170170
end
171171
end
172-
173172
end
174173

175174
print_line

0 commit comments

Comments
 (0)