Merge branch 'master' into export_osquery

pull/237/head
Julien Bachmann 4 years ago committed by GitHub
commit 04ba4b34e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      .travis.yml
  2. 29
      README.md
  3. 6
      REQUIREMENTS
  4. 508
      doc/documentation.md
  5. 4
      doc/expansion/asn_history.json
  6. 4
      doc/expansion/circl_passivedns.json
  7. 4
      doc/expansion/circl_passivessl.json
  8. 3
      doc/expansion/countrycode.json
  9. 4
      doc/expansion/crowdstrike_falcon.json
  10. 3
      doc/expansion/cve.json
  11. 4
      doc/expansion/dbl_spamhaus.json
  12. 3
      doc/expansion/dns.json
  13. 4
      doc/expansion/domaintools.json
  14. 4
      doc/expansion/eupi.json
  15. 4
      doc/expansion/farsight_passivedns.json
  16. 3
      doc/expansion/geoip_country.json
  17. 3
      doc/expansion/intelmq_eventdb.json
  18. 3
      doc/expansion/ipasn.json
  19. 3
      doc/expansion/iprep.json
  20. 4
      doc/expansion/onyphe.json
  21. 4
      doc/expansion/onyphe_full.json
  22. 4
      doc/expansion/otx.json
  23. 4
      doc/expansion/passivetotal.json
  24. 4
      doc/expansion/rbl.json
  25. 3
      doc/expansion/reversedns.json
  26. 4
      doc/expansion/shodan.json
  27. 3
      doc/expansion/sourcecache.json
  28. 4
      doc/expansion/threatcrowd.json
  29. 4
      doc/expansion/threatminer.json
  30. 4
      doc/expansion/virustotal.json
  31. 4
      doc/expansion/vmray_submit.json
  32. 4
      doc/expansion/vulndb.json
  33. 4
      doc/expansion/whois.json
  34. 4
      doc/expansion/wiki.json
  35. 4
      doc/expansion/xforceexchange.json
  36. 4
      doc/expansion/yara_syntax_validator.json
  37. 8
      doc/export_mod/cef_export.json
  38. 9
      doc/export_mod/goamlexport.json
  39. 8
      doc/export_mod/liteexport.json
  40. 8
      doc/export_mod/pdfexport.json
  41. 3
      doc/export_mod/testexport.json
  42. 9
      doc/export_mod/threatStream_misp_export.json
  43. 9
      doc/export_mod/threat_connect_export.json
  44. 37
      doc/generate_documentation.py
  45. 8
      doc/import_mod/csvimport.json
  46. 9
      doc/import_mod/cuckooimport.json
  47. 8
      doc/import_mod/email_import.json
  48. 9
      doc/import_mod/goamlimport.json
  49. 8
      doc/import_mod/mispjson.json
  50. 8
      doc/import_mod/ocr.json
  51. 8
      doc/import_mod/openiocimport.json
  52. 8
      doc/import_mod/threatanalyzer_import.json
  53. 9
      doc/import_mod/vmray_import.json
  54. BIN
      doc/logos/Sigma.png
  55. BIN
      doc/logos/crowdstrike.png
  56. BIN
      doc/logos/cuckoo.png
  57. BIN
      doc/logos/domaintools.png
  58. BIN
      doc/logos/eupi.png
  59. BIN
      doc/logos/farsight.png
  60. BIN
      doc/logos/goAML.jpg
  61. BIN
      doc/logos/onyphe.jpg
  62. BIN
      doc/logos/otx.png
  63. BIN
      doc/logos/passivedns.png
  64. BIN
      doc/logos/passivessl.png
  65. BIN
      doc/logos/passivetotal.png
  66. BIN
      doc/logos/securitytrails.png
  67. BIN
      doc/logos/shodan.png
  68. BIN
      doc/logos/spamhaus.jpg
  69. BIN
      doc/logos/stix.png
  70. BIN
      doc/logos/threatconnect.png
  71. BIN
      doc/logos/threatcrowd.png
  72. BIN
      doc/logos/threatminer.png
  73. BIN
      doc/logos/threatstream.png
  74. BIN
      doc/logos/virustotal.png
  75. BIN
      doc/logos/vmray.png
  76. BIN
      doc/logos/vulndb.png
  77. BIN
      doc/logos/wikidata.png
  78. BIN
      doc/logos/xforce.png
  79. BIN
      doc/logos/yara.png
  80. 2
      misp_modules/__init__.py
  81. 2
      misp_modules/modules/expansion/__init__.py
  82. 60
      misp_modules/modules/expansion/dbl_spamhaus.py
  83. 126
      misp_modules/modules/expansion/macaddress_io.py
  84. 0
      misp_modules/modules/expansion/module.py.skeleton
  85. 35
      misp_modules/modules/expansion/otx.py
  86. 7
      misp_modules/modules/expansion/rbl.py
  87. 566
      misp_modules/modules/expansion/securitytrails.py
  88. 50
      misp_modules/modules/expansion/sigma_queries.py
  89. 35
      misp_modules/modules/expansion/sigma_syntax_validator.py
  90. 42
      misp_modules/modules/expansion/stix2_pattern_syntax_validator.py
  91. 265
      misp_modules/modules/expansion/urlscan.py
  92. 313
      misp_modules/modules/expansion/virustotal.py
  93. 65
      misp_modules/modules/expansion/vulners.py
  94. 2
      misp_modules/modules/expansion/yara_syntax_validator.py
  95. 2
      misp_modules/modules/export_mod/__init__.py
  96. 14
      misp_modules/modules/export_mod/goamlexport.py
  97. 3
      misp_modules/modules/import_mod/__init__.py
  98. 69
      misp_modules/modules/import_mod/ocr.py
  99. 57
      misp_modules/modules/import_mod/threatanalyzer_import.py

@ -6,11 +6,11 @@ services:
cache: pip
python:
- "3.4"
- "3.5"
- "3.5-dev"
- "3.6"
- "3.6-dev"
- "3.7-dev"
install:
- pip install -U nose codecov pytest

@ -23,6 +23,7 @@ For more information: [Extending MISP with Python modules](https://www.circl.lu/
* [countrycode](misp_modules/modules/expansion/countrycode.py) - a hover module to tell you what country a URL belongs to.
* [CrowdStrike Falcon](misp_modules/modules/expansion/crowdstrike_falcon.py) - an expansion module to expand using CrowdStrike Falcon Intel Indicator API.
* [CVE](misp_modules/modules/expansion/cve.py) - a hover module to give more information about a vulnerability (CVE).
* [DBL Spamhaus](misp_modules/modules/expansion/dbl_spamhaus.py) - a hover module to check Spamhaus DBL for a domain name.
* [DNS](misp_modules/modules/expansion/dns.py) - a simple module to resolve MISP attributes like hostname and domain to expand IP addresses attributes.
* [DomainTools](misp_modules/modules/expansion/domaintools.py) - a hover and expansion module to get information from [DomainTools](http://www.domaintools.com/) whois.
* [EUPI](misp_modules/modules/expansion/eupi.py) - a hover and expansion module to get information about an URL from the [Phishing Initiative project](https://phishing-initiative.eu/?lang=en).
@ -30,15 +31,26 @@ For more information: [Extending MISP with Python modules](https://www.circl.lu/
* [GeoIP](misp_modules/modules/expansion/geoip_country.py) - a hover and expansion module to get GeoIP information from geolite/maxmind.
* [hashdd](misp_modules/modules/expansion/hashdd.py) - a hover module to check file hashes against [hashdd.com](http://www.hashdd.com) including NSLR dataset.
* [IPASN](misp_modules/modules/expansion/ipasn.py) - a hover and expansion to get the BGP ASN of an IP address.
* [iprep](misp-modules/modules/expansion/iprep.py) - an expansion module to get IP reputation from packetmail.net.
* [iprep](misp_modules/modules/expansion/iprep.py) - an expansion module to get IP reputation from packetmail.net.
* [macaddress.io](misp_modules/modules/expansion/macaddress_io.py) - a hover module to retrieve vendor details and other information regarding a given MAC address or an OUI from [MAC address Vendor Lookup](https://macaddress.io). See [integration tutorial here](https://macaddress.io/integrations/MISP-module).
* [onyphe](misp_modules/modules/expansion/onyphe.py) - a modules to process queries on Onyphe.
* [onyphe_full](misp_modules/modules/expansion/onyphe_full.py) - a modules to process full queries on Onyphe.
* [OTX](misp_modules/modules/expansion/otx.py) - an expansion module for [OTX](https://otx.alienvault.com/).
* [passivetotal](misp_modules/modules/expansion/passivetotal.py) - a [passivetotal](https://www.passivetotal.org/) module that queries a number of different PassiveTotal datasets.
* [rbl](misp_modules/modules/expansion/rbl.py) - a module to get RBL (Real-Time Blackhost List) values from an attribute.
* [reversedns](misp_modules/modules/expansion/reversedns.py) - Simple Reverse DNS expansion service to resolve reverse DNS from MISP attributes.
* [securitytrails](misp_modules/modules/expansion/securitytrails.py) - an expansion module for [securitytrails](https://securitytrails.com/).
* [shodan](misp_modules/modules/expansion/shodan.py) - a minimal [shodan](https://www.shodan.io/) expansion module.
* [Sigma queries](misp_modules/modules/expansion/sigma_queries.py) - Experimental expansion module querying a sigma rule to convert it into all the available SIEM signatures.
* [Sigma syntax validator](misp_modules/modules/expansion/sigma_syntax_validator.py) - Sigma syntax validator.
* [sourcecache](misp_modules/modules/expansion/sourcecache.py) - a module to cache a specific link from a MISP instance.
* [STIX2 pattern syntax validator](misp_modules/modules/expansion/stix2_pattern_syntax_validator.py) - a module to check a STIX2 pattern syntax.
* [ThreatCrowd](misp_modules/modules/expansion/threatcrowd.py) - an expansion module for [ThreatCrowd](https://www.threatcrowd.org/).
* [threatminer](misp_modules/modules/expansion/threatminer.py) - an expansion module to expand from [ThreatMiner](https://www.threatminer.org/).
* [virustotal](misp_modules/modules/expansion/virustotal.py) - an expansion module to pull known resolutions and malware samples related with an IP/Domain from virusTotal (this modules require a VirusTotal private API key)
* [VMray](misp_modules/modules/expansion/vmray_submit.py) - a module to submit a sample to VMray.
* [VulnDB](misp_modules/modules/expansion/vulndb.py) - a module to query [VulnDB](https://www.riskbasedsecurity.com/).
* [whois](misp_modules/modules/expansion) - a module to query a local instance of [uwhois](https://github.com/rafiot/uwhoisd).
* [wikidata](misp_modules/modules/expansion/wiki.py) - a [wikidata](https://www.wikidata.org) expansion module.
* [xforce](misp_modules/modules/expansion/xforceexchange.py) - an IBM X-Force Exchange expansion module.
* [YARA syntax validator](misp_modules/modules/expansion/yara_syntax_validator.py) - YARA syntax validator.
@ -373,7 +385,7 @@ Recommended Plugin.Import_ocr_enabled true Enable or disable the ocr
In this same menu set any other plugin settings that are required for testing.
## Install misp-module on an offline instance.
First, you need to grab all necessery packages for example like this :
First, you need to grab all necessary packages for example like this :
Use pip wheel to create an archive
~~~
@ -381,7 +393,7 @@ mkdir misp-modules-offline
pip3 wheel -r REQUIREMENTS shodan --wheel-dir=./misp-modules-offline
tar -cjvf misp-module-bundeled.tar.bz2 ./misp-modules-offline/*
~~~
On offline machine :
On offline machine :
~~~
mkdir misp-modules-bundle
tar xvf misp-module-bundeled.tar.bz2 -C misp-modules-bundle
@ -440,3 +452,14 @@ cd tests/
curl -s http://127.0.0.1:6666/query -H "Content-Type: application/json" --data @MY_TEST_FILE.json -X POST
cd ../
~~~
## Documentation
In order to provide documentation about some modules that require specific input / output / configuration, the [doc](doc) directory contains detailed information about the general purpose, requirements, features, input and ouput of each of these modules:
- ***description** - quick description of the general purpose of the module, as the one given by the moduleinfo
- **requirements** - special libraries needed to make the module work
- **features** - description of the way to use the module, with the required MISP features to make the module give the intended result
- **references** - link(s) giving additional information about the format concerned in the module
- **input** - description of the format of data used in input
- **output** - description of the format given as the result of the module execution

@ -12,11 +12,17 @@ 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/sebdraven/pyonyphe#egg=pyonyphe
git+https://github.com/sebdraven/pydnstrails#egg=pydnstrails
pillow
pytesseract
wand
SPARQLWrapper
domaintools_api
pygeoip
bs4
oauth2
yara
sigmatools
stix2-patterns
maclookup
vulners

@ -0,0 +1,508 @@
# MISP modules documentation
## Expansion Modules
#### [asn_history](https://github.com/MISP/misp-modules/tree/master/misp_modules/modules/expansion/asn_history.py)
Query an ASN description history service (https://github.com/CIRCL/ASN-Description-History.git).
- **requirements**:
>asnhistory
-----
#### [circl_passivedns](https://github.com/MISP/misp-modules/tree/master/misp_modules/modules/expansion/circl_passivedns.py)
<img src=logos/passivedns.png height=60>
Module to access CIRCL Passive DNS.
-----
#### [circl_passivessl](https://github.com/MISP/misp-modules/tree/master/misp_modules/modules/expansion/circl_passivessl.py)
<img src=logos/passivessl.png height=60>
Modules to access CIRCL Passive SSL.
-----
#### [countrycode](https://github.com/MISP/misp-modules/tree/master/misp_modules/modules/expansion/countrycode.py)
Module to expand country codes.
-----
#### [crowdstrike_falcon](https://github.com/MISP/misp-modules/tree/master/misp_modules/modules/expansion/crowdstrike_falcon.py)
<img src=logos/crowdstrike.png height=60>
Module to query Crowdstrike Falcon.
-----
#### [cve](https://github.com/MISP/misp-modules/tree/master/misp_modules/modules/expansion/cve.py)
An expansion hover module to expand information about CVE id.
-----
#### [dbl_spamhaus](https://github.com/MISP/misp-modules/tree/master/misp_modules/modules/expansion/dbl_spamhaus.py)
<img src=logos/spamhaus.jpg height=60>
Module to check Spamhaus DBL for a domain name.
-----
#### [dns](https://github.com/MISP/misp-modules/tree/master/misp_modules/modules/expansion/dns.py)
A simple DNS expansion service to resolve IP address from MISP attributes.
-----
#### [domaintools](https://github.com/MISP/misp-modules/tree/master/misp_modules/modules/expansion/domaintools.py)
<img src=logos/domaintools.png height=60>
DomainTools MISP expansion module.
-----
#### [eupi](https://github.com/MISP/misp-modules/tree/master/misp_modules/modules/expansion/eupi.py)
<img src=logos/eupi.png height=60>
A module to query the Phishing Initiative service (https://phishing-initiative.lu).
-----
#### [farsight_passivedns](https://github.com/MISP/misp-modules/tree/master/misp_modules/modules/expansion/farsight_passivedns.py)
<img src=logos/farsight.png height=60>
Module to access Farsight DNSDB Passive DNS.
-----
#### [geoip_country](https://github.com/MISP/misp-modules/tree/master/misp_modules/modules/expansion/geoip_country.py)
Module to query a local copy of Maxminds Geolite database.
-----
#### [intelmq_eventdb](https://github.com/MISP/misp-modules/tree/master/misp_modules/modules/expansion/intelmq_eventdb.py)
Module to access intelmqs eventdb.
-----
#### [ipasn](https://github.com/MISP/misp-modules/tree/master/misp_modules/modules/expansion/ipasn.py)
Module to query an IP ASN history service (https://github.com/CIRCL/IP-ASN-history.git).
-----
#### [iprep](https://github.com/MISP/misp-modules/tree/master/misp_modules/modules/expansion/iprep.py)
Module to query IPRep data for IP addresses.
-----
#### [onyphe](https://github.com/MISP/misp-modules/tree/master/misp_modules/modules/expansion/onyphe.py)
<img src=logos/onyphe.jpg height=60>
Module to process a query on Onyphe.
-----
#### [onyphe_full](https://github.com/MISP/misp-modules/tree/master/misp_modules/modules/expansion/onyphe_full.py)
<img src=logos/onyphe.jpg height=60>
Module to process a full query on Onyphe.
-----
#### [otx](https://github.com/MISP/misp-modules/tree/master/misp_modules/modules/expansion/otx.py)
<img src=logos/otx.png height=60>
Module to get information from AlienVault OTX.
-----
#### [passivetotal](https://github.com/MISP/misp-modules/tree/master/misp_modules/modules/expansion/passivetotal.py)
<img src=logos/passivetotal.png height=60>
The PassiveTotal MISP expansion module brings the datasets derived from Internet scanning directly into your MISP instance. This module supports passive DNS, historic SSL, WHOIS, and host attributes. In order to use the module, you must have a valid PassiveTotal account username and API key. Registration is free and can be done by visiting https://www.passivetotal.org/register
-----
#### [rbl](https://github.com/MISP/misp-modules/tree/master/misp_modules/modules/expansion/rbl.py)
Module to check an IPv4 address against known RBLs.
- **requirements**:
>dnspython3
-----
#### [reversedns](https://github.com/MISP/misp-modules/tree/master/misp_modules/modules/expansion/reversedns.py)
Simple Reverse DNS expansion service to resolve reverse DNS from MISP attributes.
-----
#### [shodan](https://github.com/MISP/misp-modules/tree/master/misp_modules/modules/expansion/shodan.py)
<img src=logos/shodan.png height=60>
Module to query on Shodan.
-----
#### [sourcecache](https://github.com/MISP/misp-modules/tree/master/misp_modules/modules/expansion/sourcecache.py)
Module to cache web pages of analysis reports, OSINT sources. The module returns a link of the cached page.
-----
#### [threatcrowd](https://github.com/MISP/misp-modules/tree/master/misp_modules/modules/expansion/threatcrowd.py)
<img src=logos/threatcrowd.png height=60>
Module to get information from ThreatCrowd.
-----
#### [threatminer](https://github.com/MISP/misp-modules/tree/master/misp_modules/modules/expansion/threatminer.py)
<img src=logos/threatminer.png height=60>
Module to get information from ThreatMiner.
-----
#### [virustotal](https://github.com/MISP/misp-modules/tree/master/misp_modules/modules/expansion/virustotal.py)
<img src=logos/virustotal.png height=60>
Module to get information from virustotal.
-----
#### [vmray_submit](https://github.com/MISP/misp-modules/tree/master/misp_modules/modules/expansion/vmray_submit.py)
<img src=logos/vmray.png height=60>
Module to submit a sample to VMRay.
-----
#### [vulndb](https://github.com/MISP/misp-modules/tree/master/misp_modules/modules/expansion/vulndb.py)
<img src=logos/vulndb.png height=60>
Module to query VulnDB (RiskBasedSecurity.com).
-----
#### [whois](https://github.com/MISP/misp-modules/tree/master/misp_modules/modules/expansion/whois.py)
Module to query a local instance of uwhois (https://github.com/rafiot/uwhoisd).
- **requirements**:
>uwhois
-----
#### [wiki](https://github.com/MISP/misp-modules/tree/master/misp_modules/modules/expansion/wiki.py)
<img src=logos/wikidata.png height=60>
An expansion hover module to extract information from Wikidata to have additional information about particular term for analysis.
-----
#### [xforceexchange](https://github.com/MISP/misp-modules/tree/master/misp_modules/modules/expansion/xforceexchange.py)
<img src=logos/xforce.png height=60>
An expansion module for IBM X-Force Exchange.
-----
#### [yara_syntax_validator](https://github.com/MISP/misp-modules/tree/master/misp_modules/modules/expansion/yara_syntax_validator.py)
<img src=logos/yara.png height=60>
An expansion hover module to perform a syntax check on if yara rules are valid or not.
-----
## Export Modules
#### [cef_export](https://github.com/MISP/misp-modules/tree/master/misp_modules/modules/export_mod/cef_export.py)
Module to export a MISP event in CEF format.
- **features**:
>The module takes a MISP event in input, to look every attribute. Each attribute matching with some predefined types is then exported in Common Event Format.
>Thus, there is no particular feature concerning MISP Events since any event can be exported. However, 4 configuration parameters recognized by CEF format are required and should be provided by users before exporting data: the device vendor, product and version, as well as the default severity of data.
- **references**:
>https://community.softwaregrp.com/t5/ArcSight-Connectors/ArcSight-Common-Event-Format-CEF-Guide/ta-p/1589306?attachment-id=65537
- **input**:
>MISP Event attributes
- **output**:
>Common Event Format file
-----
#### [goamlexport](https://github.com/MISP/misp-modules/tree/master/misp_modules/modules/export_mod/goamlexport.py)
<img src=logos/goAML.jpg height=60>
This module is used to export MISP events containing transaction objects into GoAML format.
- **requirements**:
>PyMISP, MISP objects
- **features**:
>The module works as long as there is at least one transaction object in the Event.
>
>Then in order to have a valid GoAML document, please follow these guidelines:
>- For each transaction object, use either a bank-account, person, or legal-entity object to describe the origin of the transaction, and again one of them to describe the target of the transaction.
>- Create an object reference for both origin and target objects of the transaction.
>- A bank-account object needs a signatory, which is a person object, put as object reference of the bank-account.
>- A person can have an address, which is a geolocation object, put as object reference of the person.
>
>Supported relation types for object references that are recommended for each object are the folowing:
>- transaction:
> - 'from', 'from_my_client': Origin of the transaction - at least one of them is required.
> - 'to', 'to_my_client': Target of the transaction - at least one of them is required.
> - 'address': Location of the transaction - optional.
>- bank-account:
> - 'signatory': Signatory of a bank-account - the reference from bank-account to a signatory is required, but the relation-type is optional at the moment since this reference will always describe a signatory.
> - 'entity': Entity owning the bank account - optional.
>- person:
> - 'address': Address of a person - optional.
- **references**:
>http://goaml.unodc.org/
- **input**:
>MISP objects (transaction, bank-account, person, legal-entity, geolocation), with references, describing financial transactions and their origin and target.
- **output**:
>GoAML format file, describing financial transactions, with their origin and target (bank accounts, persons or entities).
-----
#### [liteexport](https://github.com/MISP/misp-modules/tree/master/misp_modules/modules/export_mod/liteexport.py)
Lite export of a MISP event.
- **features**:
>This module is simply producing a json MISP event format file, but exporting only Attributes from the Event. Thus, MISP Events exported with this module should have attributes that are not internal references, otherwise the resulting event would be empty.
- **input**:
>MISP Event attributes
- **output**:
>Lite MISP Event
-----
#### [pdfexport](https://github.com/MISP/misp-modules/tree/master/misp_modules/modules/export_mod/pdfexport.py)
Simple export of a MISP event to PDF.
- **requirements**:
>PyMISP, asciidoctor
- **features**:
>The module takes care of the PDF file building, and work with any MISP Event. Except the requirement of asciidoctor, used to create the file, there is no special feature concerning the Event.
- **references**:
>https://acrobat.adobe.com/us/en/acrobat/about-adobe-pdf.html
- **input**:
>MISP Event
- **output**:
>MISP Event in a PDF file.
-----
#### [testexport](https://github.com/MISP/misp-modules/tree/master/misp_modules/modules/export_mod/testexport.py)
Skeleton export module.
-----
#### [threatStream_misp_export](https://github.com/MISP/misp-modules/tree/master/misp_modules/modules/export_mod/threatStream_misp_export.py)
<img src=logos/threatstream.png height=60>
Module to export a structured CSV file for uploading to threatStream.
- **requirements**:
>csv
- **features**:
>The module takes a MISP event in input, to look every attribute. Each attribute matching with some predefined types is then exported in a CSV format recognized by ThreatStream.
- **references**:
>https://www.anomali.com/platform/threatstream, https://github.com/threatstream
- **input**:
>MISP Event attributes
- **output**:
>ThreatStream CSV format file
-----
#### [threat_connect_export](https://github.com/MISP/misp-modules/tree/master/misp_modules/modules/export_mod/threat_connect_export.py)
<img src=logos/threatconnect.png height=60>
Module to export a structured CSV file for uploading to ThreatConnect.
- **requirements**:
>csv
- **features**:
>The module takes a MISP event in input, to look every attribute. Each attribute matching with some predefined types is then exported in a CSV format recognized by ThreatConnect.
>Users should then provide, as module configuration, the source of data they export, because it is required by the output format.
- **references**:
>https://www.threatconnect.com
- **input**:
>MISP Event attributes
- **output**:
>ThreatConnect CSV format file
-----
## Import Modules
#### [csvimport](https://github.com/MISP/misp-modules/tree/master/misp_modules/modules/import_mod/csvimport.py)
Module to import MISP attributes from a csv file.
- **requirements**:
>PyMISP
- **features**:
>In order to parse data from a csv file, a header is required to let the module know which column is matching with known attribute fields / MISP types.
>This header is part of the configuration of the module and should be filled out in MISP plugin settings, each field separated by COMMAS. Fields that do not match with any type known in MISP can be ignored in import, using a space or simply nothing between two separators (example: 'ip-src, , comment, ').
>There is also one type that is confused and can be either a MISP attribute type or an attribute field: 'comment'. In this case, using 'attrComment' specifies that the attribute field 'comment' should be considered, otherwise it will be considered as the MISP attribute type.
>
>For each MISP attribute type, an attribute is created.
>Attribute fields that are imported are the following: value, type, category, to-ids, distribution, comment, tag.
- **references**:
>https://tools.ietf.org/html/rfc4180, https://tools.ietf.org/html/rfc7111
- **input**:
>CSV format file.
- **output**:
>MISP Event attributes
-----
#### [cuckooimport](https://github.com/MISP/misp-modules/tree/master/misp_modules/modules/import_mod/cuckooimport.py)
<img src=logos/cuckoo.png height=60>
Module to import Cuckoo JSON.
- **features**:
>The module simply imports MISP Attributes from a Cuckoo JSON format file. There is thus no special feature to make it work.
- **references**:
>https://cuckoosandbox.org/, https://github.com/cuckoosandbox/cuckoo
- **input**:
>Cuckoo JSON file
- **output**:
>MISP Event attributes
-----
#### [email_import](https://github.com/MISP/misp-modules/tree/master/misp_modules/modules/import_mod/email_import.py)
Module to import emails in MISP.
- **features**:
>This module can be used to import e-mail text as well as attachments and urls.
>3 configuration parameters are then used to unzip attachments, guess zip attachment passwords, and extract urls: set each one of them to True or False to process or not the respective corresponding actions.
- **input**:
>E-mail file
- **output**:
>MISP Event attributes
-----
#### [goamlimport](https://github.com/MISP/misp-modules/tree/master/misp_modules/modules/import_mod/goamlimport.py)
<img src=logos/goAML.jpg height=60>
Module to import MISP objects about financial transactions from GoAML files.
- **requirements**:
>PyMISP
- **features**:
>Unlike the GoAML export module, there is here no special feature to import data from GoAML external files, since the module will import MISP Objects with their References on its own, as it is required for the export module to rebuild a valid GoAML document.
- **references**:
>http://goaml.unodc.org/
- **input**:
>GoAML format file, describing financial transactions, with their origin and target (bank accounts, persons or entities).
- **output**:
>MISP objects (transaction, bank-account, person, legal-entity, geolocation), with references, describing financial transactions and their origin and target.
-----
#### [mispjson](https://github.com/MISP/misp-modules/tree/master/misp_modules/modules/import_mod/mispjson.py)
Module to import MISP JSON format for merging MISP events.
- **features**:
>The module simply imports MISP Attributes from an other MISP Event in order to merge events together. There is thus no special feature to make it work.
- **input**:
>MISP Event
- **output**:
>MISP Event attributes
-----
#### [ocr](https://github.com/MISP/misp-modules/tree/master/misp_modules/modules/import_mod/ocr.py)
Optical Character Recognition (OCR) module for MISP.
- **features**:
>The module tries to recognize some text from an image and import the result as a freetext attribute, there is then no special feature asked to users to make it work.
- **input**:
>Image
- **output**:
>freetext MISP attribute
-----
#### [openiocimport](https://github.com/MISP/misp-modules/tree/master/misp_modules/modules/import_mod/openiocimport.py)
Module to import OpenIOC packages.
- **requirements**:
>PyMISP
- **features**:
>The module imports MISP Attributes from OpenIOC packages, there is then no special feature for users to make it work.
- **references**:
>https://www.fireeye.com/blog/threat-research/2013/10/openioc-basics.html
- **input**:
>OpenIOC packages
- **output**:
>MISP Event attributes
-----
#### [threatanalyzer_import](https://github.com/MISP/misp-modules/tree/master/misp_modules/modules/import_mod/threatanalyzer_import.py)
Module to import ThreatAnalyzer archive.zip / analysis.json files.
- **features**:
>The module imports MISP Attributes from a ThreatAnalyzer format file. This file can be either ZIP, or JSON format.
>There is by the way no special feature for users to make the module work.
- **references**:
>https://www.threattrack.com/malware-analysis.aspx
- **input**:
>ThreatAnalyzer format file
- **output**:
>MISP Event attributes
-----
#### [vmray_import](https://github.com/MISP/misp-modules/tree/master/misp_modules/modules/import_mod/vmray_import.py)
<img src=logos/vmray.png height=60>
Module to import VMRay (VTI) results.
- **requirements**:
>vmray_rest_api
- **features**:
>The module imports MISP Attributes from VMRay format, using the VMRay api.
>Users should then provide as the module configuration the API Key as well as the server url in order to fetch their data to import.
- **references**:
>https://www.vmray.com/
- **input**:
>VMRay format
- **output**:
>MISP Event attributes
-----

@ -0,0 +1,4 @@
{
"description": "Query an ASN description history service (https://github.com/CIRCL/ASN-Description-History.git).",
"requirements": ["asnhistory"]
}

@ -0,0 +1,4 @@
{
"description": "Module to access CIRCL Passive DNS.",
"logo": "logos/passivedns.png"
}

@ -0,0 +1,4 @@
{
"description": "Modules to access CIRCL Passive SSL.",
"logo": "logos/passivessl.png"
}

@ -0,0 +1,3 @@
{
"description": "Module to expand country codes."
}

@ -0,0 +1,4 @@
{
"description": "Module to query Crowdstrike Falcon.",
"logo": "logos/crowdstrike.png"
}

@ -0,0 +1,3 @@
{
"description": "An expansion hover module to expand information about CVE id."
}

@ -0,0 +1,4 @@
{
"description": "Module to check Spamhaus DBL for a domain name.",
"logo": "logos/spamhaus.jpg"
}

@ -0,0 +1,3 @@
{
"description": "A simple DNS expansion service to resolve IP address from MISP attributes."
}

@ -0,0 +1,4 @@
{
"description": "DomainTools MISP expansion module.",
"logo": "logos/domaintools.png"
}

@ -0,0 +1,4 @@
{
"description": "A module to query the Phishing Initiative service (https://phishing-initiative.lu).",
"logo": "logos/eupi.png"
}

@ -0,0 +1,4 @@
{
"description": "Module to access Farsight DNSDB Passive DNS.",
"logo": "logos/farsight.png"
}

@ -0,0 +1,3 @@
{
"description": "Module to query a local copy of Maxminds Geolite database."
}

@ -0,0 +1,3 @@
{
"description": "Module to access intelmqs eventdb."
}

@ -0,0 +1,3 @@
{
"description": "Module to query an IP ASN history service (https://github.com/CIRCL/IP-ASN-history.git)."
}

@ -0,0 +1,3 @@
{
"description": "Module to query IPRep data for IP addresses."
}

@ -0,0 +1,4 @@
{
"description": "Module to process a query on Onyphe.",
"logo": "logos/onyphe.jpg"
}

@ -0,0 +1,4 @@
{
"description": "Module to process a full query on Onyphe.",
"logo": "logos/onyphe.jpg"
}

@ -0,0 +1,4 @@
{
"description": "Module to get information from AlienVault OTX.",
"logo": "logos/otx.png"
}

@ -0,0 +1,4 @@
{
"description": "The PassiveTotal MISP expansion module brings the datasets derived from Internet scanning directly into your MISP instance. This module supports passive DNS, historic SSL, WHOIS, and host attributes. In order to use the module, you must have a valid PassiveTotal account username and API key. Registration is free and can be done by visiting https://www.passivetotal.org/register",
"logo": "logos/passivetotal.png"
}

@ -0,0 +1,4 @@
{
"description": "Module to check an IPv4 address against known RBLs.",
"requirements": ["dnspython3"]
}

@ -0,0 +1,3 @@
{
"description": "Simple Reverse DNS expansion service to resolve reverse DNS from MISP attributes."
}

@ -0,0 +1,4 @@
{
"description": "Module to query on Shodan.",
"logo": "logos/shodan.png"
}

@ -0,0 +1,3 @@
{
"description": "Module to cache web pages of analysis reports, OSINT sources. The module returns a link of the cached page."
}

@ -0,0 +1,4 @@
{
"description": "Module to get information from ThreatCrowd.",
"logo": "logos/threatcrowd.png"
}

@ -0,0 +1,4 @@
{
"description": "Module to get information from ThreatMiner.",
"logo": "logos/threatminer.png"
}

@ -0,0 +1,4 @@
{
"description": "Module to get information from virustotal.",
"logo": "logos/virustotal.png"
}

@ -0,0 +1,4 @@
{
"description": "Module to submit a sample to VMRay.",
"logo": "logos/vmray.png"
}

@ -0,0 +1,4 @@
{
"description": "Module to query VulnDB (RiskBasedSecurity.com).",
"logo": "logos/vulndb.png"
}

@ -0,0 +1,4 @@
{
"description": "Module to query a local instance of uwhois (https://github.com/rafiot/uwhoisd).",
"requirements": ["uwhois"]
}

@ -0,0 +1,4 @@
{
"description": "An expansion hover module to extract information from Wikidata to have additional information about particular term for analysis.",
"logo": "logos/wikidata.png"
}

@ -0,0 +1,4 @@
{
"description": "An expansion module for IBM X-Force Exchange.",
"logo": "logos/xforce.png"
}

@ -0,0 +1,4 @@
{
"description": "An expansion hover module to perform a syntax check on if yara rules are valid or not.",
"logo": "logos/yara.png"
}

@ -0,0 +1,8 @@
{
"description": "Module to export a MISP event in CEF format.",
"requirements": [],
"features": "The module takes a MISP event in input, to look every attribute. Each attribute matching with some predefined types is then exported in Common Event Format.\nThus, there is no particular feature concerning MISP Events since any event can be exported. However, 4 configuration parameters recognized by CEF format are required and should be provided by users before exporting data: the device vendor, product and version, as well as the default severity of data.",
"references": ["https://community.softwaregrp.com/t5/ArcSight-Connectors/ArcSight-Common-Event-Format-CEF-Guide/ta-p/1589306?attachment-id=65537"],
"input": "MISP Event attributes",
"output": "Common Event Format file"
}

@ -0,0 +1,9 @@
{
"description": "This module is used to export MISP events containing transaction objects into GoAML format.",
"logo": "logos/goAML.jpg",
"requirements": ["PyMISP","MISP objects"],
"features": "The module works as long as there is at least one transaction object in the Event.\n\nThen in order to have a valid GoAML document, please follow these guidelines:\n- For each transaction object, use either a bank-account, person, or legal-entity object to describe the origin of the transaction, and again one of them to describe the target of the transaction.\n- Create an object reference for both origin and target objects of the transaction.\n- A bank-account object needs a signatory, which is a person object, put as object reference of the bank-account.\n- A person can have an address, which is a geolocation object, put as object reference of the person.\n\nSupported relation types for object references that are recommended for each object are the folowing:\n- transaction:\n\t- 'from', 'from_my_client': Origin of the transaction - at least one of them is required.\n\t- 'to', 'to_my_client': Target of the transaction - at least one of them is required.\n\t- 'address': Location of the transaction - optional.\n- bank-account:\n\t- 'signatory': Signatory of a bank-account - the reference from bank-account to a signatory is required, but the relation-type is optional at the moment since this reference will always describe a signatory.\n\t- 'entity': Entity owning the bank account - optional.\n- person:\n\t- 'address': Address of a person - optional.",
"references": ["http://goaml.unodc.org/"],
"input": "MISP objects (transaction, bank-account, person, legal-entity, geolocation), with references, describing financial transactions and their origin and target.",
"output": "GoAML format file, describing financial transactions, with their origin and target (bank accounts, persons or entities)."
}

@ -0,0 +1,8 @@
{
"description": "Lite export of a MISP event.",
"requirements": [],
"features": "This module is simply producing a json MISP event format file, but exporting only Attributes from the Event. Thus, MISP Events exported with this module should have attributes that are not internal references, otherwise the resulting event would be empty.",
"references": [],
"input": "MISP Event attributes",
"output": "Lite MISP Event"
}

@ -0,0 +1,8 @@
{
"description": "Simple export of a MISP event to PDF.",
"requirements": ["PyMISP", "asciidoctor"],
"features": "The module takes care of the PDF file building, and work with any MISP Event. Except the requirement of asciidoctor, used to create the file, there is no special feature concerning the Event.",
"references": ["https://acrobat.adobe.com/us/en/acrobat/about-adobe-pdf.html"],
"input": "MISP Event",
"output": "MISP Event in a PDF file."
}

@ -0,0 +1,3 @@
{
"description": "Skeleton export module."
}

@ -0,0 +1,9 @@
{
"description": "Module to export a structured CSV file for uploading to threatStream.",
"logo": "logos/threatstream.png",
"requirements": ["csv"],
"features": "The module takes a MISP event in input, to look every attribute. Each attribute matching with some predefined types is then exported in a CSV format recognized by ThreatStream.",
"references": ["https://www.anomali.com/platform/threatstream", "https://github.com/threatstream"],
"input": "MISP Event attributes",
"output": "ThreatStream CSV format file"
}

@ -0,0 +1,9 @@
{
"description": "Module to export a structured CSV file for uploading to ThreatConnect.",
"logo": "logos/threatconnect.png",
"requirements": ["csv"],
"features": "The module takes a MISP event in input, to look every attribute. Each attribute matching with some predefined types is then exported in a CSV format recognized by ThreatConnect.\nUsers should then provide, as module configuration, the source of data they export, because it is required by the output format.",
"references": ["https://www.threatconnect.com"],
"input": "MISP Event attributes",
"output": "ThreatConnect CSV format file"
}

@ -0,0 +1,37 @@
# -*- coding: utf-8 -*-
import os
import json
module_types = ['expansion', 'export_mod', 'import_mod']
titles = ['Expansion Modules', 'Export Modules', 'Import Modules']
markdown= ["# MISP modules documentation\n"]
githublink = 'https://github.com/MISP/misp-modules/tree/master/misp_modules/modules'
def generate_doc(root_path):
for _path, title in zip(module_types, titles):
markdown.append('\n## {}\n'.format(title))
current_path = os.path.join(root_path, _path)
files = sorted(os.listdir(current_path))
githubpath = '{}/{}'.format(githublink, _path)
for _file in files:
modulename = _file.split('.json')[0]
githubref = '{}/{}.py'.format(githubpath, modulename)
markdown.append('\n#### [{}]({})\n'.format(modulename, githubref))
filename = os.path.join(current_path, _file)
with open(filename, 'rt', encoding='utf-8') as f:
definition = json.loads(f.read())
if 'logo' in definition:
markdown.append('\n<img src={} height=60>\n'.format(definition.pop('logo')))
if 'description' in definition:
markdown.append('\n{}\n'.format(definition.pop('description')))
for field, value in definition.items():
if value:
value = ', '.join(value) if isinstance(value, list) else '{}'.format(value.replace('\n', '\n>'))
markdown.append('- **{}**:\n>{}\n'.format(field, value))
markdown.append('\n-----\n')
with open('documentation.md', 'w') as w:
w.write(''.join(markdown))
if __name__ == '__main__':
root_path = os.path.dirname(os.path.realpath(__file__))
generate_doc(root_path)

@ -0,0 +1,8 @@
{
"description": "Module to import MISP attributes from a csv file.",
"requirements": ["PyMISP"],
"features": "In order to parse data from a csv file, a header is required to let the module know which column is matching with known attribute fields / MISP types.\nThis header is part of the configuration of the module and should be filled out in MISP plugin settings, each field separated by COMMAS. Fields that do not match with any type known in MISP can be ignored in import, using a space or simply nothing between two separators (example: 'ip-src, , comment, ').\nThere is also one type that is confused and can be either a MISP attribute type or an attribute field: 'comment'. In this case, using 'attrComment' specifies that the attribute field 'comment' should be considered, otherwise it will be considered as the MISP attribute type.\n\nFor each MISP attribute type, an attribute is created.\nAttribute fields that are imported are the following: value, type, category, to-ids, distribution, comment, tag.",
"references": ["https://tools.ietf.org/html/rfc4180", "https://tools.ietf.org/html/rfc7111"],
"input": "CSV format file.",
"output": "MISP Event attributes"
}

@ -0,0 +1,9 @@
{
"description": "Module to import Cuckoo JSON.",
"logo": "logos/cuckoo.png",
"requirements": [],
"features": "The module simply imports MISP Attributes from a Cuckoo JSON format file. There is thus no special feature to make it work.",
"references": ["https://cuckoosandbox.org/", "https://github.com/cuckoosandbox/cuckoo"],
"input": "Cuckoo JSON file",
"output": "MISP Event attributes"
}

@ -0,0 +1,8 @@
{
"description": "Module to import emails in MISP.",
"requirements": [],
"features": "This module can be used to import e-mail text as well as attachments and urls.\n3 configuration parameters are then used to unzip attachments, guess zip attachment passwords, and extract urls: set each one of them to True or False to process or not the respective corresponding actions.",
"references": [],
"input": "E-mail file",
"output": "MISP Event attributes"
}

@ -0,0 +1,9 @@
{
"description": "Module to import MISP objects about financial transactions from GoAML files.",
"logo": "logos/goAML.jpg",
"requirements": ["PyMISP"],
"features": "Unlike the GoAML export module, there is here no special feature to import data from GoAML external files, since the module will import MISP Objects with their References on its own, as it is required for the export module to rebuild a valid GoAML document.",
"references": "http://goaml.unodc.org/",
"input": "GoAML format file, describing financial transactions, with their origin and target (bank accounts, persons or entities).",
"output": "MISP objects (transaction, bank-account, person, legal-entity, geolocation), with references, describing financial transactions and their origin and target."
}

@ -0,0 +1,8 @@
{
"description": "Module to import MISP JSON format for merging MISP events.",
"requirements": [],
"features": "The module simply imports MISP Attributes from an other MISP Event in order to merge events together. There is thus no special feature to make it work.",
"references": [],
"input": "MISP Event",
"output": "MISP Event attributes"
}

@ -0,0 +1,8 @@
{
"description": "Optical Character Recognition (OCR) module for MISP.",
"requirements": [],
"features": "The module tries to recognize some text from an image and import the result as a freetext attribute, there is then no special feature asked to users to make it work.",
"references": [],
"input": "Image",
"output": "freetext MISP attribute"
}

@ -0,0 +1,8 @@
{
"description": "Module to import OpenIOC packages.",
"requirements": ["PyMISP"],
"features": "The module imports MISP Attributes from OpenIOC packages, there is then no special feature for users to make it work.",
"references": ["https://www.fireeye.com/blog/threat-research/2013/10/openioc-basics.html"],
"input": "OpenIOC packages",
"output": "MISP Event attributes"
}

@ -0,0 +1,8 @@
{
"description": "Module to import ThreatAnalyzer archive.zip / analysis.json files.",
"requirements": [],
"features": "The module imports MISP Attributes from a ThreatAnalyzer format file. This file can be either ZIP, or JSON format.\nThere is by the way no special feature for users to make the module work.",
"references": ["https://www.threattrack.com/malware-analysis.aspx"],
"input": "ThreatAnalyzer format file",
"output": "MISP Event attributes"
}

@ -0,0 +1,9 @@
{
"description": "Module to import VMRay (VTI) results.",
"logo": "logos/vmray.png",
"requirements": ["vmray_rest_api"],
"features": "The module imports MISP Attributes from VMRay format, using the VMRay api.\nUsers should then provide as the module configuration the API Key as well as the server url in order to fetch their data to import.",
"references": ["https://www.vmray.com/"],
"input": "VMRay format",
"output": "MISP Event attributes"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

@ -193,7 +193,7 @@ class QueryModule(tornado.web.RequestHandler):
if dict_payload.get('timeout'):
timeout = datetime.timedelta(seconds=int(dict_payload.get('timeout')))
else:
timeout = datetime.timedelta(seconds=30)
timeout = datetime.timedelta(seconds=300)
response = yield tornado.gen.with_timeout(timeout, self.run_request(jsonpayload))
self.write(response)
except tornado.gen.TimeoutError:

@ -1,3 +1,3 @@
from . import _vmray
__all__ = ['vmray_submit', 'asn_history', 'circl_passivedns', 'circl_passivessl', 'countrycode', 'cve', 'dns', 'domaintools', 'eupi', 'farsight_passivedns', 'ipasn', 'passivetotal', 'sourcecache', 'virustotal', 'whois', 'shodan', 'reversedns', 'geoip_country', 'wiki', 'iprep', 'threatminer', 'otx', 'threatcrowd', 'vulndb', 'crowdstrike_falcon', 'yara_syntax_validator', 'hashdd']
__all__ = ['vmray_submit', 'asn_history', 'circl_passivedns', 'circl_passivessl', 'countrycode', 'cve', 'dns', 'domaintools', 'eupi', 'farsight_passivedns', 'ipasn', 'passivetotal', 'sourcecache', 'virustotal', 'whois', 'shodan', 'reversedns', 'geoip_country', 'wiki', 'iprep', 'threatminer', 'otx', 'threatcrowd', 'vulndb', 'crowdstrike_falcon', 'yara_syntax_validator', 'hashdd', 'onyphe', 'onyphe_full', 'rbl', 'xforceexchange', 'sigma_syntax_validator', 'stix2_pattern_syntax_validator', 'sigma_queries', 'dbl_spamhaus', 'vulners']

@ -0,0 +1,60 @@
import json
import datetime
from collections import defaultdict
try:
import dns.resolver
resolver = dns.resolver.Resolver()
resolver.timeout = 0.2
resolver.lifetime = 0.2
except ImportError:
print("dnspython3 is missing, use 'pip install dnspython3' to install it.")
sys.exit(0)
misperrors = {'error': 'Error'}
mispattributes = {'input': ['domain', 'domain|ip', 'hostname', 'hostname|port'], 'output': ['text']}
moduleinfo = {'version': '0.1', 'author': 'Christian Studer',
'description': 'Checks Spamhaus DBL for a domain name.',
'module-type': ['expansion', 'hover']}
moduleconfig = []
dbl = 'dbl.spamhaus.org'
dbl_mapping = {'127.0.1.2': 'spam domain',
'127.0.1.4': 'phish domain',
'127.0.1.5': 'malware domain',
'127.0.1.6': 'botnet C&C domain',
'127.0.1.102': 'abused legit spam',
'127.0.1.103': 'abused spammed redirector domain',
'127.0.1.104': 'abused legit phish',
'127.0.1.105': 'abused legit malware',
'127.0.1.106': 'abused legit botnet C&C',
'127.0.1.255': 'IP queries prohibited!'}
def fetch_requested_value(request):
for attribute_type in mispattributes['input']:
if request.get(attribute_type):
return request[attribute_type].split('|')[0]
return None
def handler(q=False):
if q is False:
return False
request = json.loads(q)
requested_value = fetch_requested_value(request)
if requested_value is None:
misperrors['error'] = "Unsupported attributes type"
return misperrors
query = "{}.{}".format(requested_value, dbl)
try:
query_result = resolver.query(query, 'A')[0]
result = "{} - {}".format(requested_value, dbl_mapping[str(query_result)])
except Exception as e:
result = e
return {'results': [{'types': mispattributes.get('output'), 'values': result}]}
def introspection():
return mispattributes
def version():
moduleinfo['config'] = moduleconfig
return moduleinfo

@ -0,0 +1,126 @@
import json
from maclookup import ApiClient, exceptions
misperrors = {
'error': 'Error'
}
mispattributes = {
'input': ['mac-address'],
}
moduleinfo = {
'version': '1.0',
'author': 'CodeLine OY - macaddress.io',
'description': 'MISP hover module for macaddress.io',
'module-type': ['hover']
}
moduleconfig = ['api_key']
def handler(q=False):
if q is False:
return False
request = json.loads(q)
if request.get('mac-address'):
mac_address = request['mac-address']
else:
return False
if request['config'].get('api_key'):
api_key = request['config'].get('api_key')
else:
misperrors['error'] = 'Authorization required'
return misperrors
api_client = ApiClient(api_key)
try:
response = api_client.get(mac_address)
except exceptions.EmptyResponseException:
misperrors['error'] = 'Empty response'
return misperrors
except exceptions.UnparsableResponseException:
misperrors['error'] = 'Unparsable response'
return misperrors
except exceptions.ServerErrorException:
misperrors['error'] = 'Internal server error'
return misperrors
except exceptions.UnknownOutputFormatException:
misperrors['error'] = 'Unknown output'
return misperrors
except exceptions.AuthorizationRequiredException:
misperrors['error'] = 'Authorization required'
return misperrors
except exceptions.AccessDeniedException:
misperrors['error'] = 'Access denied'
return misperrors
except exceptions.InvalidMacOrOuiException:
misperrors['error'] = 'Invalid MAC or OUI'
return misperrors
except exceptions.NotEnoughCreditsException:
misperrors['error'] = 'Not enough credits'
return misperrors
except Exception:
misperrors['error'] = 'Unknown error'
return misperrors
date_created = \
response.block_details.date_created.strftime('%d %B %Y') if response.block_details.date_created else None
date_updated = \
response.block_details.date_updated.strftime('%d %B %Y') if response.block_details.date_updated else None
results = {
'results': [
{'types': ['text'], 'values':
{
# Mac address details
'