diff --git a/pkgs/by-name/gr/grap/package.nix b/pkgs/by-name/gr/grap/package.nix new file mode 100644 index 000000000000..556857150040 --- /dev/null +++ b/pkgs/by-name/gr/grap/package.nix @@ -0,0 +1,83 @@ +{ + lib, + stdenv, + fetchFromGitHub, + boost, + libseccomp, + flex, + swig, + bison, + cmake, + python3Packages, + makeShellWrapper, +}: + +python3Packages.buildPythonApplication rec { + pname = "grap"; + version = "1.3.1"; + pyproject = false; + + src = fetchFromGitHub { + owner = "QuoSecGmbH"; + repo = "grap"; + rev = "refs/tags/v${version}"; + hash = "sha256-zLIKoNOdrmTyZkQGRogeKfIRk4kpG0hmeN0519SJbbo="; + }; + + dependencies = with python3Packages; [ + setuptools + capstone + ]; + + nativeBuildInputs = [ + bison + cmake + flex + swig + makeShellWrapper + ]; + + buildInputs = [ + boost.all + libseccomp + ]; + + strictDeps = true; + + cmakeFlags = [ + "-DPYTHON_SITE_DIR=${placeholder "out"}/${python3Packages.python.sitePackages}" + "../src" + ]; + + postPatch = '' + substituteInPlace src/tools/grap-match/CMakeLists.txt --replace-fail "/usr/local/bin" "$out/bin" + + substituteInPlace src/tools/grap/CMakeLists.txt --replace-fail "/usr/local/bin" "$out/bin" + + substituteInPlace src/bindings/python/CMakeLists.txt --replace-fail "distutils" "setuptools._distutils" + + substituteInPlace src/tools/setup.py --replace-fail "distutils.core" "setuptools" + ''; + + postInstall = '' + cd $out/${python3Packages.python.sitePackages} + mv pygrap.so _pygrap.so + substituteInPlace pygrap.py \ + --replace-fail "import imp" "import importlib" \ + --replace-fail "imp." "importlib." + ''; + + meta = { + description = "Define and match graph patterns within binaries"; + longDescription = '' + grap takes patterns and binary files, uses a Casptone-based disassembler to obtain the control flow graphs from the binaries, then matches the patterns against them. + + Patterns are user-defined graphs with instruction conditions ("opcode is xor and arg1 is eax") and repetition conditions (3 identical instructions, basic blocks...). + ''; + homepage = "https://github.com/QuoSecGmbH/grap/"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ s1341 ]; + platforms = lib.platforms.linux; + mainProgram = "grap"; + }; +} diff --git a/pkgs/tools/security/grap/default.nix b/pkgs/tools/security/grap/default.nix deleted file mode 100644 index 7f8d931fbb6a..000000000000 --- a/pkgs/tools/security/grap/default.nix +++ /dev/null @@ -1,51 +0,0 @@ -{ lib, stdenv, fetchFromGitHub, boost, libseccomp, flex, swig, bison, cmake, python3 }: - -stdenv.mkDerivation rec { - pname = "grap"; - version = "1.3.1"; - - src = fetchFromGitHub { - owner = "QuoSecGmbH"; - repo = "grap"; - rev = "v${version}"; - sha256 = "1fkdi7adfffxg1k4h6r9i69i3wi93s44c1j4cvr69blxsfh0mcnc"; - }; - - nativeBuildInputs = [ - bison - cmake - flex - python3 - swig - ]; - - buildInputs = [ - boost.all - libseccomp - ]; - - strictDeps = true; - - cmakeFlags = [ - "-DPYTHON_SITE_DIR=$out/${python3.sitePackages}" - "../src" - ]; - - postPatch = '' - substituteInPlace src/tools/grap-match/CMakeLists.txt --replace "/usr/local/bin" "$out/bin" - substituteInPlace src/tools/grap/CMakeLists.txt --replace "/usr/local/bin" "$out/bin" - ''; - - meta = with lib; { - description = "Define and match graph patterns within binaries"; - longDescription = '' - grap takes patterns and binary files, uses a Casptone-based disassembler to obtain the control flow graphs from the binaries, then matches the patterns against them. - - Patterns are user-defined graphs with instruction conditions ("opcode is xor and arg1 is eax") and repetition conditions (3 identical instructions, basic blocks...). - ''; - homepage = "https://github.com/QuoSecGmbH/grap/"; - license = licenses.mit; - maintainers = [ maintainers.s1341 ]; - platforms = platforms.linux; - }; -} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 2d9fe748af3c..cacc8bd1939e 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -36586,8 +36586,6 @@ with pkgs; gplates = libsForQt5.callPackage ../applications/science/misc/gplates { }; - grap = callPackage ../tools/security/grap { }; - gravit = callPackage ../applications/science/astronomy/gravit { }; golly = callPackage ../applications/science/misc/golly {