Skip to content

Commit 3ab214e

Browse files
committed
Minor edits
1 parent 6bd09c1 commit 3ab214e

File tree

1 file changed

+6
-28
lines changed

1 file changed

+6
-28
lines changed

modules/auxiliary/scanner/http/gavazzi_em_login_loot.rb

Lines changed: 6 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -157,39 +157,17 @@ def do_login(user, pass)
157157
return :abort
158158
end
159159

160-
if (res && res.code == 200 && res.body.include?('Firmware Version'))
161-
fw_ver_dirty = res.body.match(/Firmware Version(.*)(.*)td/)
160+
if res && res.code == 200
161+
if res.body.include?('Firmware Version') || res.body.include?('Versione Firmware')
162+
fw_ver = res.body.match(/Ver. (.*)[$<]/)[1]
162163

163-
if !fw_ver_dirty.nil?
164-
fw_ver_clean = "#{fw_ver_dirty}".match(/Ver. (.*)[$<]/)[1]
165-
166-
if !fw_ver_clean.nil?
167-
print_good("#{rhost}:#{rport} - Firmware version #{fw_ver_clean}...")
168-
169-
report_cred(
170-
ip: rhost,
171-
port: rport,
172-
service_name: "Carlo Gavazzi Energy Meter [Firmware ver #{fw_ver_clean}]",
173-
user: user,
174-
password: pass
175-
)
176-
end
177-
end
178-
end
179-
180-
if (res && res.code == 200 && res.body.include?('Versione Firmware Installata'))
181-
fw_ver_dirty = res.body.match(/Ver. (.*)[$<]/)
182-
183-
if !fw_ver_dirty.nil?
184-
fw_ver_clean = "#{fw_ver_dirty}".match(/[^Ver. ](.*)[^<]/)
185-
186-
if !fw_ver_clean.nil?
187-
print_good("#{rhost}:#{rport} - Firmware version #{fw_ver_clean}...")
164+
if !fw_ver.nil?
165+
print_good("#{rhost}:#{rport} - Firmware version #{fw_ver}...")
188166

189167
report_cred(
190168
ip: rhost,
191169
port: rport,
192-
service_name: "Carlo Gavazzi Energy Meter [Firmware ver #{fw_ver_clean}]",
170+
service_name: "Carlo Gavazzi Energy Meter [Firmware ver #{fw_ver}]",
193171
user: user,
194172
password: pass
195173
)

0 commit comments

Comments
 (0)