Quick question on stripping, I'm executing a simple program, but whenever I try and run it in Terminal, it strips all wrong. The error it puts out is below. It iterates [+]Trying: admin/admin for the first line, but wont repeat it for the rest of the lines, as well as messing up right around pass/passg:, stripping the wrong thing, (It's supposed to say 'pass/pass'.
Any ideas?
+] Trying: admin/admin
guest/guest
pass/passg:
Traceback (most recent call last):
File "/Users/someuser/Desktop/Python3/logon.py", line 27, in <module>
iterate(host, passwdFile)
File "/Users/someuser/Desktop/Python3/logon.py", line 10, in logon
passWord = line.split(':')[1].strip('\n').strip('\r')
IndexError: list index out of range
logout
def iterate(hostname, passwdFile):
pF = open(passwdFile, 'r')
for line in pF.readlines():
userName = line.split(':')[0]
passWord = line.split(':')[1].strip('\n').strip('\r')
print '[+] Trying: ' + userName + "/" + passWord
passwdFile = 'some password file, formatted like [user:password], then a newline, [user:password]...'