标签:password python justin return import
import socket import paramiko import threading import sys host_key= paramiko.RSAKey(filename=‘test_rsa.key‘) class Server(paramiko.ServerInterface): def __init__(self): self.event = threading.Event() def check_channel_request(self,kind,chanid): if kind == ‘session‘: return paramiko.OPEN_SUCCEEDED return paramiko.OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED def check_auth_password(self,username,password): if(username == ‘justin‘) and (password == ‘lovethepython‘): return paramiko.AUTH_SUCCESSFUL return paramiko.AUTH_FAILED server = sys.argv[1] ssh_port = int(sys.argv[2]) try: sock = socket.socket(socket.AF_INET,socket.SOCK_STREAM) sock.setsockopt(socket.SOL_SOCKET,socket.SO_REUSEADDR,1) sock.bind(server,ssh_port) sock.listen(100) print ‘[+] Listen for connection‘ client,addr = sock.accept() except Exception,e: print ‘[-] Listen failed:‘+str(e) sys.exit(1) print ‘[+] Got a connection!‘
本文出自 “专注php” 博客,请务必保留此出处http://jingshanls.blog.51cto.com/3357095/1788483
标签:password python justin return import
原文地址:http://jingshanls.blog.51cto.com/3357095/1788483