我很难理解“Bounded.Semaphore”在这个特定代码中的作用。我在YT上找了一些例子和视频,没有任何帮助。 下面是完整的代码:https://github.com/tatmush/violentPython3/blob/master/Chapter-2/3-sshBrute.py
maxConnections = 5
connectionLock = BoundedSemaphore(value=maxConnections)
try:
s=pxssh.pxssh()
s.login(host, user, password)
print('[+]Password Found: ' + password)
found=True
print('Found in CONNECT: {}'.format(found))
except Exception as e:
print(e)
if 'read_nonblocking' in str(e):
logging.debug('Now in if statement')
fails+=1
time.sleep(5)
connect(host, user, password, False)
elif 'synchronize with original prompt' in str(e):
logging.debug('Now in elif')
time.sleep(1)
connect(host, user, password, False)
finally:
if release: connectionLock.release()
目前没有回答
相关问题 更多 >
编程相关推荐