Skip to content

Commit

Permalink
Update omrontcp-info.nse
Browse files Browse the repository at this point in the history
cleaned up code around the socket:close and returns
  • Loading branch information
sjhilt committed Feb 6, 2015
1 parent 495a5f6 commit 1d8c5fe
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions omrontcp-info.nse
Expand Up @@ -139,13 +139,9 @@ action = function(host,port)
pos, response_code = bin.unpack("<S", response, 29)
-- test for a few of the error codes I saw when testing the script
if(response_code == 2081) then
socket:close()
output["Response Code"] = "Data cannot be changed (0x2108)"
return output
elseif(response_code == 290) then
socket:close()
output["Response Code"] = "The mode is wrong (executing) (0x2201)"
return output
elseif(response_code == 0) then
-- parse information from response
pos, output["Response Code"] = "Normal completion (0x0000)"
Expand All @@ -162,15 +158,12 @@ action = function(host,port)
pos, mem_card_type = bin.unpack("C", response, pos)
output["Kind of Memory Card"] = memory_card(mem_card_type)
pos, output["Memory Card Size"] = bin.unpack(">S", response, pos)
-- close socket and return output
socket:close()
return output
else
-- close socket and return unknown response code
socket:close()
output["Response Code"] = "Unknown Response Code"
return output
end
end
-- close socket, return output
socket:close()
return output

else
-- close socket and return nil
Expand Down

0 comments on commit 1d8c5fe

Please sign in to comment.