#NEWLINE# def _run( self , scanObject , result , depth , args ) : #NEWLINE# #INDENT# moduleResult = [ ] #NEWLINE# minFileSize = 0 #NEWLINE# useUnvalidatedFilenames = 0 #NEWLINE# if ( 'minFileSize' in args ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# minFileSize = int ( args [ 'minFileSize' ] ) #NEWLINE# #UNINDENT# except ( QuitScanException , GlobalScanTimeoutError , GlobalModuleTimeoutError ) : #NEWLINE# #INDENT# raise #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# #UNINDENT# if ( 'useUnvalidatedFilenames' in args ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# minFileSize = int ( args [ 'useUnvalidatedFilenames' ] ) #NEWLINE# #UNINDENT# except ( QuitScanException , GlobalScanTimeoutError , GlobalModuleTimeoutError ) : #NEWLINE# #INDENT# raise #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# #UNINDENT# file = StringIO . StringIO ( ) #NEWLINE# file . write ( scanObject . buffer ) #NEWLINE# file . flush ( ) #NEWLINE# file . seek ( 0 ) #NEWLINE# ole = olefile . OleFileIO ( file ) #NEWLINE# lstStreams = ole . listdir ( ) #NEWLINE# numStreams = 0 #NEWLINE# for stream in lstStreams : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# if ( ole . get_size ( depth ) >= minFileSize ) : #NEWLINE# #INDENT# numStreams += 1 #NEWLINE# streamF = ole . openstream ( stream ) #NEWLINE# childBuffer = streamF . read ( ) #NEWLINE# if childBuffer : #NEWLINE# #INDENT# filename = ( 'e_ole_stream_' + str ( numStreams ) ) #NEWLINE# try : #NEWLINE# #INDENT# u = unicode ( str ( stream ) , 'utf-8' ) #NEWLINE# filename = u . encode ( 'utf-8' ) #NEWLINE# #UNINDENT# except ( QuitScanException , GlobalScanTimeoutError , GlobalModuleTimeoutError ) : #NEWLINE# #INDENT# raise #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# moduleResult . append ( ModuleObject ( buffer = childBuffer , externalVars = ExternalVars ( filename = filename ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# except ( QuitScanException , GlobalScanTimeoutError , GlobalModuleTimeoutError ) : #NEWLINE# #INDENT# raise #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# log_module ( 'MSG' , self . module_name , 0 , scanObject , result , ( 'ERROR EXTRACTING STREAM: ' + str ( stream ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# ole . close ( ) #NEWLINE# file . close ( ) #NEWLINE# return moduleResult