From b15ff6172901b4bfdd33347c25ac995459327b1a Mon Sep 17 00:00:00 2001 From: Bradley Logan Date: Tue, 24 Oct 2017 13:58:55 -0700 Subject: [PATCH 1/3] Limit length of Sample metadata "filetype" field In rare cases, the "magic" library can return a very long string for a Sample's `filetype` field. This results in an error because the value is too long for MongoDB to index. Truncating the result at 1000 characters to make it fit. --- crits/samples/sample.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crits/samples/sample.py b/crits/samples/sample.py index 567f241bf..d54fd0a97 100755 --- a/crits/samples/sample.py +++ b/crits/samples/sample.py @@ -103,6 +103,8 @@ def _generate_file_metadata(self, data): pass try: self.filetype = magic.from_buffer(data) + if len(self.filetype) > 1000: + self.filetype = self.filetype[0:1000] + '' except: self.filetype = "Unavailable" try: From d1ae2eb5aeeb0368612bbe70b808561cab51530a Mon Sep 17 00:00:00 2001 From: Bradley Logan Date: Fri, 15 Jun 2018 13:06:31 -0700 Subject: [PATCH 2/3] Update .gitignore --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 806741748..044cdd2bc 100755 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -# Common ignores +# Common ignores to ignore *.pyc *.swp *.swo From 83e4e6e274638d25f2a4c841fd393f75eac909f5 Mon Sep 17 00:00:00 2001 From: Bradley Logan Date: Fri, 15 Jun 2018 13:06:59 -0700 Subject: [PATCH 3/3] Update AUTHORS --- AUTHORS | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS b/AUTHORS index 5ba5ed0a4..d915687ad 100644 --- a/AUTHORS +++ b/AUTHORS @@ -9,3 +9,4 @@ Bradley Logan (https://github.com/brlogan) Stephen DiCato (https://github.com/Locker537) Scott J. Roberts (https://github.com/sroberts) Adam Polkosnik (https://github.com/apolkosnik) +Tony Stark