<s> '''<STR_LIT>''' <EOL> import re <EOL> import hashlib <EOL> import logging <EOL> import os <EOL> from . errors import DebuggerError <EOL> from . errors import DebuggerFileError <EOL> from . errors import UnknownDebuggerError <EOL> logger = logging . getLogger ( __name__ ) <EOL> registers = ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> registers64 = ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> regex = { <EOL> '<STR_LIT>' : re . compile ( r'<STR_LIT>' ) , <EOL> '<STR_LIT>' : re . compile ( r'<STR_LIT>' ) , <EOL> '<STR_LIT>' : re . compile ( r'<STR_LIT>' ) , <EOL> '<STR_LIT>' : re . compile ( r'<STR_LIT>' ) , <EOL> '<STR_LIT>' : re . compile ( r'<STR_LIT>' ) , <EOL> '<STR_LIT>' : re . compile ( r'<STR_LIT>' ) , <EOL> '<STR_LIT>' : re . compile ( r'<STR_LIT>' ) , <EOL> '<STR_LIT>' : re . compile ( r'<STR_LIT>' ) , <EOL> '<STR_LIT>' : re . compile ( r'<STR_LIT>' ) , <EOL> '<STR_LIT>' : re . compile ( r'<STR_LIT>' ) , <EOL> '<STR_LIT>' : re . compile ( r'<STR_LIT>' ) , <EOL> '<STR_LIT>' : re . compile ( r'<STR_LIT>' ) , <EOL> '<STR_LIT>' : re . compile ( r'<STR_LIT>' ) , <EOL> '<STR_LIT>' : re . compile ( r'<STR_LIT>' ) , <EOL> '<STR_LIT>' : re . compile ( r'<STR_LIT>' ) , <EOL> '<STR_LIT>' : re . compile ( r'<STR_LIT>' ) , <EOL> '<STR_LIT>' : re . compile ( r'<STR_LIT>' ) , <EOL> '<STR_LIT>' : re . compile ( r'<STR_LIT>' ) , <EOL> '<STR_LIT>' : re . compile ( r'<STR_LIT>' ) <EOL> } <EOL> blacklist = ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' <EOL> ) <EOL> def check_thread_type ( line ) : <EOL> if regex [ '<STR_LIT>' ] . match ( line ) : <EOL> return '<STR_LIT>' <EOL> elif regex [ '<STR_LIT>' ] . match ( line ) : <EOL> return '<STR_LIT>' <EOL> elif regex [ '<STR_LIT>' ] . match ( line ) : <EOL> return '<STR_LIT>' <EOL> else : <EOL> return False <EOL> def detect_format ( debugger_output_file ) : <EOL> logger . debug ( '<STR_LIT>' , debugger_output_file ) <EOL> with open ( debugger_output_file , '<STR_LIT:r>' ) as f : <EOL> for line in f . readlines ( ) : <EOL> thread_format = check_thread_type ( line . strip ( ) ) <EOL> if thread_format : <EOL> return thread_format <EOL> raise UnknownDebuggerError ( '<STR_LIT>' % debugger_output_file ) <EOL> class DebuggerFile ( object ) : <EOL> '''<STR_LIT>''' <EOL> def __init__ ( self , path , exclude_unmapped_frames = True , keep_uniq_faddr = False ) : <EOL> '''<STR_LIT>''' <EOL> logger . debug ( '<STR_LIT>' , path ) <EOL> self . file = path <EOL> self . debugger_output = None <EOL> self . lines = [ ] <EOL> self . exclude_unmapped_frames = exclude_unmapped_frames <EOL> self . backtrace = [ ] <EOL> self . backtrace_without_questionmarks = [ ] <EOL> self . registers = { } <EOL> self . registers_sought = list ( registers ) <EOL> self . registers_hex = { } <EOL> self . hashable_backtrace = [ ] <EOL> self . hashable_backtrace_string = '<STR_LIT>' <EOL> self . module_map = [ ] <EOL> self . exit_code = None <EOL> self . signal = None <EOL> self . is_corrupt_stack = False <EOL> self . is_crash = True <EOL> self . is_assert_fail = False <EOL> self . is_debugbuild = False <EOL> self . libc_start_addr = <NUM_LIT:0> <EOL> self . libc_end_addr = <NUM_LIT:0> <EOL> self . libgcc_start_addr = <NUM_LIT:0> <EOL> self . libgcc_end_addr = <NUM_LIT:0> <EOL> self . used_pc = False <EOL> self . debugger_missed_stack_corruption = False <EOL> self . total_stack_corruption = False <EOL> self . pc_in_function = False <EOL> self . is_64bit = False <EOL> self . pc_name = '<STR_LIT>' <EOL> self . keep_uniq_faddr = keep_uniq_faddr <EOL> self . faddr = None <EOL> if not hasattr ( self , '<STR_LIT>' ) : <EOL> self . line_callbacks = [ <EOL> self . _look_for_64bit , <EOL> self . _look_for_exit_code , <EOL> self . _look_for_debug_build , <EOL> self . _look_for_corrupt_stack , <EOL> self . _look_for_libc_location , <EOL> self . _look_for_libgcc_location , <EOL> self . _look_for_signal , <EOL> self . _look_for_crash , <EOL> self . _look_for_registers , <EOL> self . _look_for_faddr , <EOL> self . _build_module_map , <EOL> ] <EOL> self . _read_file ( ) <EOL> self . _process_file ( ) <EOL> def _process_file ( self ) : <EOL> self . _process_lines ( ) <EOL> self . _process_backtrace ( ) <EOL> self . _hashable_backtrace ( ) <EOL> def _hashable_backtrace ( self ) : <EOL> logger . debug ( '<STR_LIT>' ) <EOL> hashable = [ ] <EOL> if not self . hashable_backtrace : <EOL> for bt in self . backtrace : <EOL> logger . debug ( '<STR_LIT>' , bt ) <EOL> frame_address = <NUM_LIT:0> <EOL> bt_frame = None <EOL> n = re . match ( regex [ '<STR_LIT>' ] , bt ) <EOL> if n : <EOL> bt_frame = n . group ( <NUM_LIT:1> ) <EOL> frame_address = int ( bt_frame , <NUM_LIT:16> ) <EOL> elif self . registers_hex . get ( self . pc_name ) and not self . used_pc : <EOL> self . used_pc = True <EOL> frame_address = int ( self . registers_hex [ self . pc_name ] , <NUM_LIT:16> ) <EOL> if self . libc_start_addr < frame_address < self . libc_end_addr : <EOL> continue <EOL> if self . libgcc_start_addr < frame_address < self . libgcc_end_addr : <EOL> continue <EOL> x = re . match ( regex [ '<STR_LIT>' ] , bt ) <EOL> if x and x . group ( <NUM_LIT:1> ) in blacklist : <EOL> continue <EOL> m = re . search ( regex [ '<STR_LIT>' ] , bt ) <EOL> if m : <EOL> bt_frame = m . group ( <NUM_LIT:1> ) <EOL> if '<STR_LIT>' in bt_frame : <EOL> logger . debug ( '<STR_LIT>' ) <EOL> continue <EOL> if bt_frame : <EOL> hashable . append ( bt_frame ) <EOL> if not hashable : <EOL> if self . total_stack_corruption : <EOL> hashable . append ( '<STR_LIT>' ) <EOL> if self . exit_code : <EOL> hashable . append ( '<STR_LIT>' % self . exit_code ) <EOL> elif len ( self . backtrace ) and self . backtrace [ <NUM_LIT:0> ] : <EOL> hashable . append ( self . backtrace [ <NUM_LIT:0> ] ) <EOL> if not hashable : <EOL> self . is_crash = False <EOL> self . hashable_backtrace = hashable <EOL> logger . debug ( "<STR_LIT>" , self . hashable_backtrace ) <EOL> return self . hashable_backtrace <EOL> def _hashable_backtrace_string ( self , level ) : <EOL> self . hashable_backtrace_string = '<STR_LIT:U+0020>' . join ( self . hashable_backtrace [ : level ] ) . strip ( ) <EOL> if self . keep_uniq_faddr : <EOL> try : <EOL> self . hashable_backtrace_string = self . hashable_backtrace_string + '<STR_LIT:U+0020>' + self . faddr <EOL> except : <EOL> logger . debug ( '<STR_LIT>' ) <EOL> logger . warning ( '<STR_LIT>' , self . hashable_backtrace_string ) <EOL> return self . hashable_backtrace_string <EOL> def _backtrace_without_questionmarks ( self ) : <EOL> logger . debug ( '<STR_LIT>' ) <EOL> if not self . backtrace_without_questionmarks : <EOL> self . backtrace_without_questionmarks = [ bt for bt in self . backtrace if not '<STR_LIT>' in bt ] <EOL> return self . backtrace_without_questionmarks <EOL> def backtrace_line ( self , idx , l ) : <EOL> m = re . match ( regex [ '<STR_LIT>' ] , l ) <EOL> if m : <EOL> item = m . group ( <NUM_LIT:1> ) <EOL> next_idx = idx + <NUM_LIT:1> <EOL> while next_idx < len ( self . lines ) : <EOL> nextline = self . lines [ next_idx ] <EOL> if re . match ( regex [ '<STR_LIT>' ] , nextline ) : <EOL> break <EOL> elif re . search ( regex [ '<STR_LIT>' ] , nextline ) or re . search ( regex [ '<STR_LIT>' ] , nextline ) : <EOL> if not "<STR_LIT>" in nextline and not "<STR_LIT>" in nextline : <EOL> item = '<STR_LIT:U+0020>' . join ( ( item , nextline ) ) <EOL> next_idx += <NUM_LIT:1> <EOL> self . backtrace . append ( item ) <EOL> logger . debug ( '<STR_LIT>' , item ) <EOL> def _read_file ( self ) : <EOL> '''<STR_LIT>''' <EOL> logger . debug ( '<STR_LIT>' ) <EOL> try : <EOL> with open ( self . file , '<STR_LIT:r>' ) as f : <EOL> self . debugger_output = f . read ( ) <EOL> self . lines = [ l . strip ( ) for l in self . debugger_output . splitlines ( ) ] <EOL> except IOError , e : <EOL> raise DebuggerFileError ( e ) <EOL> except MemoryError , e : <EOL> raise DebuggerFileError ( e ) <EOL> def _process_backtrace ( self ) : <EOL> if not len ( self . backtrace ) : <EOL> logger . debug ( '<STR_LIT>' ) <EOL> return <EOL> if self . is_corrupt_stack : <EOL> removed_bt_line = self . backtrace . pop ( ) <EOL> logger . debug ( "<STR_LIT>" , removed_bt_line ) <EOL> else : <EOL> self . _look_for_debugger_missed_stack_corruption ( ) <EOL> if self . exclude_unmapped_frames : <EOL> self . _remove_unmapped_frames ( ) <EOL> self . _look_for_assert_fail ( ) <EOL> self . _check_pc_in_function ( ) <EOL> def _process_lines ( self ) : <EOL> logger . debug ( '<STR_LIT>' ) <EOL> for idx , line in enumerate ( self . lines ) : <EOL> self . backtrace_line ( idx , line ) <EOL> for callback in self . line_callbacks : <EOL> callback ( line ) <EOL> def _look_for_corrupt_stack ( self , line ) : <EOL> if self . is_corrupt_stack : <EOL> return <EOL> if '<STR_LIT>' in line : <EOL> logger . debug ( '<STR_LIT>' ) <EOL> self . is_corrupt_stack = True <EOL> def _is_mapped_frame ( self , frame_address ) : <EOL> '''<STR_LIT>''' <EOL> logger . debug ( '<STR_LIT>' , frame_address ) <EOL> if len ( self . module_map ) : <EOL> for module in self . module_map : <EOL> logger . debug ( '<STR_LIT>' , module [ '<STR_LIT:start>' ] , module [ '<STR_LIT:end>' ] ) <EOL> if module [ '<STR_LIT:start>' ] < frame_address < module [ '<STR_LIT:end>' ] : <EOL> logger . debug ( '<STR_LIT>' % ( frame_address , module [ '<STR_LIT>' ] ) ) <EOL> return True <EOL> return False <EOL> else : <EOL> return True <EOL> def _get_frame_address ( self , bt_line ) : <EOL> n = re . match ( regex [ '<STR_LIT>' ] , bt_line ) <EOL> if n : <EOL> frame_address = int ( n . group ( <NUM_LIT:1> ) , <NUM_LIT:16> ) <EOL> return frame_address <EOL> else : <EOL> return None <EOL> def _look_for_debugger_missed_stack_corruption ( self ) : <EOL> start_bt_length = len ( self . backtrace ) <EOL> while self . backtrace : <EOL> mapped_frame = False <EOL> frame_address = self . _get_frame_address ( self . backtrace [ - <NUM_LIT:1> ] ) <EOL> if frame_address : <EOL> mapped_frame = self . _is_mapped_frame ( frame_address ) <EOL> if not mapped_frame : <EOL> self . debugger_missed_stack_corruption = True <EOL> removed_bt_line = self . backtrace . pop ( ) <EOL> logger . debug ( "<STR_LIT>" , removed_bt_line ) <EOL> else : <EOL> break <EOL> else : <EOL> break <EOL> end_bt_length = len ( self . backtrace ) <EOL> if start_bt_length and not end_bt_length : <EOL> self . total_stack_corruption = True <EOL> logger . debug ( '<STR_LIT>' ) <EOL> def _look_for_exit_code ( self , line ) : <EOL> m = re . match ( regex [ '<STR_LIT>' ] , line ) <EOL> if m : <EOL> self . exit_code = m . group ( <NUM_LIT:1> ) <EOL> logger . debug ( '<STR_LIT>' , self . exit_code ) <EOL> self . line_callbacks . remove ( self . _look_for_exit_code ) <EOL> def _look_for_signal ( self , line ) : <EOL> if self . signal : <EOL> return <EOL> m = re . match ( regex [ '<STR_LIT>' ] , line ) <EOL> if m : <EOL> self . signal = m . group ( <NUM_LIT:1> ) <EOL> logger . debug ( '<STR_LIT>' , self . signal ) <EOL> def _look_for_faddr ( self , line ) : <EOL> if self . faddr : <EOL> return <EOL> m = re . match ( regex [ '<STR_LIT>' ] , line ) <EOL> if m : <EOL> self . faddr = m . group ( <NUM_LIT:1> ) <EOL> logger . debug ( '<STR_LIT>' , self . faddr ) <EOL> def _look_for_crash ( self , line ) : <EOL> if not self . is_crash : <EOL> return <EOL> logger . debug ( '<STR_LIT>' ) <EOL> if '<STR_LIT>' in line : <EOL> self . is_crash = False <EOL> elif '<STR_LIT>' in line : <EOL> self . is_crash = False <EOL> elif '<STR_LIT>' in line : <EOL> self . is_crash = False <EOL> elif '<STR_LIT>' in line : <EOL> self . is_crash = False <EOL> def _look_for_assert_fail ( self ) : <EOL> for bt in self . backtrace : <EOL> if '<STR_LIT>' in bt : <EOL> logger . debug ( '<STR_LIT>' ) <EOL> self . is_assert_fail = True <EOL> break <EOL> def _remove_unmapped_frames ( self ) : <EOL> for i in xrange ( len ( self . backtrace ) - <NUM_LIT:1> , - <NUM_LIT:1> , - <NUM_LIT:1> ) : <EOL> bt = self . backtrace [ i ] <EOL> mapped_frame = False <EOL> frame_address = self . _get_frame_address ( bt ) <EOL> if frame_address is not None : <EOL> mapped_frame = self . _is_mapped_frame ( frame_address ) <EOL> if not mapped_frame : <EOL> logger . debug ( '<STR_LIT>' % bt ) <EOL> del self . backtrace [ i ] <EOL> if not len ( self . backtrace ) : <EOL> self . total_stack_corruption = True <EOL> def _check_pc_in_function ( self ) : <EOL> '''<STR_LIT>''' <EOL> if self . backtrace : <EOL> if not '<STR_LIT>' in self . backtrace [ <NUM_LIT:0> ] : <EOL> self . pc_in_function = True <EOL> def _look_for_debug_build ( self , line ) : <EOL> if self . is_debugbuild : <EOL> return <EOL> if '<STR_LIT>' in line : <EOL> logger . debug ( '<STR_LIT>' ) <EOL> self . is_debugbuild = True <EOL> def _look_for_64bit ( self , line ) : <EOL> '''<STR_LIT>''' <EOL> if self . is_64bit : <EOL> return <EOL> m = re . match ( regex [ '<STR_LIT>' ] , line ) <EOL> if m : <EOL> start_addr = m . group ( <NUM_LIT:1> ) <EOL> logger . debug ( '<STR_LIT>' , start_addr , len ( start_addr ) ) <EOL> if len ( start_addr ) > <NUM_LIT:10> : <EOL> self . is_64bit = True <EOL> logger . debug ( '<STR_LIT>' ) <EOL> self . pc_name = '<STR_LIT>' <EOL> self . registers_sought = list ( registers64 ) <EOL> def _look_for_libc_location ( self , line ) : <EOL> '''<STR_LIT>''' <EOL> if self . libc_start_addr : <EOL> return <EOL> m = re . match ( regex [ '<STR_LIT>' ] , line ) <EOL> if m : <EOL> self . libc_start_addr = int ( m . group ( <NUM_LIT:1> ) , <NUM_LIT:16> ) <EOL> self . libc_end_addr = int ( m . group ( <NUM_LIT:2> ) , <NUM_LIT:16> ) <EOL> def _look_for_libgcc_location ( self , line ) : <EOL> '''<STR_LIT>''' <EOL> if self . libgcc_start_addr : <EOL> return <EOL> m = re . match ( regex [ '<STR_LIT>' ] , line ) <EOL> if m : <EOL> self . libgcc_start_addr = int ( m . group ( <NUM_LIT:1> ) , <NUM_LIT:16> ) <EOL> self . libgcc_end_addr = int ( m . group ( <NUM_LIT:2> ) , <NUM_LIT:16> ) <EOL> def _build_module_map ( self , line ) : <EOL> '''<STR_LIT>''' <EOL> m = re . match ( regex [ '<STR_LIT>' ] , line ) <EOL> if m : <EOL> module = { '<STR_LIT:start>' : int ( m . group ( <NUM_LIT:1> ) , <NUM_LIT:16> ) , <EOL> '<STR_LIT:end>' : int ( m . group ( <NUM_LIT:2> ) , <NUM_LIT:16> ) , <EOL> '<STR_LIT>' : m . group ( <NUM_LIT:4> ) <EOL> } <EOL> self . module_map . append ( module ) <EOL> def _look_for_registers ( self , line ) : <EOL> if not len ( self . registers_sought ) : <EOL> return <EOL> parts = line . split ( ) <EOL> if not len ( parts ) : <EOL> return <EOL> if not parts [ <NUM_LIT:0> ] in self . registers_sought : <EOL> return <EOL> r = parts [ <NUM_LIT:0> ] <EOL> r_str = '<STR_LIT:U+0020>' . join ( parts [ <NUM_LIT:1> : ] ) <EOL> m = re . match ( regex [ '<STR_LIT>' ] , r_str ) <EOL> if not m : <EOL> logger . debug ( '<STR_LIT>' , r_str ) <EOL> return <EOL> self . registers_hex [ r ] = m . group ( <NUM_LIT:1> ) <EOL> self . registers [ r ] = m . group ( <NUM_LIT:2> ) <EOL> self . registers_sought . remove ( r ) <EOL> logger . debug ( '<STR_LIT>' , r , self . registers_hex [ r ] ) <EOL> def get_crash_signature ( self , backtrace_level ) : <EOL> '''<STR_LIT>''' <EOL> logger . debug ( '<STR_LIT>' ) <EOL> backtrace_string = self . _hashable_backtrace_string ( backtrace_level ) <EOL> if bool ( backtrace_string ) : <EOL> return hashlib . md5 ( backtrace_string ) . hexdigest ( ) <EOL> else : <EOL> return None <EOL> def _detect_and_generate ( debugger_file ) : <EOL> import konqifile <EOL> import abrtfile <EOL> import gdbfile <EOL> BacktraceClass = { <EOL> '<STR_LIT>' : gdbfile . GDBfile , <EOL> '<STR_LIT>' : abrtfile . ABRTfile , <EOL> '<STR_LIT>' : konqifile . Konqifile , <EOL> } <EOL> try : <EOL> bt_type = detect_format ( debugger_file ) <EOL> except UnknownDebuggerError : <EOL> logger . info ( "<STR_LIT>" , debugger_file ) <EOL> return None <EOL> try : <EOL> bt = BacktraceClass [ bt_type ] ( debugger_file ) <EOL> except KeyError : <EOL> logger . warning ( "<STR_LIT>" , bt_type , debugger_file ) <EOL> return None <EOL> return bt <EOL> def _print_line ( sig , filepath , bthash , include_bt = False ) : <EOL> format_string = '<STR_LIT>' <EOL> print format_string % ( sig , filepath ) <EOL> if include_bt : <EOL> print format_string % ( '<STR_LIT>' , bthash ) <EOL> print <EOL> def _analyze_file ( filepath , include_bt = False ) : <EOL> '''<STR_LIT>''' <EOL> logger . debug ( '<STR_LIT>' , filepath ) <EOL> bt = _detect_and_generate ( filepath ) <EOL> sig = '<STR_LIT>' <EOL> bthash = '<STR_LIT>' <EOL> if bt : <EOL> sig = bt . get_crash_signature ( <NUM_LIT:5> ) <EOL> if bt . total_stack_corruption : <EOL> sig = "<STR_LIT>" <EOL> if not sig : <EOL> sig = "<STR_LIT>" <EOL> if include_bt : <EOL> bthash = bt . _hashable_backtrace_string ( <NUM_LIT:5> ) <EOL> _print_line ( sig , filepath , bthash , include_bt ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> from optparse import OptionParser <EOL> logger = logging . getLogger ( ) <EOL> hdlr = logging . StreamHandler ( ) <EOL> logger . addHandler ( hdlr ) <EOL> usage = '<STR_LIT>' <EOL> parser = OptionParser ( usage ) <EOL> parser . add_option ( '<STR_LIT>' , '<STR_LIT>' , dest = '<STR_LIT>' , action = '<STR_LIT:store_true>' , help = '<STR_LIT>' ) <EOL> parser . add_option ( '<STR_LIT>' , '<STR_LIT>' , dest = '<STR_LIT>' , action = '<STR_LIT:store_true>' , help = '<STR_LIT>' ) <EOL> parser . add_option ( '<STR_LIT>' , '<STR_LIT>' , dest = '<STR_LIT>' , action = '<STR_LIT:store_true>' , default = False , help = '<STR_LIT>' ) <EOL> parser . add_option ( '<STR_LIT>' , '<STR_LIT>' , dest = '<STR_LIT>' , help = '<STR_LIT>' ) <EOL> ( options , args ) = parser . parse_args ( ) <EOL> logger . setLevel ( logging . WARNING ) <EOL> if options . debug : <EOL> logger . setLevel ( logging . DEBUG ) <EOL> elif options . verbose : <EOL> logger . setLevel ( logging . INFO ) <EOL> for f in args : <EOL> if os . path . isdir ( f ) : <EOL> import certfuzz . fuzztools . filetools <EOL> if options . pattern : <EOL> pat = options . pattern <EOL> else : <EOL> pat = '<STR_LIT:*>' <EOL> for x in certfuzz . fuzztools . filetools . all_files ( f , patterns = pat ) : <EOL> if '<STR_LIT>' in os . path . dirname ( x ) : <EOL> continue <EOL> _analyze_file ( x , options . print_backtrace ) <EOL> elif os . path . isfile ( f ) : <EOL> _analyze_file ( f , options . print_backtrace ) </s>
