mirror of https://github.com/MISP/PyMISP
Merge branch 'master' of github.com:MISP/PyMISP
commit
1dda8eb40a
|
@ -26,9 +26,7 @@ def download_last(m, last, out=None):
|
|||
exit(0)
|
||||
else:
|
||||
with open(out, 'w') as f:
|
||||
for e in result['response']:
|
||||
f.write(json.dumps(e) + '\n')
|
||||
|
||||
f.write(json.dumps(result['response']))
|
||||
|
||||
if __name__ == '__main__':
|
||||
parser = argparse.ArgumentParser(description='Download latest events from a MISP instance.')
|
||||
|
|
|
@ -31,3 +31,8 @@
|
|||
|
||||
* [Pygal](https://github.com/Kozea/pygal/)
|
||||
* [Matplotlib](https://github.com/matplotlib/matplotlib)
|
||||
* [Pandas](https://github.com/pandas-dev/pandas)
|
||||
* [SciPy](https://github.com/scipy/scipy)
|
||||
* [PyTaxonomies](https://github.com/MISP/PyTaxonomies)
|
||||
* [Python3-tk](https://github.com/python-git/python/blob/master/Lib/lib-tk/Tkinter.py)
|
||||
|
||||
|
|
|
@ -7,21 +7,17 @@ import argparse
|
|||
|
||||
from io import open
|
||||
|
||||
# Usage for pipe masters: ./last.py -l 5h | jq .
|
||||
|
||||
|
||||
def init(url, key):
|
||||
return PyMISP(url, key, True, 'json', debug=True)
|
||||
|
||||
|
||||
def up_event(m, event, content):
|
||||
with open(content, 'r') as f:
|
||||
result = m.update_event(event, f.read())
|
||||
print(result)
|
||||
|
||||
if __name__ == '__main__':
|
||||
parser = argparse.ArgumentParser(description='Get an event from a MISP instance.')
|
||||
parser.add_argument("-e", "--event", required=True, help="Event ID to get.")
|
||||
parser = argparse.ArgumentParser(description="Update a MISP event.")
|
||||
parser.add_argument("-e", "--event", required=True, help="Event ID to update.")
|
||||
parser.add_argument("-i", "--input", required=True, help="Input file")
|
||||
|
||||
args = parser.parse_args()
|
||||
|
|
|
@ -413,7 +413,7 @@ class PyMISP(object):
|
|||
raise PyMISPError("Unable to find the ID of the event to update")
|
||||
for a in attributes:
|
||||
if proposal:
|
||||
response = self.proposal_add(eventID_to_update, json.dumps(a, cls=EncodeUpdate))
|
||||
response = self.proposal_add(eventID_to_update, a)
|
||||
else:
|
||||
session = self.__prepare_session()
|
||||
url = urljoin(self.root_url, 'attributes/add/{}'.format(eventID_to_update))
|
||||
|
@ -710,7 +710,7 @@ class PyMISP(object):
|
|||
url = urljoin(self.root_url, 'shadow_attributes/{}/{}'.format(path, id))
|
||||
if path in ['add', 'edit']:
|
||||
query = {'request': {'ShadowAttribute': attribute}}
|
||||
response = session.post(url, data=json.dumps(query))
|
||||
response = session.post(url, data=json.dumps(query, cls=EncodeUpdate))
|
||||
elif path == 'view':
|
||||
response = session.get(url)
|
||||
else: # accept or discard
|
||||
|
|
Loading…
Reference in New Issue