mirror of https://github.com/MISP/PyMISP
				
				
				
			Merge branch 'master' of https://github.com/CIRCL/PyMISP
						commit
						79d7dba744
					
				|  | @ -45,7 +45,7 @@ class PyMISP(object): | |||
|         session.headers.update( | ||||
|             {'Authorization': self.key, | ||||
|              'Accept': 'application/' + out, | ||||
|              'content-type': 'text/' + out}) | ||||
|              'content-type': 'application/' + out}) | ||||
|         return session | ||||
| 
 | ||||
|     def __query(self, session, path, query): | ||||
|  | @ -84,7 +84,7 @@ class PyMISP(object): | |||
|             :param event: Event object to add | ||||
|         """ | ||||
|         session = self.__prepare_session() | ||||
|         return session.post(self.url, data=event) | ||||
|         return session.post(self.url, data=json.dumps(event)) | ||||
| 
 | ||||
|     def update_event(self, event_id, event): | ||||
|         """ | ||||
|  | @ -94,7 +94,7 @@ class PyMISP(object): | |||
|             :param event: Elements to add | ||||
|         """ | ||||
|         session = self.__prepare_session() | ||||
|         return session.post(self.rest.format(event_id), data=event) | ||||
|         return session.post(self.rest.format(event_id), data=json.dumps(event)) | ||||
| 
 | ||||
|     def delete_event(self, event_id): | ||||
|         """ | ||||
|  | @ -196,6 +196,24 @@ class PyMISP(object): | |||
|         session = self.__prepare_session('xml') | ||||
|         return session.get(xml) | ||||
| 
 | ||||
|     def download_all_suricata(self): | ||||
|         """ | ||||
|             Download all suricata rules events. | ||||
|         """ | ||||
|         suricata_rules = self.url + '/nids/suricata/download' | ||||
|         session = self.__prepare_session('rules') | ||||
|         return session.get(suricata_rules) | ||||
| 
 | ||||
|     def download_suricata_rule_event(self, event_id): | ||||
|         """ | ||||
|             Download one suricata rule event. | ||||
| 
 | ||||
|             :param event_id: ID of the event to download (same as get) | ||||
|         """ | ||||
|         template = self.url + '/nids/suricata/download/{}' | ||||
|         session = self.__prepare_session('rules') | ||||
|         return session.get(template.format(event_id)) | ||||
| 
 | ||||
|     def download(self, event_id, with_attachement=False): | ||||
|         """ | ||||
|             Download one event in XML | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 Alexandre Dulaunoy
						Alexandre Dulaunoy