diff --git a/README.md b/README.md index 0f697d4..82c4e16 100644 --- a/README.md +++ b/README.md @@ -19,8 +19,10 @@ Configuration will only affect network scanning and not drive discovery on the l * LocalAdmin:123456 * NetworkAdmin:21345|localdomain -**Network Locations** are listed in single IP, network range, or CIDR formats. Acceptable examples: +**Network Locations** are listed in single IP, single name, network range, or CIDR formats. Acceptable examples: * 192.168.1.1 * 192.355.2.1 // Overflowing segments greater than 255 are added onto the next (left) number. Converts to '193.99.2.1' * 192.168.1.0-192.168.1.255 -* 192.168.1.0/18 \ No newline at end of file +* 192.168.1.0/18 +* neptune-04.localdomain.com +* local-system-name \ No newline at end of file diff --git a/src/mattw/jexplorer/JExplorer.java b/src/mattw/jexplorer/JExplorer.java index 2c54ced..bbbe620 100644 --- a/src/mattw/jexplorer/JExplorer.java +++ b/src/mattw/jexplorer/JExplorer.java @@ -26,6 +26,7 @@ import java.io.File; import java.io.IOException; +import java.net.InetAddress; import java.net.InetSocketAddress; import java.net.Socket; import java.util.ArrayList; @@ -377,26 +378,31 @@ private List parseNetworkLocations(String locations) { for(String s : Arrays.asList(locations.split("\n"))) { if(!s.startsWith("#")) { try { - if(s.contains("-") || s.contains("/")) { - if(s.contains("/") && AddressBlock.isCIDR(s)) { - block = new AddressBlock(s); - } else if(s.contains("-")) { - String[] parts = s.split("-"); - if(parts.length == 2) { - block = new AddressBlock(new Address(parts[0].trim()), new Address(parts[1].trim())); + locs.add(InetAddress.getByName(s).getHostAddress()); + } catch (Exception ignored) { + try { + if(s.contains("-") || s.contains("/")) { + if(s.contains("/") && AddressBlock.isCIDR(s)) { + block = new AddressBlock(s); + } else if(s.contains("-")) { + String[] parts = s.split("-"); + if(parts.length == 2) { + block = new AddressBlock(new Address(parts[0].trim()), new Address(parts[1].trim())); + } } + if(block != null) { + locs.add(block); + } + } else { + locs.add(s); } - if(block != null) { - locs.add(block); - } - } else { - locs.add(s); + } catch (Exception e) { + System.err.println(s); } - } catch (Exception e) { - System.err.println(s); } } } + System.out.println(locs); return locs; }