Skip to content

Commit

Permalink
Minor syntax; add logging for unhandled fields
Browse files Browse the repository at this point in the history
  • Loading branch information
jhart-r7 committed Feb 1, 2019
1 parent 4681ed9 commit f0519a5
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions modules/auxiliary/scanner/ubiquiti/ubiquiti_discover.rb
Expand Up @@ -35,13 +35,13 @@ def build_probe
def scanner_process(data, shost, sport)
offset = 0
if data.length < 4
return
return
end

type, length = data.unpack("vn")
offset += 4
if type != 1 || length != data.length - offset
return
return
end

remaining = data.length - offset
Expand All @@ -52,11 +52,11 @@ def scanner_process(data, shost, sport)
remaining -= 4

field_data = data.slice(offset, length)
offset += length
remaining -= length
if field_data.empty?
next
end
offset += length
remaining -= length
# name
if type == 0x0b
info['name'] = field_data
Expand All @@ -80,6 +80,7 @@ def scanner_process(data, shost, sport)
elsif type == 0x0d
info['essid'] = field_data
else
vprint_warning("#{shost}:#{sport} skipping unhandled #{length}-byte field type '#{type}': '#{field_data.unpack("H*")}'")
end
end

Expand Down

0 comments on commit f0519a5

Please sign in to comment.