diff options
author | Azat Bahawi <azat@bahawi.net> | 2024-04-21 02:15:42 +0300 |
---|---|---|
committer | Azat Bahawi <azat@bahawi.net> | 2024-04-21 02:15:42 +0300 |
commit | e6ed60548397627bf10f561f9438201dbba0a36e (patch) | |
tree | f9a84c5957d2cc4fcd148065ee9365a0c851ae1c /modules/common/nmap.nix | |
parent | 2024-04-18 (diff) |
2024-04-21
Diffstat (limited to 'modules/common/nmap.nix')
-rw-r--r-- | modules/common/nmap.nix | 80 |
1 files changed, 0 insertions, 80 deletions
diff --git a/modules/common/nmap.nix b/modules/common/nmap.nix deleted file mode 100644 index 71b3d0b..0000000 --- a/modules/common/nmap.nix +++ /dev/null @@ -1,80 +0,0 @@ -{ - config, - lib, - pkgs, - inputs, - ... -}: -with lib; -let - cfg = config.nixfiles.modules.nmap; -in -{ - options.nixfiles.modules.nmap.enable = mkEnableOption "Nmap"; - - config = mkIf cfg.enable { - nixfiles.modules.common.shell.aliases = { - nmap-vulners = "nmap -sV --script=vulners/vulners.nse"; - nmap-vulscan = "nmap -sV --script=vulscan/vulscan.nse"; - }; - - hm = { - home = { - file = { - ".nmap/scripts/vulners".source = inputs.nmap-vulners; - ".nmap/scripts/vulscan/vulscan.nse".source = "${inputs.nmap-vulscan}/vulscan.nse"; - }; - - packages = with pkgs; [ - nmap - nmap-formatter - ]; - - activation.regenerateNmapScripts = with pkgs; '' - ${getExe' nmap "nmap"} --script-updatedb - ''; - }; - - systemd.user = { - services.update-nmap-vulscan-lists = { - Service = { - ExecStart = getExe ( - pkgs.writeShellApplication { - name = "update-nmap-vulscan-lists"; - runtimeInputs = [ pkgs.curl ]; - text = '' - declare -a vulscandbs=( - "cve" - "exploitdb" - "openvas" - "osvdb" - "scipvuldb" - "securityfocus" - "securitytracker" - "xforce" - ) - for i in "''${vulscandbs[@]}"; do - curl \ - -o "${config.my.home}/.nmap/scripts/vulscan/$i.csv" \ - "https://www.computec.ch/projekte/vulscan/download/$i.csv" - done - ''; - } - ); - }; - }; - - timers.update-nmap-vulscan-lists = { - # TODO Figure out how to check for network-online.target for user - # timers. - Timer = { - OnCalendar = "daily"; - Persistent = true; - Unit = "update-nmap-vulscan-lists.service"; - }; - Install.WantedBy = [ "timers.target" ]; - }; - }; - }; - }; -} |