def __init__(self, hostname, username, domain="", password="", lmhash="", nthash="", log_options=Logger.Options(), dump_options=Dumper.Options(), parse_options=Parser.Options(), write_options=Writer.Options()): self.conn_options = ImpacketConnection.Options(hostname, domain, username, password, lmhash, nthash) self.log_options = log_options self.dump_options = dump_options self.parse_options = parse_options self.write_options = write_options self._target = hostname self._log = Logger(self._target, log_options) self._conn = None self._dumper = None self._parser = None self._dumpfile = None self._credentials = [] self._writer = None
def setUp(self): self.log = Logger(Logger.Options(verbosity=0, quiet=True)) self.conn = ImpacketConnection( ImpacketConnection.Options(target, domain, da_login, da_password)) self.conn.set_logger(self.log) self.conn.login() self.ifile = ImpacketFile(self.conn, self.log)
def test_login_login_success(self): self.conn = ImpacketConnection( ImpacketConnection.Options(target, domain, da_login, da_password)) self.conn.set_logger(self.log) ret = self.conn.login() self.assertIsInstance(ret, RetCode) self.assertEqual(ERROR_SUCCESS[1], ret.error_msg)
def setUp(self): self.log = Logger(Logger.Options(verbosity=0, quiet=True)) self.conn = ImpacketConnection( ImpacketConnection.Options(ip_address_protected, domain, da_login, da_password)) self.conn.set_logger(self.log) self.conn.login()
def __init__(self, target): self.conn_options = ImpacketConnection.Options() self.log_options = Logger.Options() self.dump_options = Dumper.Options() self.parse_options = Parser.Options() self.write_options = Writer.Options() self.lsassy = None self.target = target
def test_login_login_error(self): self.conn = ImpacketConnection( ImpacketConnection.Options(target, domain, da_login, "wrong_password")) self.conn.set_logger(self.log) ret = self.conn.login() self.assertIsInstance(ret, RetCode) self.assertEqual(ERROR_LOGIN_FAILURE[1], ret.error_msg)
def test_login_connection_error(self): self.conn = ImpacketConnection( ImpacketConnection.Options("255.255.255.255", domain, da_login, da_password)) self.conn.set_logger(self.log) ret = self.conn.login() self.assertIsInstance(ret, RetCode) self.assertEqual(ERROR_CONNECTION_ERROR[1], ret.error_msg)
def test_login_dns_error(self): self.conn = ImpacketConnection( ImpacketConnection.Options("pixis.hackndo", domain, da_login, da_password)) self.conn.set_logger(self.log) ret = self.conn.login() self.assertIsInstance(ret, RetCode) self.assertEqual(ERROR_DNS_ERROR[1], ret.error_msg)
def test_is_admin_error(self): self.conn = ImpacketConnection( ImpacketConnection.Options(target, domain, usr_login, usr_password)) self.conn.set_logger(self.log) self.conn.login() ret = self.conn.isadmin() self.assertIsInstance(ret, RetCode) self.assertEqual(ERROR_ACCESS_DENIED[1], ret.error_msg)
def test_is_admin(self): self.conn = ImpacketConnection( ImpacketConnection.Options(ip_address, domain, da_login, da_password)) self.conn.set_logger(self.log) self.conn.login() ret = self.conn.isadmin() self.assertIsInstance(ret, RetCode) self.assertEqual(ERROR_SUCCESS[1], ret.error_msg)