<s> from datetime import date , datetime <EOL> from src . core . log import * <EOL> from inspect import isclass <EOL> import src . core . fuzzer <EOL> import pkgutil <EOL> import importlib <EOL> import platform <EOL> import config <EOL> def msg ( string , level = INFO ) : <EOL> """<STR_LIT>""" <EOL> string = "<STR_LIT>" % ( timestamp ( ) , string ) <EOL> color_string = None <EOL> if '<STR_LIT>' in platform . platform ( ) . lower ( ) : <EOL> if level is INFO : <EOL> color_string = '<STR_LIT>' % ( '<STR_LIT>' , string , '<STR_LIT>' ) <EOL> elif level is DEBUG : <EOL> color_string = '<STR_LIT>' % ( '<STR_LIT>' , string , '<STR_LIT>' ) <EOL> elif level is ERROR : <EOL> color_string = '<STR_LIT>' % ( '<STR_LIT>' , string , '<STR_LIT>' ) <EOL> else : <EOL> color_string = string <EOL> if not color_string : <EOL> color_string = string <EOL> if level is DEBUG and not config . DEBUG : <EOL> return <EOL> if not level is LOG : <EOL> print color_string <EOL> log ( string ) <EOL> def timestamp ( ) : <EOL> """<STR_LIT>""" <EOL> return '<STR_LIT>' % ( date . today ( ) . isoformat ( ) , <EOL> datetime . now ( ) . strftime ( "<STR_LIT>" ) ) <EOL> def log ( string ) : <EOL> """<STR_LIT>""" <EOL> with open ( config . LOG_FILE , "<STR_LIT>" ) as f : <EOL> f . write ( "<STR_LIT>" % ( timestamp ( ) , string ) ) <EOL> def list_fuzzers ( ) : <EOL> """<STR_LIT>""" <EOL> msg ( "<STR_LIT>" ) <EOL> try : <EOL> load = importlib . import_module ( "<STR_LIT>" ) <EOL> modules = list ( pkgutil . iter_modules ( load . __path__ ) ) <EOL> for mod in modules : <EOL> dp = mod [ <NUM_LIT:0> ] . find_module ( mod [ <NUM_LIT:1> ] ) . load_module ( mod [ <NUM_LIT:1> ] ) <EOL> for e in dir ( dp ) : <EOL> x = getattr ( dp , e ) <EOL> if isclass ( x ) and e != "<STR_LIT>" and issubclass ( x , src . core . fuzzer . Fuzzer ) : <EOL> msg ( "<STR_LIT>" % ( x ( ) . name , mod [ <NUM_LIT:1> ] ) ) <EOL> except Exception , e : <EOL> msg ( "<STR_LIT>" % e , ERROR ) <EOL> def dict_delta ( first , second ) : <EOL> """<STR_LIT>""" <EOL> diff = { } <EOL> comb = dict ( first . items ( ) + second . items ( ) ) <EOL> for key in comb . keys ( ) : <EOL> if not first . has_key ( key ) : <EOL> diff [ key ] = second [ key ] <EOL> elif not second . has_key ( key ) : <EOL> diff [ key ] = first [ key ] <EOL> return diff </s>
