<s> from os import listdir <EOL> from os . path import isfile , join <EOL> import imp <EOL> from routersploit import ( <EOL> exploits , <EOL> print_success , <EOL> print_error , <EOL> print_status , <EOL> ) <EOL> class Exploit ( exploits . Exploit ) : <EOL> """<STR_LIT>""" <EOL> __info__ = { <EOL> '<STR_LIT:name>' : '<STR_LIT>' , <EOL> '<STR_LIT:description>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : [ <EOL> '<STR_LIT>' , <EOL> ] , <EOL> } <EOL> target = exploits . Option ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> port = exploits . Option ( <NUM_LIT> , '<STR_LIT>' ) <EOL> def run ( self ) : <EOL> rootpath = '<STR_LIT>' <EOL> path = '<STR_LIT>' <EOL> modules = [ f . replace ( "<STR_LIT>" , "<STR_LIT>" ) for f in listdir ( rootpath + path ) if isfile ( join ( rootpath + path , f ) ) and f . endswith ( "<STR_LIT>" ) and f != "<STR_LIT>" ] <EOL> vulns = [ ] <EOL> for module_name in modules : <EOL> f = path + module_name <EOL> module = imp . load_source ( '<STR_LIT>' , rootpath + f + '<STR_LIT>' ) <EOL> exploit = module . Exploit ( ) <EOL> exploit . target = self . target <EOL> exploit . port = self . port <EOL> res = exploit . check ( ) <EOL> if res is True : <EOL> print_success ( "<STR_LIT>" . format ( f ) ) <EOL> vulns . append ( f ) <EOL> elif res is False : <EOL> print_error ( "<STR_LIT>" . format ( f ) ) <EOL> else : <EOL> print_status ( "<STR_LIT>" . format ( f ) ) <EOL> print <EOL> if len ( vulns ) : <EOL> print_success ( "<STR_LIT>" ) <EOL> for v in vulns : <EOL> print "<STR_LIT>" . format ( v ) <EOL> else : <EOL> print_error ( "<STR_LIT>" ) <EOL> print <EOL> def check ( self ) : <EOL> print_error ( "<STR_LIT>" ) </s>
