summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--pkgs/tools/networking/ipgrep/default.nix36
-rw-r--r--pkgs/top-level/all-packages.nix2
2 files changed, 38 insertions, 0 deletions
diff --git a/pkgs/tools/networking/ipgrep/default.nix b/pkgs/tools/networking/ipgrep/default.nix
new file mode 100644
index 000000000000..6052b7d405b5
--- /dev/null
+++ b/pkgs/tools/networking/ipgrep/default.nix
@@ -0,0 +1,36 @@
+{ stdenv, fetchFromGitHub, pythonPackages, makeWrapper }:
+
+pythonPackages.buildPythonApplication rec {
+  version = "1.0";
+  pname = "ipgrep";
+
+  src = fetchFromGitHub {
+    owner = "jedisct1";
+    repo = pname;
+    rev = version;
+    sha256 = "1qaxvbqdalvz05aplhhrg7s4h7yx4clbfd50k46bgavhgcqqv8n3";
+  };
+
+  patchPhase = ''
+    mkdir -p ${pname} 
+    substituteInPlace setup.py \
+      --replace "'scripts': []" "'scripts': { '${pname}.py' }"
+  '';
+
+  propagatedBuildInputs = with pythonPackages; [
+    pycares
+    urllib3
+    requests
+  ];
+
+  meta = with stdenv.lib; {
+    description = "Extract, defang, resolve names and IPs from text";
+    longDescription = ''
+      ipgrep extracts possibly obfuscated host names and IP addresses
+      from text, resolves host names, and prints them, sorted by ASN.
+    '';
+    license = licenses.mit;
+    maintainers = with maintainers; [ leenaars ];
+    platforms = platforms.all;
+  };
+}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index b904540e39fb..7d2694238d8a 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -684,6 +684,8 @@ with pkgs;
 
   imgpatchtools = callPackage ../development/mobile/imgpatchtools { };
 
+  ipgrep = callPackage ../tools/networking/ipgrep { };
+
   lastpass-cli = callPackage ../tools/security/lastpass-cli { };
 
   pacparser = callPackage ../tools/networking/pacparser { };