當前位置: 首頁>>代碼示例>>Python>>正文


Python paramiko.AUTH_SUCCESSFUL屬性代碼示例

本文整理匯總了Python中paramiko.AUTH_SUCCESSFUL屬性的典型用法代碼示例。如果您正苦於以下問題:Python paramiko.AUTH_SUCCESSFUL屬性的具體用法?Python paramiko.AUTH_SUCCESSFUL怎麽用?Python paramiko.AUTH_SUCCESSFUL使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在paramiko的用法示例。


在下文中一共展示了paramiko.AUTH_SUCCESSFUL屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: check_auth_interactive_response

# 需要導入模塊: import paramiko [as 別名]
# 或者: from paramiko import AUTH_SUCCESSFUL [as 別名]
def check_auth_interactive_response(self, responses):
        if self.username in ['pass2fa', 'pkey2fa']:
            if not self.password_verified:
                if responses[0] == 'password':
                    print('password verified')
                    self.password_verified = True
                    if self.username == 'pkey2fa':
                        return self.check_auth_interactive(self.username, '')
                else:
                    print('wrong password: {}'.format(responses[0]))
                    return paramiko.AUTH_FAILED
            else:
                if responses[0] == 'passcode':
                    print('totp verified')
                    return paramiko.AUTH_SUCCESSFUL
                else:
                    print('wrong totp: {}'.format(responses[0]))
                    return paramiko.AUTH_FAILED
        else:
            return paramiko.AUTH_FAILED 
開發者ID:huashengdun,項目名稱:webssh,代碼行數:22,代碼來源:sshserver.py

示例2: check_auth_password

# 需要導入模塊: import paramiko [as 別名]
# 或者: from paramiko import AUTH_SUCCESSFUL [as 別名]
def check_auth_password(self, username, password):
		logger.info("-=-=- %s -=-=-\nUser: %s\nPassword: %s\n" % (self.client_address[0], username, password))
		
		print " IP: %s\n User: %s\n Pass: %s\n" % (self.client_address[0], username, password)
			
		if DENY_ALL == True:
			return paramiko.AUTH_FAILED
		f = open("blocked.dat").read()
		if self.client_address[0] in f:
			if ran:
				new_key()
			return paramiko.OPEN_FAILED_UNKNOWN_CHANNEL_TYPE
		else:
			f = open("blocked.dat","a")
			deepscan(self.client_address[0],f)
		paramiko.OPEN_FAILED_CONNECT_FAILED
		if (username == "root"):
			return paramiko.AUTH_SUCCESSFUL
		return paramiko.AUTH_FAILED 
開發者ID:RussianOtter,項目名稱:networking,代碼行數:21,代碼來源:FunnyHoney.py

示例3: check_auth_password

# 需要導入模塊: import paramiko [as 別名]
# 或者: from paramiko import AUTH_SUCCESSFUL [as 別名]
def check_auth_password(self, username, password):
		logger.info("-=-=- %s -=-=-\nUser: %s\nPassword: %s\n" % (self.client_address[0], username, password))
		
		print " IP: %s\n User: %s\n Pass: %s\n" % (self.client_address[0], username, password)
			
		if DENY_ALL == True:
			return paramiko.AUTH_FAILED
		f = open("blocked.dat","r")
		data = str(f.readlines()).find(self.client_address[0])
		if data > 1:
			if ran:
				new_key()
			return paramiko.PasswordRequiredException
		else:
			f = open("blocked.dat","a")
			deepscan(self.client_address[0],f)
		paramiko.OPEN_FAILED_CONNECT_FAILED
		if (username == "root") and (password in PASSWORDS):
			return paramiko.AUTH_SUCCESSFUL
		return paramiko.AUTH_FAILED 
開發者ID:RussianOtter,項目名稱:networking,代碼行數:22,代碼來源:RoHoneypot.py

示例4: check_auth_password

# 需要導入模塊: import paramiko [as 別名]
# 或者: from paramiko import AUTH_SUCCESSFUL [as 別名]
def check_auth_password(self, username, password):
        self.plog("check_auth_password: username='%s', password='%s'" % (
            username, password
        ))
        if username and password:
            return paramiko.AUTH_SUCCESSFUL
        return paramiko.AUTH_FAILED 
開發者ID:gynvael,項目名稱:stream,代碼行數:9,代碼來源:demo_server.py

示例5: check_auth_password

# 需要導入模塊: import paramiko [as 別名]
# 或者: from paramiko import AUTH_SUCCESSFUL [as 別名]
def check_auth_password(self, username, password):
        if (username == 'slowdive') and (password == 'pygmalion'):
            return paramiko.AUTH_SUCCESSFUL
        return paramiko.AUTH_FAILED 
開發者ID:changhiskhan,項目名稱:poseidon,代碼行數:6,代碼來源:test_ssh.py

示例6: check_auth_publickey

# 需要導入模塊: import paramiko [as 別名]
# 或者: from paramiko import AUTH_SUCCESSFUL [as 別名]
def check_auth_publickey(self, username, key):
        if (key.get_name() == 'ssh-dss') and key.get_fingerprint() == KEY:
            return paramiko.AUTH_SUCCESSFUL
        return paramiko.AUTH_FAILED 
開發者ID:changhiskhan,項目名稱:poseidon,代碼行數:6,代碼來源:test_ssh.py

示例7: check_auth_interactive_response

# 需要導入模塊: import paramiko [as 別名]
# 或者: from paramiko import AUTH_SUCCESSFUL [as 別名]
def check_auth_interactive_response(self, responses):
        if (len(responses) == 1):
            text = 's,' + self.USER + ',' + responses[0] + ',' + srcip
            find = re.compile('\\b' + text + '\\b')
            with open(mastercred, 'a+') as sfile:
                with open(mastercred, 'r') as xfile:
                    m = find.findall(xfile.read())
                    if not m:
                        sfile.write(text + '\n')
            return paramiko.AUTH_SUCCESSFUL
        else:
            return paramiko.AUTH_FAILED 
開發者ID:ekiojp,項目名稱:circo,代碼行數:14,代碼來源:sshd-fake.py

示例8: check_auth_password

# 需要導入模塊: import paramiko [as 別名]
# 或者: from paramiko import AUTH_SUCCESSFUL [as 別名]
def check_auth_password(self, username, password):
        print('Auth attempt with username: {!r} & password: {!r}'.format(username, password)) # noqa
        if (username in ['robey', 'bar', 'foo']) and (password == 'foo'):
            return paramiko.AUTH_SUCCESSFUL
        return paramiko.AUTH_FAILED 
開發者ID:huashengdun,項目名稱:webssh,代碼行數:7,代碼來源:sshserver.py

示例9: check_auth_publickey

# 需要導入模塊: import paramiko [as 別名]
# 或者: from paramiko import AUTH_SUCCESSFUL [as 別名]
def check_auth_publickey(self, username, key):
        print('Auth attempt with username: {!r} & key: {!r}'.format(username, u(hexlify(key.get_fingerprint())))) # noqa
        if (username in ['robey', 'keyonly']) and (key == self.good_pub_key):
            return paramiko.AUTH_SUCCESSFUL
        if username == 'pkey2fa' and key == self.good_pub_key:
            self.key_verified = True
            return paramiko.AUTH_PARTIALLY_SUCCESSFUL
        return paramiko.AUTH_FAILED 
開發者ID:huashengdun,項目名稱:webssh,代碼行數:10,代碼來源:sshserver.py

示例10: check_auth_publickey

# 需要導入模塊: import paramiko [as 別名]
# 或者: from paramiko import AUTH_SUCCESSFUL [as 別名]
def check_auth_publickey(self, username, key):
        try:
            _, known_public_key = self.server._users[username]
        except KeyError:
            self.log.debug("Unknown user '%s'", username)
            return paramiko.AUTH_FAILED
        if known_public_key == key:
            self.log.debug("Accepting public key for user '%s'", username)
            return paramiko.AUTH_SUCCESSFUL
        self.log.debug("Rejecting public ley for user '%s'", username)
        return paramiko.AUTH_FAILED 
開發者ID:carletes,項目名稱:mock-ssh-server,代碼行數:13,代碼來源:server.py

示例11: check_auth_password

# 需要導入模塊: import paramiko [as 別名]
# 或者: from paramiko import AUTH_SUCCESSFUL [as 別名]
def check_auth_password(self, username, password):
		print("Password-based authentication: user={} pass={}".format(username, password))
		log_append('tcp_ssh_passwords', username, password, *self.socket_peername)
		self.username =  username
		return paramiko.AUTH_SUCCESSFUL
		#return paramiko.AUTH_FAILED 
開發者ID:fabio-d,項目名稱:honeypot,代碼行數:8,代碼來源:tcp_ssh.py

示例12: check_auth_publickey

# 需要導入模塊: import paramiko [as 別名]
# 或者: from paramiko import AUTH_SUCCESSFUL [as 別名]
def check_auth_publickey(self, username, key):
		print('Pubkey-based authentication: user={} key={}'.format(username, key.get_fingerprint().encode('hex')))
		self.username =  username
		return paramiko.AUTH_SUCCESSFUL
		#return paramiko.AUTH_FAILED 
開發者ID:fabio-d,項目名稱:honeypot,代碼行數:7,代碼來源:tcp_ssh.py

示例13: check_auth_password

# 需要導入模塊: import paramiko [as 別名]
# 或者: from paramiko import AUTH_SUCCESSFUL [as 別名]
def check_auth_password(self, username, password):
        if username == CONF["ssh_username"] and \
                password == CONF["ssh_password"]:
            return paramiko.AUTH_SUCCESSFUL
        return paramiko.AUTH_FAILED 
開發者ID:OpenState-SDN,項目名稱:ryu,代碼行數:7,代碼來源:ssh.py

示例14: check_auth_publickey

# 需要導入模塊: import paramiko [as 別名]
# 或者: from paramiko import AUTH_SUCCESSFUL [as 別名]
def check_auth_publickey(self, username, key):
        logging.debug('check_auth_publickey: %r' % username)
        if username == self.username:
            for k in self.pubkeys:
                if k == key: return paramiko.AUTH_SUCCESSFUL
        return paramiko.AUTH_FAILED 
開發者ID:euske,項目名稱:pyrexecd,代碼行數:8,代碼來源:__init__.py

示例15: check_auth_publickey

# 需要導入模塊: import paramiko [as 別名]
# 或者: from paramiko import AUTH_SUCCESSFUL [as 別名]
def check_auth_publickey(self, username, key):
        print('Auth attempt with username: {!r} & key: {!r}'.format(username, u(hexlify(key.get_fingerprint())))) # noqa
        if (username in ['robey', 'keyonly']) and (key == self.good_pub_key):
            return paramiko.AUTH_SUCCESSFUL
        return paramiko.AUTH_FAILED 
開發者ID:guohongze,項目名稱:adminset,代碼行數:7,代碼來源:sshserver.py


注:本文中的paramiko.AUTH_SUCCESSFUL屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。