def do_transform(self, request, response, config): base_url = config['OTX_transform.local.otx_url'] api_key = config['OTX_transform.local.api_key'] entity_type = gram[request.entity.type] entity_value = request.entity.value url = '%s/indicators/%s/%s/general' % (base_url, entity_type, entity_value) r = requests.get(url, headers={'X-OTX-API-KEY': api_key}) if r.status_code == 200: try: res = r.json() except: p = Phrase(url) response += p return response for pulse in res['pulse_info']['pulses']: p = Pulse() p.URL = 'https://otx.alienvault.com/pulse/%s' % pulse['id'] p.ID = pulse['id'] p.value = pulse['name'] p.link_label = pulse['modified'] response += p return response pass
def get_status_domains(vt_result): if 'scans' in vt_result: for av, res in vt_result['scans'].items(): ph = Phrase(value=av) ph.link_label = res['result'] yield ph