2021-04-19 01:11:14 +02:00
|
|
|
{ lib
|
2021-06-30 19:42:16 +02:00
|
|
|
, python3
|
2021-04-19 01:11:14 +02:00
|
|
|
, fetchFromGitHub
|
|
|
|
}:
|
2022-07-25 13:28:17 +02:00
|
|
|
let
|
|
|
|
py = python3.override {
|
|
|
|
packageOverrides = final: prev: {
|
|
|
|
# required for networkx 2.5.1
|
|
|
|
decorator = prev.decorator.overridePythonAttrs (o: o // rec {
|
|
|
|
version = "4.4.2";
|
|
|
|
src = o.src.override {
|
|
|
|
inherit version;
|
2023-03-03 03:05:21 +01:00
|
|
|
hash = "sha256-46YvBSAXJEDKDcyCN0kxk4Ljd/N/FAoLme9F/suEv+c=";
|
2022-07-25 13:28:17 +02:00
|
|
|
};
|
|
|
|
});
|
2021-06-30 19:42:16 +02:00
|
|
|
|
2022-07-25 13:28:17 +02:00
|
|
|
# flare-floss requires this exact version (newer versions are incompatible)
|
|
|
|
networkx = prev.networkx.overridePythonAttrs (o: o // rec {
|
|
|
|
version = "2.5.1";
|
|
|
|
src = o.src.override {
|
|
|
|
inherit version;
|
2023-03-03 03:05:21 +01:00
|
|
|
hash = "sha256-EJzVhcrEEpf3EQPDxCrG73N58peI61TLdRvlpmO7I1o=";
|
2022-07-25 13:28:17 +02:00
|
|
|
};
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
in
|
|
|
|
py.pkgs.buildPythonPackage rec {
|
2021-04-19 01:11:14 +02:00
|
|
|
pname = "flare-floss";
|
2023-05-18 17:58:59 +02:00
|
|
|
version = "2.2.0";
|
|
|
|
format = "setuptools";
|
2021-04-19 01:11:14 +02:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2022-07-25 13:28:17 +02:00
|
|
|
owner = "mandiant";
|
2021-04-19 01:11:14 +02:00
|
|
|
repo = "flare-floss";
|
2023-05-18 17:58:59 +02:00
|
|
|
rev = "refs/tags/v${version}";
|
2022-07-25 13:28:17 +02:00
|
|
|
fetchSubmodules = true; # for tests
|
2023-05-18 17:58:59 +02:00
|
|
|
hash = "sha256-Oa0DMl7RKNfA00shcc4y1sNd2OiKCf0sA0EUC5gByBI=";
|
2021-04-19 01:11:14 +02:00
|
|
|
};
|
|
|
|
|
2022-07-25 13:28:17 +02:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace setup.py \
|
|
|
|
--replace "==" ">="
|
|
|
|
|
|
|
|
substituteInPlace floss/main.py \
|
|
|
|
--replace 'sigs_path = os.path.join(get_default_root(), "sigs")' 'sigs_path = "'"$out"'/share/flare-floss/sigs"'
|
|
|
|
'';
|
|
|
|
|
|
|
|
propagatedBuildInputs = with py.pkgs; [
|
|
|
|
halo
|
|
|
|
networkx
|
|
|
|
pydantic
|
2021-04-19 01:11:14 +02:00
|
|
|
tabulate
|
2022-07-25 13:28:17 +02:00
|
|
|
tqdm
|
2021-04-19 01:11:14 +02:00
|
|
|
viv-utils
|
2022-07-25 13:28:17 +02:00
|
|
|
vivisect
|
|
|
|
] ++ viv-utils.optional-dependencies.flirt;
|
2021-04-19 01:11:14 +02:00
|
|
|
|
2023-01-21 13:00:00 +01:00
|
|
|
nativeCheckInputs = with py.pkgs; [
|
2022-07-25 13:28:17 +02:00
|
|
|
pytest-sugar
|
2021-06-30 19:42:16 +02:00
|
|
|
pytestCheckHook
|
2022-07-25 13:28:17 +02:00
|
|
|
pyyaml
|
2021-04-19 01:11:14 +02:00
|
|
|
];
|
|
|
|
|
2022-07-25 13:28:17 +02:00
|
|
|
postInstall = ''
|
|
|
|
mkdir -p $out/share/flare-floss/
|
2023-05-18 17:58:59 +02:00
|
|
|
cp -r floss/sigs $out/share/flare-floss/
|
2022-07-25 13:28:17 +02:00
|
|
|
'';
|
2021-04-19 01:11:14 +02:00
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Automatically extract obfuscated strings from malware";
|
2022-07-25 13:28:17 +02:00
|
|
|
homepage = "https://github.com/mandiant/flare-floss";
|
2023-05-18 17:58:59 +02:00
|
|
|
changelog = "https://github.com/mandiant/flare-floss/releases/tag/v${version}";
|
2021-04-19 01:11:14 +02:00
|
|
|
license = licenses.asl20;
|
2023-05-18 18:37:04 +02:00
|
|
|
mainProgram = "floss";
|
|
|
|
maintainers = with maintainers; [ fab ];
|
2021-04-19 01:11:14 +02:00
|
|
|
};
|
|
|
|
}
|