about summary refs log tree commit diff
path: root/modules/common/nmap.nix
diff options
context:
space:
mode:
authorAzat Bahawi <azat@bahawi.net>2024-03-31 21:29:27 +0300
committerAzat Bahawi <azat@bahawi.net>2024-03-31 21:29:27 +0300
commit9a5427e3a0c0ccf2a82dc503149a26b23fbd6004 (patch)
treef28beec29deeea36038615a8fb98a810891940b5 /modules/common/nmap.nix
parent2024-03-19 (diff)
2024-03-31
Diffstat (limited to '')
-rw-r--r--modules/common/nmap.nix57
1 files changed, 32 insertions, 25 deletions
diff --git a/modules/common/nmap.nix b/modules/common/nmap.nix
index 85beb21..71b3d0b 100644
--- a/modules/common/nmap.nix
+++ b/modules/common/nmap.nix
@@ -5,9 +5,11 @@
   inputs,
   ...
 }:
-with lib; let
+with lib;
+let
   cfg = config.nixfiles.modules.nmap;
-in {
+in
+{
   options.nixfiles.modules.nmap.enable = mkEnableOption "Nmap";
 
   config = mkIf cfg.enable {
@@ -23,7 +25,10 @@ in {
           ".nmap/scripts/vulscan/vulscan.nse".source = "${inputs.nmap-vulscan}/vulscan.nse";
         };
 
-        packages = with pkgs; [nmap nmap-formatter];
+        packages = with pkgs; [
+          nmap
+          nmap-formatter
+        ];
 
         activation.regenerateNmapScripts = with pkgs; ''
           ${getExe' nmap "nmap"} --script-updatedb
@@ -33,27 +38,29 @@ in {
       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
-              '';
-            });
+            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
+                '';
+              }
+            );
           };
         };
 
@@ -65,7 +72,7 @@ in {
             Persistent = true;
             Unit = "update-nmap-vulscan-lists.service";
           };
-          Install.WantedBy = ["timers.target"];
+          Install.WantedBy = [ "timers.target" ];
         };
       };
     };

Consider giving Nix/NixOS a try! <3