Das Netzwerk in der Riesaer Str. 32
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
network/nix/lib/subnet.nix

20 lines
494 B

{ pkgs ? import <nixpkgs> {}
}:
{
# List of all IP addresses in a subnet
range = subnet:
import (
pkgs.runCommandLocal "subnet-${subnet}.nix" {
nativeBuildInputs = [ pkgs.nmap ];
} ''
(
echo "["
for i in $(nmap -sL ${pkgs.lib.optionalString (builtins.match ".*:.*" subnet != null) "-6"} ${subnet} -n -oG - | grep Status: | cut -d " " -f 2); do
echo \"$i\"
done
echo "]"
) > $out
''
);
}