Python poplib.error_proto() Examples

The following are 30 code examples of poplib.error_proto(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module poplib , or try the search function .
Example #1
Source File: Testpop.py    From fuzzdb-collect with GNU General Public License v3.0 9 votes vote down vote up
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) 
Example #2
Source File: gmailpopbrute.py    From d4rkc0de with GNU General Public License v2.0 6 votes vote down vote up
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 
Example #3
Source File: popbrute_iprange.py    From d4rkc0de with GNU General Public License v2.0 6 votes vote down vote up
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 
Example #4
Source File: popbrute_random.py    From d4rkc0de with GNU General Public License v2.0 6 votes vote down vote up
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 
Example #5
Source File: gmailpopbrute.py    From darkc0de-old-stuff with GNU General Public License v3.0 6 votes vote down vote up
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 
Example #6
Source File: mailbox_basic_params.py    From Learning-Python-Networking-Second-Edition with MIT License 6 votes vote down vote up
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() 
Example #7
Source File: test_poplib.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
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') 
Example #8
Source File: test_poplib.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
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() 
Example #9
Source File: test_poplib.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
def test_too_long_lines(self):
        self.assertRaises(poplib.error_proto, self.client._shortcmd,
                          'echo +%s' % ((poplib._MAXLINE + 10) * 'a')) 
Example #10
Source File: test_poplib.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
def test_pass_(self):
        self.assertOK(self.client.pass_('python'))
        self.assertRaises(poplib.error_proto, self.client.user, 'invalid') 
Example #11
Source File: test_poplib.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
def test_user(self):
        self.assertOK(self.client.user('guido'))
        self.assertRaises(poplib.error_proto, self.client.user, 'invalid') 
Example #12
Source File: test_poplib.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
def test_exceptions(self):
        self.assertRaises(poplib.error_proto, self.client._shortcmd, 'echo -err') 
Example #13
Source File: test_poplib.py    From gcblue with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def test_pass_(self):
        self.assertOK(self.client.pass_('python'))
        self.assertRaises(poplib.error_proto, self.client.user, 'invalid') 
Example #14
Source File: test_poplib.py    From gcblue with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def test_user(self):
        self.assertOK(self.client.user('guido'))
        self.assertRaises(poplib.error_proto, self.client.user, 'invalid') 
Example #15
Source File: test_poplib.py    From gcblue with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def test_exceptions(self):
        self.assertRaises(poplib.error_proto, self.client._shortcmd, 'echo -err') 
Example #16
Source File: mail2text.py    From d4rkc0de with GNU General Public License v2.0 5 votes vote down vote up
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 
Example #17
Source File: popbrute.py    From d4rkc0de with GNU General Public License v2.0 5 votes vote down vote up
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 
Example #18
Source File: test_poplib.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
def test_stls(self):
        self.assertRaises(poplib.error_proto, self.client.stls) 
Example #19
Source File: test_poplib.py    From ironpython3 with Apache License 2.0 5 votes vote down vote up
def test_stls(self):
        self.assertRaises(poplib.error_proto, self.client.stls) 
Example #20
Source File: test_poplib.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
def test_stls(self):
        self.assertRaises(poplib.error_proto, self.client.stls) 
Example #21
Source File: popbrute_iprange.py    From darkc0de-old-stuff with GNU General Public License v3.0 5 votes vote down vote up
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 
Example #22
Source File: popbrute_random.py    From darkc0de-old-stuff with GNU General Public License v3.0 5 votes vote down vote up
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 
Example #23
Source File: popbrute.py    From darkc0de-old-stuff with GNU General Public License v3.0 5 votes vote down vote up
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 
Example #24
Source File: patator_ext.py    From project-black with GNU General Public License v2.0 5 votes vote down vote up
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 = str(e)

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

    code, mesg = resp.split(' ', 1)
    return self.Response(code, mesg, timing) 
Example #25
Source File: test_poplib.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def test_exceptions(self):
        self.assertRaises(poplib.error_proto, self.client._shortcmd, 'echo -err') 
Example #26
Source File: test_poplib.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def test_user(self):
        self.assertOK(self.client.user('guido'))
        self.assertRaises(poplib.error_proto, self.client.user, 'invalid') 
Example #27
Source File: test_poplib.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def test_pass_(self):
        self.assertOK(self.client.pass_('python'))
        self.assertRaises(poplib.error_proto, self.client.user, 'invalid') 
Example #28
Source File: mailpillager.py    From SPF with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def validate(self, user, password):
        if (not self.srv):
            return

        self.user = user
        self.password = password
        try:
            self.srv.user(self.user)
            self.srv.pass_(self.password)
        except poplib.error_proto as e:
            return False
        return True 
Example #29
Source File: test_poplib.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def test_exceptions(self):
        self.assertRaises(poplib.error_proto, self.client._shortcmd, 'echo -err') 
Example #30
Source File: test_poplib.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def test_user(self):
        self.assertOK(self.client.user('guido'))
        self.assertRaises(poplib.error_proto, self.client.user, 'invalid')