about summary refs log tree commit diff
diff options
context:
space:
mode:
authorArmijn Hemel <armijnhemel@users.noreply.github.com>2021-09-12 21:53:15 +0200
committerGitHub <noreply@github.com>2021-09-12 21:53:15 +0200
commitd5540fa18f9bc7e914e9b48d462c5cddfc7fb013 (patch)
tree6e77d1513e91b9da3aa66d50e5e166e10bd531f3
parent03f2cae1bb2741ee54b7d1bd85d26e03dd45ed01 (diff)
downloadnixlib-d5540fa18f9bc7e914e9b48d462c5cddfc7fb013.tar
nixlib-d5540fa18f9bc7e914e9b48d462c5cddfc7fb013.tar.gz
nixlib-d5540fa18f9bc7e914e9b48d462c5cddfc7fb013.tar.bz2
nixlib-d5540fa18f9bc7e914e9b48d462c5cddfc7fb013.tar.lz
nixlib-d5540fa18f9bc7e914e9b48d462c5cddfc7fb013.tar.xz
nixlib-d5540fa18f9bc7e914e9b48d462c5cddfc7fb013.tar.zst
nixlib-d5540fa18f9bc7e914e9b48d462c5cddfc7fb013.zip
telfhash: unstable-2021-01-29 -> 0.9.8 (#137305)
* telfhash: unstable-2021-01-29 -> 0.9.8

* Update pkgs/development/python-modules/telfhash/default.nix

Co-authored-by: Sandro <sandro.jaeckel@gmail.com>

* Update pkgs/development/python-modules/telfhash/default.nix

Co-authored-by: Sandro <sandro.jaeckel@gmail.com>

* Update pkgs/development/python-modules/telfhash/default.nix

Co-authored-by: Sandro <sandro.jaeckel@gmail.com>

* telfhash: fix indent style

* Update pkgs/development/python-modules/telfhash/default.nix

Co-authored-by: Sandro <sandro.jaeckel@gmail.com>

* Update pkgs/development/python-modules/telfhash/default.nix

Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
-rw-r--r--pkgs/development/python-modules/telfhash/default.nix16
-rw-r--r--pkgs/development/python-modules/telfhash/telfhash-new-tlsh-hash.patch30
2 files changed, 9 insertions, 37 deletions
diff --git a/pkgs/development/python-modules/telfhash/default.nix b/pkgs/development/python-modules/telfhash/default.nix
index ddb265bf033a..86386ad48a90 100644
--- a/pkgs/development/python-modules/telfhash/default.nix
+++ b/pkgs/development/python-modules/telfhash/default.nix
@@ -2,32 +2,34 @@
 , buildPythonPackage
 , fetchFromGitHub
 , capstone
+, packaging
 , pyelftools
 , tlsh
 , nose
 }:
-buildPythonPackage {
+buildPythonPackage rec {
   pname = "telfhash";
-  version = "unstable-2021-01-29";
+  version = "0.9.8";
 
   src = fetchFromGitHub {
     owner = "trendmicro";
     repo = "telfhash";
-    rev = "b5e398e59dc25a56a28861751c1fccc74ef71617";
-    sha256 = "jNu6qm8Q/UyJVaCqwFOPX02xAR5DwvCK3PaH6Fvmakk=";
+    rev = "v${version}";
+    sha256 = "124zajv43wx9l8rvdvmzcnbh0xpzmbn253pznpbjwvygfx16gq02";
   };
 
-  patches = [ ./telfhash-new-tlsh-hash.patch ];
-
   # The tlsh library's name is just "tlsh"
   postPatch = ''
-    substituteInPlace requirements.txt --replace "python-tlsh" "tlsh"
+    substituteInPlace requirements.txt \
+       --replace "python-tlsh" "tlsh" \
+       --replace "py-tlsh" "tlsh"
   '';
 
   propagatedBuildInputs = [
     capstone
     pyelftools
     tlsh
+    packaging
   ];
 
   checkInputs = [
diff --git a/pkgs/development/python-modules/telfhash/telfhash-new-tlsh-hash.patch b/pkgs/development/python-modules/telfhash/telfhash-new-tlsh-hash.patch
deleted file mode 100644
index 3984a4c1e810..000000000000
--- a/pkgs/development/python-modules/telfhash/telfhash-new-tlsh-hash.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-diff --git a/telfhash/grouping.py b/telfhash/grouping.py
-index c62f8d9..4ee9f0b 100644
---- a/telfhash/grouping.py
-+++ b/telfhash/grouping.py
-@@ -32,10 +32,10 @@ import tlsh
- def get_combination(telfhash_data):
- 
-     #
--    # TLSH hash is 70 characters long. if the telfhash is not 70
-+    # The new TLSH hash is 72 characters long. if the telfhash is not 72
-     # characters in length, exclude from the list
-     #
--    files_list = [x for x in list(telfhash_data.keys()) if telfhash_data[x]["telfhash"] is not None and len(telfhash_data[x]["telfhash"]) == 70]
-+    files_list = [x for x in list(telfhash_data.keys()) if telfhash_data[x]["telfhash"] is not None and len(telfhash_data[x]["telfhash"]) == 72]
- 
-     #
-     # get the combination of all the possible pairs of filenames
-diff --git a/telfhash/telfhash.py b/telfhash/telfhash.py
-index f2bbd25..c6e346c 100755
---- a/telfhash/telfhash.py
-+++ b/telfhash/telfhash.py
-@@ -132,7 +132,7 @@ def get_hash(symbols_list):
-     symbol_string = ",".join(symbols_list)
-     encoded_symbol_string = symbol_string.encode("ascii")
- 
--    return tlsh.forcehash(encoded_symbol_string).lower()
-+    return tlsh.forcehash(encoded_symbol_string)
- 
- 
- def elf_get_imagebase(elf):