lib/lan_scanner.rb in lan_scanner-0.0.4 vs lib/lan_scanner.rb in lan_scanner-0.0.5
- old
+ new
@@ -61,10 +61,10 @@
`nmap -sn #{addresses.join(' ')} -oX "#{tmp_file}"`
online_hosts = _parse_nmap_xml [File.read(tmp_file)]
offline_addresses = addresses.reject { |a| online_hosts.map(&:remote_address).include?(a) }
# check offline addresses again with expensive check
if expensive
- `nmap -Pn #{offline_addresses.join(' ')} -oX "#{tmp_file}"`
+ `nmap -sP #{offline_addresses.join(' ')} -oX "#{tmp_file}"`
online_hosts += _parse_nmap_xml [File.read(tmp_file)]
offline_addresses = addresses.reject { |a| online_hosts.map(&:remote_address).include?(a) }
end
online_hosts + offline_addresses.map { |a| OpenStruct.new(remote_address: a, host_name: nil, state: 'down') }
end
\ No newline at end of file