本文整理汇总了Python中poplib.POP3属性的典型用法代码示例。如果您正苦于以下问题:Python poplib.POP3属性的具体用法?Python poplib.POP3怎么用?Python poplib.POP3使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类poplib
的用法示例。
在下文中一共展示了poplib.POP3属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: check
# 需要导入模块: import poplib [as 别名]
# 或者: from poplib import POP3 [as 别名]
def check(email, password):
try:
email = email
password = password
pop3_server = "pop.163.com"
server = poplib.POP3(pop3_server)
#ssl加密后使用
#server = poplib.POP3_SSL('pop.163.com', '995')
print(server.set_debuglevel(1)) #打印与服务器交互信息
print(server.getwelcome()) #pop有欢迎信息
server.user(email)
server.pass_(password)
print('Messages: %s. Size: %s' % server.stat())
print(email+": successful")
except poplib.error_proto as e:
print(email+":fail")
print(e)
示例2: _test_pop
# 需要导入模块: import poplib [as 别名]
# 或者: from poplib import POP3 [as 别名]
def _test_pop(self, hostname, port=None, timeout=5):
pop3server = poplib.POP3(hostname, port, timeout)
pop3server.user('popuser')
pop3server.pass_('password')
msg = pop3server.retr(1)
response = msg[0]
lines = msg[1]
octets = msg[2]
if not response.startswith('+OK'):
msg = 'POP3 response does not start with "+OK"'
logger.error(msg)
return False
if not 'Alice' in ''.join(lines):
msg = 'POP3 message did not contain expected string'
raise FakeNetTestException(msg)
return False
return True
示例3: run
# 需要导入模块: import poplib [as 别名]
# 或者: from poplib import POP3 [as 别名]
def run(self):
value = getword()
try:
print "-"*12
print "User:",user[:-1],"Password:",value
pop = poplib.POP3(ip)
pop.user(user[:-1])
pop.pass_(value)
print "\t\nLogin successful:",value, user
print pop.stat()
pop.quit()
work.join()
sys.exit(2)
except(poplib.error_proto), msg:
#print "An error occurred:", msg
pass
示例4: run
# 需要导入模块: import poplib [as 别名]
# 或者: from poplib import POP3 [as 别名]
def run(self):
value = getword()
try:
print "-"*12
print "User:",user[:-1],"Password:",value
pop = poplib.POP3(ipaddr[0])
pop.user(user[:-1])
pop.pass_(value)
print "\t\nLogin successful:",value, user
print pop.stat()
pop.quit()
work.join()
sys.exit(2)
except(poplib.error_proto, socket.gaierror, socket.error, socket.herror), msg:
#print "An error occurred:", msg
pass
示例5: run
# 需要导入模块: import poplib [as 别名]
# 或者: from poplib import POP3 [as 别名]
def run(self):
value, user = getword()
try:
print "-"*12
print "User:",user,"Password:",value
pop = poplib.POP3(sys.argv[1])
pop.user(user)
pop.pass_(value)
print "\t\nLogin successful:",value, user
print pop.stat()
pop.quit()
work.join()
sys.exit(2)
except (poplib.error_proto), msg:
#print "An error occurred:", msg
pass
示例6: getmail
# 需要导入模块: import poplib [as 别名]
# 或者: from poplib import POP3 [as 别名]
def getmail():
FROM = ""
SUBJECT = ""
try:
M = poplib.POP3('mail.darkc0de.com')
M.user(USER)
M.pass_(PASSWORD)
c = M.stat()[0]
numMessages = len(M.list()[1])
for i in range(numMessages):
SUBJECT = M.retr(i+1)[1][15]
FROM = M.retr(i+1)[1][16]
except (poplib.error_proto), msg:
c = -1
print "Mail Failed:",msg
pass
示例7: get_pop3
# 需要导入模块: import poplib [as 别名]
# 或者: from poplib import POP3 [as 别名]
def get_pop3(server, user, sender):
result = FAIL
try:
box = poplib.POP3(server)
box.user(user[0])
box.pass_(user[1])
response, lst, octets = box.list()
for msgnum, msgsize in [i.split() for i in lst]:
resp, lines, octets = box.retr(msgnum)
msgtext = " ".join(lines)
if content.format(sender[0]) in msgtext:
result = OK
box.dele(msgnum)
box.quit()
return result
except Exception as e:
print "Error while recivieng mail"
print e
return FAIL
示例8: pillage
# 需要导入模块: import poplib [as 别名]
# 或者: from poplib import POP3 [as 别名]
def pillage(self, username, password, server, port, domain, outputdir="."):
print("%s, %s, %s, %s" % (username, password, server, domain))
mail = None
if (port == 993):
mail = IMAPS(outputdir=outputdir)
elif (port == 143):
mail = IMAP(outputdir=outputdir)
elif (port == 995):
mail = POP3S(outputdir=outputdir)
elif (port == 110):
mail = POP3(outputdir=outputdir)
else:
print("ERROR, unknown port provided")
return
mail.connect(server)
t = Thread(target=self.tworker, args=(mail, username, password, domain, server, port,))
t.start()
#-----------------------------------------------------------------------------
# main test code
#-----------------------------------------------------------------------------
示例9: found_terminator
# 需要导入模块: import poplib [as 别名]
# 或者: from poplib import POP3 [as 别名]
def found_terminator(self):
line = ''.join(self.in_buffer)
self.in_buffer = []
cmd = line.split(' ')[0].lower()
space = line.find(' ')
if space != -1:
arg = line[space + 1:]
else:
arg = ""
if hasattr(self, 'cmd_' + cmd):
method = getattr(self, 'cmd_' + cmd)
method(arg)
else:
self.push('-ERR unrecognized POP3 command "%s".' %cmd)
示例10: setUp
# 需要导入模块: import poplib [as 别名]
# 或者: from poplib import POP3 [as 别名]
def setUp(self):
self.server = DummyPOP3Server((HOST, 0))
self.server.start()
self.client = poplib.POP3(self.server.host, self.server.port)
示例11: testTimeoutDefault
# 需要导入模块: import poplib [as 别名]
# 或者: from poplib import POP3 [as 别名]
def testTimeoutDefault(self):
self.assertIsNone(socket.getdefaulttimeout())
socket.setdefaulttimeout(30)
try:
pop = poplib.POP3(HOST, self.port)
finally:
socket.setdefaulttimeout(None)
self.assertEqual(pop.sock.gettimeout(), 30)
pop.sock.close()
示例12: testTimeoutNone
# 需要导入模块: import poplib [as 别名]
# 或者: from poplib import POP3 [as 别名]
def testTimeoutNone(self):
self.assertIsNone(socket.getdefaulttimeout())
socket.setdefaulttimeout(30)
try:
pop = poplib.POP3(HOST, self.port, timeout=None)
finally:
socket.setdefaulttimeout(None)
self.assertIsNone(pop.sock.gettimeout())
pop.sock.close()
示例13: testTimeoutValue
# 需要导入模块: import poplib [as 别名]
# 或者: from poplib import POP3 [as 别名]
def testTimeoutValue(self):
pop = poplib.POP3(HOST, self.port, timeout=30)
self.assertEqual(pop.sock.gettimeout(), 30)
pop.sock.close()
示例14: mailbruteforce
# 需要导入模块: import poplib [as 别名]
# 或者: from poplib import POP3 [as 别名]
def mailbruteforce(listuser,listpwd):
if len(listuser) < 1 or len(listpwd) < 1 :
print "An error occurred: No user or pass list"
return 1
for user in listuser:
for value in listpwd :
user = user.replace("\n","")
value = value.replace("\n","")
try:
print "-"*12
print "[+] User:",user,"Password:",value
time.sleep(2)
pop = poplib.POP3(server,110)
pop.user(user)
auth = pop.pass_(value)
print auth
if auth =="+OK":
pop.quit()
print "unknown error !"
continue
if pop.stat()[1] is None or pop.stat()[1] < 1 :
pop.quit()
print "unknown error !"
continue
#print "\t\t\n\nLogin successful:",user, value
#print "\t\tMail:",pop.stat()[0],"emails"
#print "\t\tSize:",pop.stat()[1],"bytes\n\n"
ret = (user,value,pop.stat()[0],pop.stat()[1])
success.append(ret)
#print len(success)
pop.quit()
break
except:
#print "An error occurred:", msg
pass
示例15: mailbruteforce
# 需要导入模块: import poplib [as 别名]
# 或者: from poplib import POP3 [as 别名]
def mailbruteforce(listuser,listpwd,type):
if len(listuser) < 1 or len(listpwd) < 1 :
print "[-] Error: An error occurred: No user or pass list\n"
return 1
for user in listuser:
for passwd in listpwd :
user = user.replace("\n","")
passwd = passwd.replace("\n","")
try:
print "-"*12
print "[+] User:",user,"Password:",passwd
# time.sleep(0.1)
if type in ['163','236']:
popserver = poplib.POP3(server,110)
else:
popserver = poplib.POP3_SSL(server,995)
popserver.user(user)
auth = popserver.pass_(passwd)
print auth
if auth.split(' ')[0] == "+OK" or auth =="+OK":
ret = (user,passwd,popserver.stat()[0],popserver.stat()[1])
success.append(ret)
#print len(success)
popserver.quit()
break
else :
popserver.quit()
continue
except:
#print "An error occurred:", msg
pass