<s> '''<STR_LIT>''' <EOL> import output <EOL> import util <EOL> import sys <EOL> import datetime <EOL> class NetflowOutput ( output . TextOutput ) : <EOL> '''<STR_LIT>''' <EOL> def __init__ ( self , * args , ** kwargs ) : <EOL> self . group = kwargs . get ( '<STR_LIT>' ) <EOL> self . groups = { } <EOL> if self . group : <EOL> self . group = self . group . split ( '<STR_LIT:/>' ) <EOL> output . TextOutput . __init__ ( self , ** kwargs ) <EOL> def alert ( self , * args , ** kw ) : <EOL> if self . group : <EOL> k = tuple ( kw [ g ] for g in self . group ) <EOL> if k not in self . groups : <EOL> r = k [ : : - <NUM_LIT:1> ] <EOL> if r in self . groups : <EOL> k = r <EOL> else : <EOL> self . groups [ k ] = [ ] <EOL> self . groups [ k ] . append ( kw ) <EOL> else : <EOL> self . __alert ( ** kw ) <EOL> def close ( self ) : <EOL> if self . group : <EOL> for k in sorted ( self . groups . iterkeys ( ) ) : <EOL> self . fh . write ( '<STR_LIT:U+0020>' . join ( <EOL> '<STR_LIT>' % ( self . group [ i ] , k [ i ] ) for i in xrange ( len ( self . group ) ) ) + '<STR_LIT:\n>' ) <EOL> for kw in self . groups [ k ] : <EOL> self . fh . write ( '<STR_LIT:\t>' ) <EOL> self . __alert ( self , ** kw ) <EOL> self . fh . write ( '<STR_LIT:\n>' ) <EOL> output . TextOutput . close ( self ) <EOL> def __alert ( self , * args , ** kw ) : <EOL> self . fh . write ( '<STR_LIT>' % ( datetime . datetime . utcfromtimestamp ( kw [ '<STR_LIT>' ] ) , <EOL> kw [ <EOL> '<STR_LIT>' ] , <EOL> kw [ <EOL> '<STR_LIT>' ] , <EOL> kw [ <EOL> '<STR_LIT>' ] , <EOL> kw [ <EOL> '<STR_LIT>' ] , <EOL> kw [ <EOL> '<STR_LIT>' ] , <EOL> kw [ <EOL> '<STR_LIT>' ] , <EOL> kw [ <EOL> '<STR_LIT>' ] , <EOL> kw [ <EOL> '<STR_LIT>' ] , <EOL> kw [ <EOL> '<STR_LIT>' ] , <EOL> kw [ <EOL> '<STR_LIT>' ] , <EOL> kw [ <EOL> '<STR_LIT>' ] , <EOL> ( <EOL> kw [ '<STR_LIT>' ] - kw [ '<STR_LIT>' ] ) <EOL> ) <EOL> ) <EOL> if self . nobuffer : <EOL> self . fh . flush ( ) <EOL> obj = NetflowOutput </s>
