def indicator_body(indicators):
        """Generate the appropriate dictionary content for POST of an File indicator

        Args:
            indicators (list): A list of one or more hash value(s).
        """
        hash_patterns = {
            'md5': re.compile(r'^([a-fA-F\d]{32})$'),
            'sha1': re.compile(r'^([a-fA-F\d]{40})$'),
            'sha256': re.compile(r'^([a-fA-F\d]{64})$'),
        }
        body = {}
        for indicator in indicators:
            if indicator is None:
                continue

            if hash_patterns['md5'].match(indicator):
                body['md5'] = indicator
            elif hash_patterns['sha1'].match(indicator):
                body['sha1'] = indicator
            elif hash_patterns['sha256'].match(indicator):
                body['sha256'] = indicator

        return body
def indicator_body ( indicators ) : hash_patterns = { 'md5' : re . compile ( r'^([a-fA-F\d]{32})$' ) , 'sha1' : re . compile ( r'^([a-fA-F\d]{40})$' ) , 'sha256' : re . compile ( r'^([a-fA-F\d]{64})$' ) , } body = { } for indicator in indicators : if indicator is None : continue if hash_patterns [ 'md5' ] . match ( indicator ) : body [ 'md5' ] = indicator elif hash_patterns [ 'sha1' ] . match ( indicator ) : body [ 'sha1' ] = indicator elif hash_patterns [ 'sha256' ] . match ( indicator ) : body [ 'sha256' ] = indicator return body
Generate the appropriate dictionary content for POST of an File indicator

        Args:
            indicators (list): A list of one or more hash value(s).