当前位置: 首页>>代码示例>>Python>>正文


Python poplib.error_proto方法代码示例

本文整理汇总了Python中poplib.error_proto方法的典型用法代码示例。如果您正苦于以下问题:Python poplib.error_proto方法的具体用法?Python poplib.error_proto怎么用?Python poplib.error_proto使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在poplib的用法示例。


在下文中一共展示了poplib.error_proto方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: check

# 需要导入模块: import poplib [as 别名]
# 或者: from poplib import error_proto [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) 
开发者ID:euphrat1ca,项目名称:fuzzdb-collect,代码行数:20,代码来源:Testpop.py

示例2: main

# 需要导入模块: import poplib [as 别名]
# 或者: from poplib import error_proto [as 别名]
def main(hostname,port,user,password):

        mailbox = poplib.POP3_SSL(hostname,port)

        try:
                mailbox.user(user)
                mailbox.pass_(password)
                response, listings, octet_count = mailbox.list()
                for listing in listings:
                        number, size = listing.decode('ascii').split()
                        print("Message %s has %s bytes" % (number, size))

        except poplib.error_proto as exception:
                print("Login failed:", exception)

        finally:
                mailbox.quit() 
开发者ID:PacktPublishing,项目名称:Learning-Python-Networking-Second-Edition,代码行数:19,代码来源:mailbox_basic_params.py

示例3: run

# 需要导入模块: import poplib [as 别名]
# 或者: from poplib import error_proto [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 
开发者ID:knightmare2600,项目名称:d4rkc0de,代码行数:18,代码来源:popbrute_iprange.py

示例4: run

# 需要导入模块: import poplib [as 别名]
# 或者: from poplib import error_proto [as 别名]
def run(self):
		value, user = getword()
		user = user.replace("\n","")
		value = value.replace("\n","")
		
		try:
			print "-"*12
			print "[+] User:",user,"Password:",value
			pop = poplib.POP3_SSL(server, 995)
			pop.user(user)
			pop.pass_(value)
			print "\t\t\n\nLogin successful:",user, value
			print "\t\tMail:",pop.stat()[0],"emails"
			print "\t\tSize:",pop.stat()[1],"bytes\n\n"
			success.append(user)
			success.append(value)
			success.append(pop.stat()[0])
			success.append(pop.stat()[1])
			pop.quit()
		except (poplib.error_proto), msg: 
			#print "An error occurred:", msg
			pass 
开发者ID:knightmare2600,项目名称:d4rkc0de,代码行数:24,代码来源:gmailpopbrute.py

示例5: run

# 需要导入模块: import poplib [as 别名]
# 或者: from poplib import error_proto [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 
开发者ID:knightmare2600,项目名称:d4rkc0de,代码行数:18,代码来源:popbrute_random.py

示例6: run

# 需要导入模块: import poplib [as 别名]
# 或者: from poplib import error_proto [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 
开发者ID:knightmare2600,项目名称:d4rkc0de,代码行数:18,代码来源:popbrute.py

示例7: getmail

# 需要导入模块: import poplib [as 别名]
# 或者: from poplib import error_proto [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 
开发者ID:knightmare2600,项目名称:d4rkc0de,代码行数:18,代码来源:mail2text.py

示例8: test_exceptions

# 需要导入模块: import poplib [as 别名]
# 或者: from poplib import error_proto [as 别名]
def test_exceptions(self):
        self.assertRaises(poplib.error_proto, self.client._shortcmd, 'echo -err') 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:4,代码来源:test_poplib.py

示例9: test_user

# 需要导入模块: import poplib [as 别名]
# 或者: from poplib import error_proto [as 别名]
def test_user(self):
        self.assertOK(self.client.user('guido'))
        self.assertRaises(poplib.error_proto, self.client.user, 'invalid') 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:5,代码来源:test_poplib.py

示例10: test_pass_

# 需要导入模块: import poplib [as 别名]
# 或者: from poplib import error_proto [as 别名]
def test_pass_(self):
        self.assertOK(self.client.pass_('python'))
        self.assertRaises(poplib.error_proto, self.client.user, 'invalid') 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:5,代码来源:test_poplib.py

示例11: test_too_long_lines

# 需要导入模块: import poplib [as 别名]
# 或者: from poplib import error_proto [as 别名]
def test_too_long_lines(self):
        self.assertRaises(poplib.error_proto, self.client._shortcmd,
                          'echo +%s' % ((poplib._MAXLINE + 10) * 'a')) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:5,代码来源:test_poplib.py

示例12: test_apop_REDOS

# 需要导入模块: import poplib [as 别名]
# 或者: from poplib import error_proto [as 别名]
def test_apop_REDOS(self):
        # Replace welcome with very long evil welcome.
        # NB The upper bound on welcome length is currently 2048.
        # At this length, evil input makes each apop call take
        # on the order of milliseconds instead of microseconds.
        evil_welcome = b'+OK' + (b'<' * 1000000)
        with test_support.swap_attr(self.client, 'welcome', evil_welcome):
            # The evil welcome is invalid, so apop should throw.
            self.assertRaises(poplib.error_proto, self.client.apop, 'a', 'kb') 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:11,代码来源:test_poplib.py

示例13: execute

# 需要导入模块: import poplib [as 别名]
# 或者: from poplib import error_proto [as 别名]
def execute(self, host, port='', ssl='0', user=None, password=None, timeout='10', persistent='1'):

    with Timing() as timing:
      fp, resp = self.bind(host, port, ssl, timeout=timeout)

    try:
      if user is not None or password is not None:
        with Timing() as timing:

          if user is not None:
            resp = fp.user(user)
          if password is not None:
            resp = fp.pass_(password)

      logger.debug('No error: %s' % resp)
      self.reset()

    except pop_error as e:
      logger.debug('pop_error: %s' % e)
      resp = e.args[0]

    if persistent == '0':
      self.reset()

    code, mesg = B(resp).split(' ', 1)
    return self.Response(code, mesg, timing) 
开发者ID:lanjelot,项目名称:patator,代码行数:28,代码来源:patator.py

示例14: test_utf8_raises_if_unsupported

# 需要导入模块: import poplib [as 别名]
# 或者: from poplib import error_proto [as 别名]
def test_utf8_raises_if_unsupported(self):
        self.server.handler.enable_UTF8 = False
        self.assertRaises(poplib.error_proto, self.client.utf8) 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:5,代码来源:test_poplib.py

示例15: tearDown

# 需要导入模块: import poplib [as 别名]
# 或者: from poplib import error_proto [as 别名]
def tearDown(self):
        if self.client.file is not None and self.client.sock is not None:
            try:
                self.client.quit()
            except poplib.error_proto:
                # happens in the test_too_long_lines case; the overlong
                # response will be treated as response to QUIT and raise
                # this exception
                self.client.close()
        self.server.stop() 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:12,代码来源:test_poplib.py


注:本文中的poplib.error_proto方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。