1212
1313namespace Smdn . Net . AddressResolution . Arp ;
1414
15- internal sealed class ProcfsArpNmapScanMacAddressResolver : ProcfsArpMacAddressResolver {
15+ internal sealed class ProcfsArpWithNmapCommandMacAddressResolver : ProcfsArpMacAddressResolver {
1616 // ref: https://nmap.org/book/man-briefoptions.html
1717 // -sn: Ping Scan - disable port scan
1818 // -n: Never do DNS resolution
@@ -21,12 +21,12 @@ internal sealed class ProcfsArpNmapScanMacAddressResolver : ProcfsArpMacAddressR
2121 // -oG <file>: Output scan in Grepable format
2222 private const string NmapCommandBaseOptions = "-sn -n -T4 -oG - " ;
2323
24- public static new bool IsSupported => ProcfsArpMacAddressResolver . IsSupported && lazyPathToNmap . Value is not null ;
24+ public static new bool IsSupported => ProcfsArpMacAddressResolver . IsSupported && lazyPathToNmapCommand . Value is not null ;
2525
26- private static readonly Lazy < string ? > lazyPathToNmap = new ( valueFactory : GetPathToNmap , isThreadSafe : true ) ;
26+ private static readonly Lazy < string ? > lazyPathToNmapCommand = new ( valueFactory : GetPathToNmapCommand , isThreadSafe : true ) ;
2727 private static readonly string [ ] BinDirs = new [ ] { "/bin/" , "/sbin/" , "/usr/bin/" } ;
2828
29- private static string ? GetPathToNmap ( )
29+ private static string ? GetPathToNmapCommand ( )
3030 => BinDirs
3131 . Select ( static dir => Path . Combine ( dir , "nmap" ) )
3232 . FirstOrDefault ( static nmap => File . Exists ( nmap ) ) ;
@@ -37,7 +37,7 @@ internal sealed class ProcfsArpNmapScanMacAddressResolver : ProcfsArpMacAddressR
3737 private readonly string nmapCommandCommonOptions ;
3838 private readonly string nmapCommandFullScanOptions ;
3939
40- public ProcfsArpNmapScanMacAddressResolver (
40+ public ProcfsArpWithNmapCommandMacAddressResolver (
4141 MacAddressResolverOptions options ,
4242 ILogger ? logger
4343 )
@@ -46,22 +46,22 @@ public ProcfsArpNmapScanMacAddressResolver(
4646 logger
4747 )
4848 {
49- if ( string . IsNullOrEmpty ( options . NmapInterfaceSpecification ) )
49+ if ( string . IsNullOrEmpty ( options . NmapCommandInterfaceSpecification ) )
5050 nmapCommandCommonOptions = NmapCommandBaseOptions ;
5151 else
5252 // -e <iface>: Use specified interface
53- nmapCommandCommonOptions = NmapCommandBaseOptions + $ "-e { options . NmapInterfaceSpecification } ";
53+ nmapCommandCommonOptions = NmapCommandBaseOptions + $ "-e { options . NmapCommandInterfaceSpecification } ";
5454
5555 nmapCommandFullScanOptions = string . Concat (
5656 nmapCommandCommonOptions ,
57- options . NmapTargetSpecification
58- ?? throw new ArgumentException ( $ "{ nameof ( options . NmapTargetSpecification ) } must be specified with { nameof ( MacAddressResolverOptions ) } ")
57+ options . NmapCommandTargetSpecification
58+ ?? throw new ArgumentException ( $ "{ nameof ( options . NmapCommandTargetSpecification ) } must be specified with { nameof ( MacAddressResolverOptions ) } ")
5959 ) ;
6060 }
6161
6262 protected override ValueTask ArpFullScanAsyncCore ( CancellationToken cancellationToken )
6363 // perform full scan
64- => NmapScanAsync (
64+ => RunNmapCommandAsync (
6565 nmapCommandOptions : nmapCommandFullScanOptions ,
6666 logger : Logger ,
6767 cancellationToken : cancellationToken
@@ -77,21 +77,21 @@ CancellationToken cancellationToken
7777
7878 return nmapCommandOptionTargetSpecification . Length == 0
7979 ? default // do nothing
80- : NmapScanAsync (
80+ : RunNmapCommandAsync (
8181 nmapCommandOptions : nmapCommandCommonOptions + nmapCommandOptionTargetSpecification ,
8282 logger : Logger ,
8383 cancellationToken : cancellationToken
8484 ) ;
8585 }
8686
87- private static async ValueTask NmapScanAsync (
87+ private static async ValueTask RunNmapCommandAsync (
8888 string nmapCommandOptions ,
8989 ILogger ? logger ,
9090 CancellationToken cancellationToken
9191 )
9292 {
9393 var nmapCommandProcessStartInfo = new ProcessStartInfo ( ) {
94- FileName = lazyPathToNmap . Value ,
94+ FileName = lazyPathToNmapCommand . Value ,
9595 Arguments = nmapCommandOptions ,
9696 RedirectStandardOutput = true ,
9797 RedirectStandardError = true ,
0 commit comments