tags:

views:

109

answers:

1

I need a python script that prompts for a username and password and tries to login to Hotmail using those credentials, outputting whether they are valid or not.

A: 

Hotmail login!

import poplib

M = poplib.POP3_SSL('pop3.live.com', 995) #Connect to hotmail pop3 server
try:
    M.user(raw_input("username: ")) #Get the username from the standar input
    M.pass_(raw_input("password: ")) #Get the password from the standar input
except:
    print "username or password incorrect"
else:
    print "Successful login"

Edit: since you only need to know if you can do a login, I rewrite the code

If you lose connection during the typing the username or password, I don't know what will happend.

razpeitia
thanks sir .. but i hope you explain every line !!!
str1k3r
sir but if password wrong it's show error massage [[[[ Traceback (most recent call last): File "C:\Users\Hamoud\Desktop\xp.py", line 5, in <module> M.pass_(getpass.getpass("password: ")) File "C:\Python26\lib\poplib.py", line 189, in pass_ return self._shortcmd('PASS %s' % pswd) File "C:\Python26\lib\poplib.py", line 152, in _shortcmd return self._getresp() File "C:\Python26\lib\poplib.py", line 128, in _getresp raise error_proto(resp)poplib.error_proto: -ERR authentication failed ]]]]so i don't want show error if password wrong !
str1k3r
Delivered ;DThe netx time try to explain better the problem and also add some code.
razpeitia
thanks razpeitiabut can you leave your email i wana contact with you
str1k3r
Sure, it's razpeitia_r1 at hotmail dot com
razpeitia