#NEWLINE# def buildcef( action , entry ) : #NEWLINE# #INDENT# ' Builds a CEF-formatted string based on reputation entry from RepDB\n\n    :param string action:  add remove or delete\n    :param entry: One RepDB entry to parse\n    :return: Returns a CEF-formatted string with timestamp\n    ' #NEWLINE# ip = entry [ 'ip' ] #NEWLINE# source = entry [ 'source' ] #NEWLINE# description = priority [ 'description' ] #NEWLINE# priority = entry [ 'priority' ] #NEWLINE# reputation = entry [ 'reputation' ] #NEWLINE# city = entry [ 'city' ] #NEWLINE# country = entry [ 'country' ] #NEWLINE# latitude = entry [ 'latitude' ] #NEWLINE# longitude = entry [ 'longitude' ] #NEWLINE# timestamp = datetime . datetime . fromtimestamp ( time . time ( ) ) . strftime ( '%b %d %Y %H:%M:%S' ) #NEWLINE# return ( '%s %s CEF:0|%s|%s|1.0|100|Threat Entry %s|1|act=%s reason=%s src=%s cs1Label=Source cs1=%s cs2Label=City cs2=%s cs3Label=Country cs3=%s cfp1Label=Latitude cfp1=%.8f cfp2Label=Longitude cfp2=%.8f cfp3Label=Priority cfp3=%d cfp4Label=Reputation cfp4=%d' % ( timestamp , config . deviceHost , config . deviceVendor , config . deviceProduct , action , action , description , ip , source , city , country , latitude , longitude , priority , reputation ) )