python怎么重复输入密码直至正确_python – 如何使rdpy-rdpmitm让客户端重新输入用户名和密码时密码不正确...

我使用rdpy的rdpy-rdpmitm演示来实现一个rdp代理,但是我想在连接到目标之前检查密码,并让客户端重新输入用户名和密码。我的代码是这样的如何实现OnReady方法?

class ProxyServer(rdp.RDPServerObserver):

def __init__(self, controller, target, clientSecurityLevel, rssRecorder):

"""

@param controller: {RDPServerController}

@param target: {tuple(ip, port)}

@param rssRecorder: {rss.FileRecorder} use to record session

"""

rdp.RDPServerObserver.__init__(self, controller)

self._target = target

self._client = None

self._rss = rssRecorder

self._clientSecurityLevel = clientSecurityLevel

def onReady(self):

"""

@summary: Event use to inform state of server stack

First time this event is called is when human client is connected

Second time is after color depth nego, because color depth nego

restart a connection sequence

@see: rdp.RDPServerObserver.onReady

"""

if self._client is None:

# try a connection

domain, username, password = self._controller.getCredentials()

self._rss.credentials(username, password, domain, self._controller.getHostname())

width, height = self._controller.getScreen()

self._rss.screen(width, height, self._controller.getColorDepth())

if checkPassword(username, password): #password ok

reactor.connectTCP('127.0.0.1', 3389, ProxyClientFactory(self, width, height, domain, username, password,self._clientSecurityLevel))

else:

pass

#how to make client re-input username and password in this place

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值