Skip to content

Commit 79442c2

Browse files
committed
fix: [modules] many modules not loaded as python module
1 parent 9e95c0e commit 79442c2

File tree

10 files changed

+117
-13
lines changed

10 files changed

+117
-13
lines changed

documentation/README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1944,23 +1944,24 @@ An expansion hover module to expand information about CVE id using Vulners API.
19441944
19451945
-----
19461946

1947-
#### [Vysion](https://github.com/MISP/misp-modules/tree/main/misp_modules/modules/expansion/vysion.py)
1947+
#### [vysion](https://github.com/MISP/misp-modules/tree/main/misp_modules/modules/expansion/vysion.py)
19481948

19491949
<img src=logos/vysion.png height=60>
19501950

19511951
Module to enrich the information by making use of the Vysion API.
19521952
- **features**:
1953-
>This module gets correlated information from our dark web intelligence database. With this you will get several objects containing information related to, for example, an organization victim of a ransomware attack.
1954-
>MISP objects containing title, link to our webapp and TOR, i2p or clearnet URLs.
1953+
>This module gets correlated information from Byron Labs' dark web intelligence database. With this you will get several objects containing information related to, for example, an organization victim of a ransomware attack.
19551954
- **input**:
1956-
>MISP Attribute which include: company(target-org), country, info, BTC, XMR and DASH address.
1955+
>company(target-org), country, info, BTC, XMR and DASH address.
19571956
- **output**:
19581957
>MISP objects containing title, link to our webapp and TOR, i2p or clearnet URLs.
19591958
- **references**:
1960-
>https://vysion.ai/
1959+
> - https://vysion.ai/
1960+
> - https://developers.vysion.ai/
1961+
> - https://github.com/ByronLabs/vysion-cti/tree/main
19611962
- **requirements**:
1962-
> Vysion python library
1963-
> Vysion API Key
1963+
> - Vysion python library
1964+
> - Vysion API Key
19641965
19651966
-----
19661967

documentation/mkdocs/expansion.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1941,6 +1941,27 @@ An expansion hover module to expand information about CVE id using Vulners API.
19411941
19421942
-----
19431943

1944+
#### [vysion](https://github.com/MISP/misp-modules/tree/main/misp_modules/modules/expansion/vysion.py)
1945+
1946+
<img src=../logos/vysion.png height=60>
1947+
1948+
Module to enrich the information by making use of the Vysion API.
1949+
- **features**:
1950+
>This module gets correlated information from Byron Labs' dark web intelligence database. With this you will get several objects containing information related to, for example, an organization victim of a ransomware attack.
1951+
- **input**:
1952+
>company(target-org), country, info, BTC, XMR and DASH address.
1953+
- **output**:
1954+
>MISP objects containing title, link to our webapp and TOR, i2p or clearnet URLs.
1955+
- **references**:
1956+
> - https://vysion.ai/
1957+
> - https://developers.vysion.ai/
1958+
> - https://github.com/ByronLabs/vysion-cti/tree/main
1959+
- **requirements**:
1960+
> - Vysion python library
1961+
> - Vysion API Key
1962+
1963+
-----
1964+
19441965
#### [whois](https://github.com/MISP/misp-modules/tree/main/misp_modules/modules/expansion/whois.py)
19451966

19461967
Module to query a local instance of uwhois (https://github.com/rafiot/uwhoisd).

misp_modules/modules/expansion/__init__.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,13 @@
1717
'virustotal_public', 'apiosintds', 'urlscan', 'securitytrails', 'apivoid',
1818
'assemblyline_submit', 'assemblyline_query', 'ransomcoindb', 'malwarebazaar',
1919
'lastline_query', 'lastline_submit', 'sophoslabs_intelix', 'cytomic_orion', 'censys_enrich',
20-
'trustar_enrich', 'recordedfuture', 'html_to_markdown', 'socialscan', 'passive-ssh',
20+
'trustar_enrich', 'recordedfuture', 'html_to_markdown', 'socialscan', 'passive_ssh',
2121
'qintel_qsentry', 'mwdb', 'hashlookup', 'mmdb_lookup', 'ipqs_fraud_and_risk_scoring',
22-
'clamav', 'jinja_template_rendering','hyasinsight', 'variotdbs', 'crowdsec',
22+
'clamav', 'jinja_template_rendering', 'hyasinsight', 'variotdbs', 'crowdsec',
2323
'extract_url_components', 'ipinfo', 'whoisfreaks', 'ip2locationio', 'stairwell',
24-
'google_threat_intelligence', 'vulnerability_lookup', 'vysion']
24+
'google_threat_intelligence', 'vulnerability_lookup', 'vysion', 'mcafee_insights_enrich',
25+
'threatfox', 'yeti', 'abuseipdb', 'vmware_nsx', 'sigmf_expand', 'google_safe_browsing',
26+
'google_search']
2527

2628

2729
minimum_required_fields = ('type', 'uuid', 'value')

misp_modules/modules/import_mod/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,7 @@
1616
'cof2misp',
1717
'joe_import',
1818
'taxii21',
19-
'url_import'
19+
'url_import',
20+
'vmray_summary_json_import',
21+
'import_blueprint'
2022
]

tests/test_actions.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import os
2+
import unittest
3+
import requests
4+
5+
6+
class TestActions(unittest.TestCase):
7+
"""Unittest module for action modules"""
8+
def setUp(self):
9+
self.headers = {'Content-Type': 'application/json'}
10+
self.url = "http://127.0.0.1:6666/"
11+
12+
def test_introspection(self):
13+
"""checks if all action modules are offered through the misp-modules service"""
14+
try:
15+
response = requests.get(self.url + "modules")
16+
modules = [module["name"] for module in response.json()]
17+
# list modules in the export_mod folder
18+
export_mod_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', 'misp_modules', 'modules', "action_mod")
19+
module_files = [file[:-3] for file in os.listdir(export_mod_path) if file.endswith(".py") if file not in ['__init__.py']]
20+
missing = []
21+
for module in module_files:
22+
if module not in modules:
23+
missing.append(module)
24+
self.assertEqual(missing, [], f"Missing modules in __init__: {missing}")
25+
finally:
26+
response.connection.close()
27+
28+
29+
if __name__ == "__main__":
30+
unittest.main()

tests/test_expansions.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,22 @@ def get_values(response):
8888
return values[0] if isinstance(values, list) else values
8989
return data['results'][0]['values']
9090

91+
def test_introspection(self):
92+
"""checks if all expansion modules are offered through the misp-modules service"""
93+
try:
94+
response = requests.get(self.url + "modules")
95+
modules = [module["name"] for module in response.json()]
96+
# list modules in the export_mod folder
97+
export_mod_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', 'misp_modules', 'modules', "expansion")
98+
module_files = [file[:-3] for file in os.listdir(export_mod_path) if file.endswith(".py") if file not in ['__init__.py']]
99+
missing = []
100+
for module in module_files:
101+
if module not in modules:
102+
missing.append(module)
103+
self.assertEqual(missing, [], f"Missing modules in __init__: {missing}")
104+
finally:
105+
response.connection.close()
106+
91107
def test_apiosintds(self):
92108
self.skipTest("apiosintds is probably broken")
93109

tests/test_exports.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
"""Test module for the ThreatConnect Export module"""
21
import base64
32
import csv
43
import io
@@ -35,8 +34,11 @@ def test_introspection(self):
3534
# list modules in the export_mod folder
3635
export_mod_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', 'misp_modules', 'modules', "export_mod")
3736
module_files = [file[:-3] for file in os.listdir(export_mod_path) if file.endswith(".py") if file not in ['__init__.py', 'testexport.py']]
37+
missing = []
3838
for module in module_files:
39-
self.assertIn(module, modules)
39+
if module not in modules:
40+
missing.append(module)
41+
self.assertEqual(missing, [], f"Missing modules in __init__: {missing}")
4042
finally:
4143
response.connection.close()
4244

tests/test_imports.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import os
2+
import unittest
3+
import requests
4+
5+
6+
class TestImports(unittest.TestCase):
7+
"""Unittest module for import modules"""
8+
def setUp(self):
9+
self.headers = {'Content-Type': 'application/json'}
10+
self.url = "http://127.0.0.1:6666/"
11+
12+
def test_introspection(self):
13+
"""checks if all import modules are offered through the misp-modules service"""
14+
try:
15+
response = requests.get(self.url + "modules")
16+
modules = [module["name"] for module in response.json()]
17+
# list modules in the export_mod folder
18+
export_mod_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', 'misp_modules', 'modules', "import_mod")
19+
module_files = [file[:-3] for file in os.listdir(export_mod_path) if file.endswith(".py") if file not in ['__init__.py', 'testimport.py']]
20+
missing = []
21+
for module in module_files:
22+
if module not in modules:
23+
missing.append(module)
24+
self.assertEqual(missing, [], f"Missing modules in __init__: {missing}")
25+
finally:
26+
response.connection.close()
27+
28+
29+
if __name__ == "__main__":
30+
unittest.main()

0 commit comments

Comments
 (0)