mirror of https://github.com/MISP/misp-modules
A minimal caching module added to cache link or url from MISP
parent
2eb6d159f4
commit
5cc07c0203
|
@ -1,3 +1,4 @@
|
||||||
tornado
|
tornado
|
||||||
dnspython3
|
dnspython3
|
||||||
requests
|
requests
|
||||||
|
urlarchiver
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
import json
|
||||||
|
from url_archiver import url_archiver
|
||||||
|
|
||||||
|
misperrors = {'error': 'Error'}
|
||||||
|
mispattributes = {'input': ['link'], 'output': ['link']}
|
||||||
|
moduleinfo = {'version': '0.1', 'author': 'Alexandre Dulaunoy', 'description': 'Module to cache web pages of analysis reports, OSINT sources. The module returns a link of the cached page.'}
|
||||||
|
archive_path = '/tmp/'
|
||||||
|
|
||||||
|
|
||||||
|
def handler(q=False):
|
||||||
|
if q is False:
|
||||||
|
return False
|
||||||
|
request = json.loads(q)
|
||||||
|
if request.get('link'):
|
||||||
|
tocache = request['link']
|
||||||
|
archiver = url_archiver.Archive(archive_path=archive_path)
|
||||||
|
archiver.fetch(url=tocache)
|
||||||
|
mispattributes['output'] = ['link']
|
||||||
|
else:
|
||||||
|
misperrors['error'] = "Link is missing"
|
||||||
|
return misperrors
|
||||||
|
r = {'results': [{'types': mispattributes['output'], 'values': tocache}]}
|
||||||
|
return r
|
||||||
|
|
||||||
|
|
||||||
|
def introspection():
|
||||||
|
return mispattributes
|
||||||
|
|
||||||
|
|
||||||
|
def version():
|
||||||
|
return moduleinfo
|
|
@ -0,0 +1 @@
|
||||||
|
{"module": "sourcecache", "link": "http://cve.circl.lu/" }
|
|
@ -0,0 +1 @@
|
||||||
|
curl -s http://127.0.0.1:6666/query -H "Content-Type: application/json" --data @bodysourcecache.json -X POST
|
Loading…
Reference in New Issue