Skip to content

Commit

Permalink
new: Update warninglists
Browse files Browse the repository at this point in the history
  • Loading branch information
Rafiot committed Sep 25, 2018
1 parent da0f6ef commit b95fdf9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion pymisp/api.py
Expand Up @@ -1224,7 +1224,7 @@ def get_yara(self, event_id):

def download_samples(self, sample_hash=None, event_id=None, all_samples=False, unzip=True):
"""Download samples, by hash or event ID. If there are multiple samples in one event, use the all_samples switch
:param sample_hash: hash of sample
:param event_id: ID of event
:param all_samples: download all samples
Expand Down Expand Up @@ -1697,6 +1697,11 @@ def get_warninglist(self, warninglist_id):
response = self._prepare_request('GET', url)
return self._check_response(response)

def update_warninglists(self):
url = urljoin(self.root_url, '/warninglists/update')
response = self._prepare_request('POST', url)
return self._check_response(response)

# ############## Galaxies/Clusters ##################

def get_galaxies(self):
Expand Down
2 changes: 1 addition & 1 deletion tests/testlive_comprehensive.py
Expand Up @@ -580,8 +580,8 @@ def test_simple_event(self):
# self.assertEqual(len(events), 1)

# warninglist
self.admin_misp_connector.update_warninglists()
response = self.admin_misp_connector.toggle_warninglist(warninglist_name='%dns resolv%', force_enable=True) # enable ipv4 DNS.
# response = self.admin_misp_connector.toggle_warninglist(warninglist_id=[17], force_enable=True) # enable ipv4 DNS.
self.assertDictEqual(response, {'saved': True, 'success': '3 warninglist(s) enabled'})
second.add_attribute('ip-src', '9.9.9.9')
second = self.user_misp_connector.update_event(second)
Expand Down

0 comments on commit b95fdf9

Please sign in to comment.