(self, tg_id)
Get Sample IOCs for a given ThreatGRID id
Get Sample IOCs for a given ThreatGRID id
Get Sample IOCs for a given ThreatGRID id
def sample_iocs(self, tg_id):
        """
        Get Sample IOCs for a given ThreatGRID id
        """
        url = '/api/v2/samples/' + tg_id + '/analysis/iocs'
        response = self.api_request(url, {}, 'get')
        if response:
            if response.get('data'):
                iocs = response.get('data', {}).get('items')
                for item in self.sort_iocs(iocs):
                    result = {
                            'hits':         item.get('hits'),
                            'severity':     item.get('severity'),
                            'confidence':   item.get('confidence'),
                            'categories':   ', '.join(item.get('category', [])),
                            }
                    self._add_result('threatgrid_ioc', item.get('title', ''), result)
                self._notify()
            elif reponse.get('error'):
                self._info('No IOCs were found for ThreatGRID id:{}'.format(tg_id))
            else:
                self._error('An error occured when attempting to get IOCs for id:{}'.format(tg_id))
def sample_iocs ( self , tg_id ) : url = '/api/v2/samples/' + tg_id + '/analysis/iocs' response = self . api_request ( url , { } , 'get' ) if response : if response . get ( 'data' ) : iocs = response . get ( 'data' , { } ) . get ( 'items' ) for item in self . sort_iocs ( iocs ) : result = { 'hits' : item . get ( 'hits' ) , 'severity' : item . get ( 'severity' ) , 'confidence' : item . get ( 'confidence' ) , 'categories' : ', ' . join ( item . get ( 'category' , [ ] ) ) , } self . _add_result ( 'threatgrid_ioc' , item . get ( 'title' , '' ) , result ) self . _notify ( ) elif reponse . get ( 'error' ) : self . _info ( 'No IOCs were found for ThreatGRID id:{}' . format ( tg_id ) ) else : self . _error ( 'An error occured when attempting to get IOCs for id:{}' . format ( tg_id ) )