Fix up spacing errors and fix a potential OOB reference issue

This commit is contained in:
Grant Willcox 2022-01-20 12:14:51 -06:00
parent 899fbfcb85
commit 577f5f81b9
No known key found for this signature in database
GPG Key ID: D35E05C0F2B81E83
1 changed files with 5 additions and 3 deletions

View File

@ -138,8 +138,6 @@ class MetasploitModule < Msf::Auxiliary
make_payload(payload)
end
def handle_error(response)
case response.reverse.unpack("c")[0].to_i
when 1
@ -405,6 +403,7 @@ class MetasploitModule < Msf::Auxiliary
elsif response.unpack("C*")[7] == @function_code
objCnt = response[13].unpack("C")[0]
objIdPos=14
max_ref_size = response.size -1
begin
objLen = response[objIdPos+1].unpack("C")[0]
value = response.slice(objIdPos+2,objLen).unpack("a*")[0]
@ -412,13 +411,16 @@ class MetasploitModule < Msf::Auxiliary
print_good("Object ID #{objid}: #{value}")
objCnt = objCnt-1
objIdPos = objIdPos + objLen + 2
if objIdPos > max_ref_size
print_error("Out of bounds reference occured whilst processing READ ID operation! Check sender data!")
break
end
end while objCnt > 0
else
print_error("Unknown answer")
end
end
def run
@modbus_counter = 0x0000 # used for modbus frames
connect