NetDetector 0.0.4

A daemon which checks for and responds to a given MAC or IP address on the network.

Install-Package NetDetector -Version 0.0.4
dotnet add package NetDetector --version 0.0.4
<PackageReference Include="NetDetector" Version="0.0.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add NetDetector --version 0.0.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

NetDetector

NetDetector is a daemon which checks for and responds to a given MAC or IP address on the network.

Help text

>  NetDetector  -h
Usage: NetDetector [-h] [-v] [-c 'ITEM, ...'] [-d 'ITEM, ...'] [-r RATE]
                   [-C CONNECT-COUNT] [-D DISCONNECT-COUNT]
                   [-i INTERFACE] ADDR
Positional arguments:
  ADDR
        The IP or MAC address to detect.
Optional arguments:
  -h, --help
        Displays this help message and exits.
  -v, --version
        Displays the version.
  -c 'ITEM, ...', --connect 'ITEM, ...'
        The command (with args separated by commas) to run when the MAC address is
          detected on the network.
  -d 'ITEM, ...', --disconnect 'ITEM, ...'
        The command (with args separated by commas) to run when the MAC address is no
          longer detected on the network.
  -r RATE, --rate RATE
        The poll rate in seconds.
        Default: 60
  -C CONNECT-COUNT, --connect-count CONNECT-COUNT
        The number of consecutive connection detections that must elapse before the
          connect command is run.
        Default: 1
  -D DISCONNECT-COUNT, --disconnect-count DISCONNECT-COUNT
        The number of consecutive disconnection detections that must elapse before
          the disconnect command is run.
        Default: 1
  -i INTERFACE, --interface INTERFACE
        The network interface to use as the scope identifier.
        Default: 1

Detection

test.sh

#!/bin/bash

cmd="$1"

if [ "$cmd" = "connect" ]
then
        echo "$NET_DETECTOR_ADDRESS detected"
elif [ "$cmd" = "disconnect" ]
then
        echo "$NET_DETECTOR_ADDRESS not detected"
fi

NetDetector

>  NetDetector fe80::9c11:e50:ad4f:f749 -i eth2 -r 1 -c "./test.sh,connect" -d "./test.sh,disconnect"
(fe80::9c11:e50:ad4f:f749%3) - Watching
(fe80::9c11:e50:ad4f:f749%3) - Not detected
(fe80::9c11:e50:ad4f:f749%3) - Running: ./test.sh disconnect
fe80::9c11:e50:ad4f:f749%3 not detected
(fe80::9c11:e50:ad4f:f749%3) - Detected
(fe80::9c11:e50:ad4f:f749%3) - Running: ./test.sh connect
fe80::9c11:e50:ad4f:f749%3 detected

NetDetector

NetDetector is a daemon which checks for and responds to a given MAC or IP address on the network.

Help text

>  NetDetector  -h
Usage: NetDetector [-h] [-v] [-c 'ITEM, ...'] [-d 'ITEM, ...'] [-r RATE]
                   [-C CONNECT-COUNT] [-D DISCONNECT-COUNT]
                   [-i INTERFACE] ADDR
Positional arguments:
  ADDR
        The IP or MAC address to detect.
Optional arguments:
  -h, --help
        Displays this help message and exits.
  -v, --version
        Displays the version.
  -c 'ITEM, ...', --connect 'ITEM, ...'
        The command (with args separated by commas) to run when the MAC address is
          detected on the network.
  -d 'ITEM, ...', --disconnect 'ITEM, ...'
        The command (with args separated by commas) to run when the MAC address is no
          longer detected on the network.
  -r RATE, --rate RATE
        The poll rate in seconds.
        Default: 60
  -C CONNECT-COUNT, --connect-count CONNECT-COUNT
        The number of consecutive connection detections that must elapse before the
          connect command is run.
        Default: 1
  -D DISCONNECT-COUNT, --disconnect-count DISCONNECT-COUNT
        The number of consecutive disconnection detections that must elapse before
          the disconnect command is run.
        Default: 1
  -i INTERFACE, --interface INTERFACE
        The network interface to use as the scope identifier.
        Default: 1

Detection

test.sh

#!/bin/bash

cmd="$1"

if [ "$cmd" = "connect" ]
then
        echo "$NET_DETECTOR_ADDRESS detected"
elif [ "$cmd" = "disconnect" ]
then
        echo "$NET_DETECTOR_ADDRESS not detected"
fi

NetDetector

>  NetDetector fe80::9c11:e50:ad4f:f749 -i eth2 -r 1 -c "./test.sh,connect" -d "./test.sh,disconnect"
(fe80::9c11:e50:ad4f:f749%3) - Watching
(fe80::9c11:e50:ad4f:f749%3) - Not detected
(fe80::9c11:e50:ad4f:f749%3) - Running: ./test.sh disconnect
fe80::9c11:e50:ad4f:f749%3 not detected
(fe80::9c11:e50:ad4f:f749%3) - Detected
(fe80::9c11:e50:ad4f:f749%3) - Running: ./test.sh connect
fe80::9c11:e50:ad4f:f749%3 detected

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
0.0.4 221 5/20/2018
0.0.3 212 5/20/2018
0.0.2 182 5/20/2018