(self, report)
return status
Process public key sample data from VirusTotal.

        Args:
            report (dict): json report information

        Return: dict with keys:
            'success' (boolean),
            'message' (str),
            'scandate' (str), if available
Process public key sample data from VirusTotal.
Process public key sample data from VirusTotal .
def _process_public_sample(self, report):
        """
        Process public key sample data from VirusTotal.

        Args:
            report (dict): json report information

        Return: dict with keys:
            'success' (boolean),
            'message' (str),
            'scandate' (str), if available
        """
        status = {
            'success':  False,
            'message':  []
        }

        # Checks to see if VT verbose_msg is provided. If not exit and return message
        vtmsg = report.get('verbose_msg', False)
        if not vtmsg:
            status['message'].append("No verbose message provided by VT.")

        # Add VT header information. Composed of information overview and permalink
        stats = {
            'scan_date':        report.get('scan_date', ''),
            'positives':        report.get('positives', 0),
            'total':            report.get('total', 0),
        }
        result_string = "%d / %d" % (report.get('positives', 0), report.get('total', 0))
        status['scandate'] = stats['scan_date']
        self._add_result('stats', result_string, stats)
        self._add_result('permalink', report.get("permalink", "No link"))

        # Add VT scan data
        scans = report.get('scans', [])
        if scans:
            for scan in scans:
                if scans[scan]["result"]:
                    result = scans[scan]["result"]
                else:
                    result = ''
                detection = {
                    "engine":       scan,
                    "date":         scans[scan].get('update', ''),
                    "detected":     scans[scan].get('detected', ''),
                    "version":      scans[scan].get('version', ''),
                }
                self._add_result('av result', result, detection)
        else:
            status['message'].append("Scan data not included in VT response.")

        # Updating status information and returning
        if not status['message']:
            status['success'] =  True
            status['message'] = "Processed Public Report Information."
        else:
            status['message'] = "\n".join(status['message'])

        return status
def _process_public_sample ( self , report ) : status = { 'success' : False , 'message' : [ ] } # Checks to see if VT verbose_msg is provided. If not exit and return message vtmsg = report . get ( 'verbose_msg' , False ) if not vtmsg : status [ 'message' ] . append ( "No verbose message provided by VT." ) # Add VT header information. Composed of information overview and permalink stats = { 'scan_date' : report . get ( 'scan_date' , '' ) , 'positives' : report . get ( 'positives' , 0 ) , 'total' : report . get ( 'total' , 0 ) , } result_string = "%d / %d" % ( report . get ( 'positives' , 0 ) , report . get ( 'total' , 0 ) ) status [ 'scandate' ] = stats [ 'scan_date' ] self . _add_result ( 'stats' , result_string , stats ) self . _add_result ( 'permalink' , report . get ( "permalink" , "No link" ) ) # Add VT scan data scans = report . get ( 'scans' , [ ] ) if scans : for scan in scans : if scans [ scan ] [ "result" ] : result = scans [ scan ] [ "result" ] else : result = '' detection = { "engine" : scan , "date" : scans [ scan ] . get ( 'update' , '' ) , "detected" : scans [ scan ] . get ( 'detected' , '' ) , "version" : scans [ scan ] . get ( 'version' , '' ) , } self . _add_result ( 'av result' , result , detection ) else : status [ 'message' ] . append ( "Scan data not included in VT response." ) # Updating status information and returning if not status [ 'message' ] : status [ 'success' ] = True status [ 'message' ] = "Processed Public Report Information." else : status [ 'message' ] = "\n" . join ( status [ 'message' ] ) return status