Paramiko start_server Not Working



我创建了一个通过Paramiko和socket访问服务器的程序。

#make imports
from socket import *
from datetime import datetime
from pickle import load, dump
from Crypto.Hash import SHA256
from subprocess import check_output as exeCMD
from sqlite3 import connect as SQLconnect
import paramiko, sys, threading, os
#get password from file
pasword = load(open("usrData/pswd.txt", "rb"))
#class for initiating server connection with client
class Server(paramiko.ServerInterface):
    #initialize object
    def __init__(self):
        self.event = threading.Event()
    #check password for user entry
    def check_auth_password(self, username, password):
        #where the error is
        givenpswdHash = SHA256.new(password)
        print(givenpswdHash.hexdigest())
        if (username in unameList) and (givenpswdHash.hexdigest() == pasword):
            return paramiko.AUTH_SUCCESSFUL
        return paramiko.AUTH_FAILED
#what to execute in command line
def terminal(hostIP, hostPort, hostKeyPath, hostKeyPswd):
    #create sockets before this etc...
    #create server instance
    server = Server()
    #get server onto session
    #where we call out server function
    session.start_server(server=server)
    #continue talking to client

当我启动服务器,并得到一个客户端连接到它,我得到这个错误:

No handlers could be found for logger "paramiko.transport"
Traceback (most recent call last):
  File "./terminalServer.py", line 212, in <module>
    main()
  File "./terminalServer.py", line 209, in main
    terminal(ip, port, keyPath, keyPswd)
  File "./terminalServer.py", line 142, in terminal
    session.start_server(server=server)
  File "/usr/local/lib/python2.7/dist-packages/paramiko/transport.py", line 471, in start_server
    raise e
ValueError: CTR mode needs counter parameter, not IV

它与我为密码验证添加的Crypto有关。如果有人知道如何解决这个问题,请请留下评论。

我所要做的就是用稳定版本替换pycrypto的所有alpha版本。pycrypto当前的稳定版本(2015年9月1日)是2.6.1,paramiko是1.14.2。

相关内容

  • 没有找到相关文章

最新更新