private static void Main(string[] args) { // Load general program configuration _config = new Configuration(); // Convert configuration Subnets to List of IPs var IPList = IPTools.SubnetsToIPAddresses(_config.Settings.Subnets); // Some CLI Header Information Console.WriteLine($"Threads for Processing: {_config.Settings.Threads}"); Console.WriteLine($"Domain Name: {_config.Settings.DomainName}"); Console.WriteLine($"Total IPs for Processing: {IPList.Count}"); Console.WriteLine(); // Build a list based on subnet and return a list of IPs responding to pings. IPAddressValue[] ActiveIPs = findActiveIPsWithProgress(IPList); // Run our SNMP Fetches against all known active IPs Device[] DeviceResults = fetchSNMPWithProgress(ActiveIPs); // Save our results to static files (CSV) // TODO: Output to CSV should be shifted to a plugin it's just another "output" like the rest, just happens to be local. Console.WriteLine("Saving Results of Scan"); ResultStorage.SaveResults(DeviceResults); Console.WriteLine(); runPlugins(DeviceResults); }
/// <summary> /// Takes a list of IPAddressValues and checks them via ping if they are active with retries. /// with Progress indicators for CLI mode /// </summary> /// <param name="IPList"></param> /// <returns></returns> private static IPAddressValue[] findActiveIPsWithProgress(List <IPAddressValue> IPList) { IPAddressValue[] ActiveIPs; using (var progress = new ProgressBar()) { Console.WriteLine("Testing for Active IPs... "); ActiveIPs = IPTools.BuildActiveIPList(IPList, _config.Settings.Threads, progress); }; Console.WriteLine($"Total Active IPs Found: {ActiveIPs.Count()}"); Console.WriteLine(); return(ActiveIPs); }