示例#1
0
文件: searcher.py 项目: samit/pymisp
	def search_all(s_item):
		misp = misp_conn.MakeConn().get()
		result = misp.search_all(s_item['search'])
		if json_data['quiet']:
			for e in result['response']:
				return '{}{}{}\n'.format(url, '/events/view/', e['Event']['id'])
		elif out is None:
			return json.dumps(result['response'])
		else:
			with open(s_item['output'],'w') as search_res:
				search_res.write(json.dumps(result['response']))
示例#2
0
文件: searcher.py 项目: samit/pymisp
	def search_params(json_data):
		if json_data['attributes']:
			controller = 'attributes'
		else:
			controller = 'events'
		misp = misp_conn.MakeConn().get()
		kwargs = {json_data['param']:json_data['search']}
		result = misp.search(controller, **kwargs)
		if json_data['quiet']:
			for e in result['response']:
				return '{}{}{}\n'.format(url, '/events/view/', e['Event']['id'])
		elif out is None:
			return json.dumps(result['response'])
		else:
			with open(json_data['output'],'w') as search_res:
				search_res.write(json.dumps(result['response']))
示例#3
0
 def make_conn():
     return misp_conn.MakeConn().get()
示例#4
0
 def add_attr(evattr):
     misp = misp_conn.MakeConn().get()
     past_event = misp.get_event(evattr.get("attr", "event"))
     new_event = misp.add_named_attribute(past_event,
                                          evattr.get("attr", "type"),
                                          evattr.get("attr", "value"))
示例#5
0
	def get_event(eids):
		if eids >0:
			misp = misp_conn.MakeConn().get()
			json_event = misp.get_event(eids)
			return json_event
示例#6
0
	def get_all_feeds():
		misp = misp_conn.MakeConn().get()
		return misp.cache_all_feeds()
示例#7
0
    def connect_misp():

        return misp_conn.MakeConn().get()
示例#8
0
 def feed_event(events):
     misp = misp_conn.MakeConn().get()
     feed_id = events.get("fetch", "feedid")
     return misp.fetch_feed(feed_id)