diff --git a/src/ARP-Scanner/ARP-Scanner.csproj b/src/ARP-Scanner/ARP-Scanner.csproj index a740f6c..7ad33bc 100644 --- a/src/ARP-Scanner/ARP-Scanner.csproj +++ b/src/ARP-Scanner/ARP-Scanner.csproj @@ -11,6 +11,7 @@ + diff --git a/src/ARP-Scanner/MacVendorLookup.cs b/src/ARP-Scanner/MacVendorLookup.cs index 8a46a81..946291d 100644 --- a/src/ARP-Scanner/MacVendorLookup.cs +++ b/src/ARP-Scanner/MacVendorLookup.cs @@ -45,18 +45,18 @@ internal partial class MacVendorLookup ConsoleExt.WriteLine("Downloading MAC database from maclookup.app...", ConsoleColor.DarkYellow); - List? newMacInformations = null; + List? newMacInformation = null; try { - newMacInformations = await httpClient.GetFromJsonAsync>(macLookupUrl); + newMacInformation = await httpClient.GetFromJsonAsync>(macLookupUrl); } catch (Exception ex) { ConsoleExt.WriteLine($"Failed to download MAC database: {ex.Message}", ConsoleColor.Red); } - if (newMacInformations is null) + if (newMacInformation is null) { if (macDatabase.MacInformations.Count != 0) { @@ -73,19 +73,19 @@ internal partial class MacVendorLookup _ = Directory.CreateDirectory(Path.GetDirectoryName(cachePath)!); - macDatabase.MacInformations = newMacInformations; + macDatabase.MacInformations = newMacInformation; macDatabase.LastUpdate = DateTime.Now; File.WriteAllText(cachePath, JsonSerializer.Serialize(macDatabase)); } } - public MacInformation GetInformation(string macAdress) + public MacInformation GetInformation(string macAddress) { - macAdress = macAdress.Replace("-", ":")[..8].ToUpper(); + macAddress = macAddress.Replace("-", ":")[..8].ToUpper(); - return macDatabase.MacInformations.Find(m => m.MacPrefix == macAdress) ?? new MacInformation() + return macDatabase.MacInformations.Find(m => m.MacPrefix == macAddress) ?? new MacInformation() { - MacPrefix = macAdress, + MacPrefix = macAddress, VendorName = "Unknown", BlockType = "Unknown", Private = null, diff --git a/src/ARP-Scanner/Program.cs b/src/ARP-Scanner/Program.cs index 8c1839a..75747c5 100644 --- a/src/ARP-Scanner/Program.cs +++ b/src/ARP-Scanner/Program.cs @@ -2,6 +2,8 @@ using CuteUtils.Misc; +using Humanizer; + using NetTools; using System.Collections.Concurrent; @@ -37,7 +39,11 @@ internal static class Program List header = ["IP", "MAC"]; ConcurrentBag activeHosts = []; - header.AddRange([nameof(MacInformation.VendorName), nameof(MacInformation.BlockType), nameof(MacInformation.Private), nameof(MacInformation.LastUpdate)]); + header.AddRange([ + nameof(MacInformation.VendorName).Humanize(LetterCasing.Title), + nameof(MacInformation.BlockType).Humanize(LetterCasing.Title), + nameof(MacInformation.Private).Humanize(LetterCasing.Title), + nameof(MacInformation.LastUpdate).Humanize(LetterCasing.Title)]); ConsoleExt.WriteLine("Starting scan...", ConsoleColor.DarkYellow); @@ -87,7 +93,7 @@ internal static class Program activeHostsTable.ToArray().To2D().PrintTable(TableStyle.List); - ConsoleExt.WriteLine($"{Environment.NewLine}Found {activeHosts.Count} active host{(activeHosts.Count == 1 ? "s" : "")}", ConsoleColor.Green); + ConsoleExt.WriteLine($"{Environment.NewLine}Found {"active host".ToQuantity(activeHosts.Count)}", ConsoleColor.Green); } else {