@@ -0,0 +1,49 @@
1+{ lib
2+, buildPythonPackage
3+, fetchFromGitHub
4+, capstone
5+, pyelftools
6+, tlsh
7+, nose
8+}:
9+buildPythonPackage {
10+ pname = "telfhash";
11+ version = "unstable-2021-01-29";
12+
13+ src = fetchFromGitHub {
14+ owner = "trendmicro";
15+ repo = "telfhash";
16+ rev = "b5e398e59dc25a56a28861751c1fccc74ef71617";
17+ sha256 = "jNu6qm8Q/UyJVaCqwFOPX02xAR5DwvCK3PaH6Fvmakk=";
18+ };
19+
20+ # The tlsh library's name is just "tlsh"
21+ postPatch = ''
22+ substituteInPlace requirements.txt --replace "python-tlsh" "tlsh"
23+ '';
24+
25+ propagatedBuildInputs = [
26+ capstone
27+ pyelftools
28+ tlsh
29+ ];
30+
31+ checkInputs = [
32+ nose
33+ ];
34+
35+ checkPhase = ''
36+ nosetests
37+ '';
38+
39+ pythonImportsCheck = [
40+ "telfhash"
41+ ];
42+
43+ meta = with lib; {
44+ description = "Symbol hash for ELF files";
45+ homepage = "https://github.com/trendmicro/telfhash";
46+ license = licenses.asl20;
47+ maintainers = teams.determinatesystems.members;
48+ };
49+}