From 0dfea440014b4e1701fd42a20c45f4d8992c00bb Mon Sep 17 00:00:00 2001 From: Hannah Ward Date: Mon, 21 Nov 2016 11:57:04 +0000 Subject: [PATCH 1/9] Use SpooledTemp, not NamedTemp file --- misp_modules/modules/import_mod/stiximport.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/misp_modules/modules/import_mod/stiximport.py b/misp_modules/modules/import_mod/stiximport.py index 99e891c..4905cd2 100755 --- a/misp_modules/modules/import_mod/stiximport.py +++ b/misp_modules/modules/import_mod/stiximport.py @@ -2,8 +2,6 @@ import json import re import base64 import hashlib -import tempfile -import os from pymisp.tools import stix @@ -36,16 +34,11 @@ def handler(q=False): if not package: return json.dumps({"success": 0}) - tfile = tempfile.NamedTemporaryFile(mode="w", prefix="STIX", delete=False) - tfile.write(package) - tfile.close() - - pkg = stix.load_stix(tfile.name) + pkg = stix.load_stix(package) for attrib in pkg.attributes: r["results"].append({ "values" : [attrib.value] , "types": [attrib.type], "categories": [attrib.category]}) - os.unlink(tfile.name) return r def introspection(): From 1f49f362050aeaeefc4b562c50d327406fd26704 Mon Sep 17 00:00:00 2001 From: Hannah Ward Date: Mon, 21 Nov 2016 13:05:07 +0000 Subject: [PATCH 2/9] Removed unneeded modules --- misp_modules/modules/import_mod/stiximport.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/misp_modules/modules/import_mod/stiximport.py b/misp_modules/modules/import_mod/stiximport.py index 4905cd2..39ac9dc 100755 --- a/misp_modules/modules/import_mod/stiximport.py +++ b/misp_modules/modules/import_mod/stiximport.py @@ -1,7 +1,5 @@ import json -import re import base64 -import hashlib from pymisp.tools import stix From 454c450abd4ca75ee0bb66246354558478e5ab19 Mon Sep 17 00:00:00 2001 From: Hannah Ward Date: Mon, 21 Nov 2016 13:13:24 +0000 Subject: [PATCH 3/9] Don't cache anything pls travis --- .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index fbe3487..5653c1e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,5 @@ language: python -cache: pip - services: - redis-server From 35538b4e87f711df5fd6ed59dca4a5e36cc15f0c Mon Sep 17 00:00:00 2001 From: Hannah Ward Date: Mon, 21 Nov 2016 14:08:20 +0000 Subject: [PATCH 4/9] Added pymisp to reqs --- REQUIREMENTS | 1 + 1 file changed, 1 insertion(+) diff --git a/REQUIREMENTS b/REQUIREMENTS index 92a84d7..6bb1d47 100644 --- a/REQUIREMENTS +++ b/REQUIREMENTS @@ -12,6 +12,7 @@ pyeupi ipasn-redis asnhistory git+https://github.com/Rafiot/uwhoisd.git@testing#egg=uwhois&subdirectory=client +git+https://github.com/MISP/PyMISP.git#egg=pymisp pillow pytesseract SPARQLWrapper From eb538810acee730f8b29f54242e010ea04682610 Mon Sep 17 00:00:00 2001 From: Hannah Ward Date: Mon, 21 Nov 2016 14:31:48 +0000 Subject: [PATCH 5/9] Maybe it'll take the git repo now? --- REQUIREMENTS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/REQUIREMENTS b/REQUIREMENTS index 6bb1d47..23e1cbe 100644 --- a/REQUIREMENTS +++ b/REQUIREMENTS @@ -12,7 +12,7 @@ pyeupi ipasn-redis asnhistory git+https://github.com/Rafiot/uwhoisd.git@testing#egg=uwhois&subdirectory=client -git+https://github.com/MISP/PyMISP.git#egg=pymisp +git+https://github.com/MISP/PyMISP.git pillow pytesseract SPARQLWrapper From 5372f5029891124a0a8a806bd724f3b658c13684 Mon Sep 17 00:00:00 2001 From: Hannah Ward Date: Mon, 21 Nov 2016 14:43:29 +0000 Subject: [PATCH 6/9] Travis should now use the master branch --- .travis.yml | 6 +++++- REQUIREMENTS | 1 - 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5653c1e..3462f08 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,7 +16,11 @@ install: - pip install codecov - pip install -U -r REQUIREMENTS - pip install . - + # Force travis to use the right pymisp + - git clone https://github.com/MISP/PyMISP.git + - cd PyMISP + - python setup.py install + - cd .. script: - coverage run -m --parallel-mode --source=misp_modules misp_modules.__init__ & - pid=$! diff --git a/REQUIREMENTS b/REQUIREMENTS index 23e1cbe..92a84d7 100644 --- a/REQUIREMENTS +++ b/REQUIREMENTS @@ -12,7 +12,6 @@ pyeupi ipasn-redis asnhistory git+https://github.com/Rafiot/uwhoisd.git@testing#egg=uwhois&subdirectory=client -git+https://github.com/MISP/PyMISP.git pillow pytesseract SPARQLWrapper From d60f4ef4958ad67abe401175b09fa5f65bb9f1d4 Mon Sep 17 00:00:00 2001 From: Hannah Ward Date: Mon, 21 Nov 2016 14:49:05 +0000 Subject: [PATCH 7/9] Use the CIRCL pymisp. Silly @rafiot ;) --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 3462f08..15858f4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,7 +17,7 @@ install: - pip install -U -r REQUIREMENTS - pip install . # Force travis to use the right pymisp - - git clone https://github.com/MISP/PyMISP.git + - git clone https://github.com/CIRCL/PyMISP.git - cd PyMISP - python setup.py install - cd .. From 22f4edd25d541e769d8320210c2ec5a6e5227c2e Mon Sep 17 00:00:00 2001 From: Hannah Ward Date: Mon, 21 Nov 2016 15:07:56 +0000 Subject: [PATCH 8/9] Ok we'll use the dep from misp-stix-converter. Surely this'll work? --- .travis.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 15858f4..5653c1e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,11 +16,7 @@ install: - pip install codecov - pip install -U -r REQUIREMENTS - pip install . - # Force travis to use the right pymisp - - git clone https://github.com/CIRCL/PyMISP.git - - cd PyMISP - - python setup.py install - - cd .. + script: - coverage run -m --parallel-mode --source=misp_modules misp_modules.__init__ & - pid=$! From daa66dd32f13231a5d9de54c4508051187fcdda3 Mon Sep 17 00:00:00 2001 From: Hannah Ward Date: Mon, 21 Nov 2016 15:20:57 +0000 Subject: [PATCH 9/9] Use git for everything we can --- REQUIREMENTS | 2 ++ setup.py | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/REQUIREMENTS b/REQUIREMENTS index 92a84d7..16f5512 100644 --- a/REQUIREMENTS +++ b/REQUIREMENTS @@ -12,6 +12,8 @@ pyeupi ipasn-redis asnhistory git+https://github.com/Rafiot/uwhoisd.git@testing#egg=uwhois&subdirectory=client +git+https://github.com/MISP/MISP-STIX-Converter.git#egg=misp_stix_converter +git+https://github.com/CIRCL/PyMISP.git#egg=pymisp pillow pytesseract SPARQLWrapper diff --git a/setup.py b/setup.py index 0010c05..3bdc180 100644 --- a/setup.py +++ b/setup.py @@ -38,6 +38,5 @@ setup( 'pillow', 'pytesseract', 'shodan', - 'misp_stix_converter' ], )