예제 #1
0
    def getEmailById(self, id='', isAlias=False):
        id = str(id)
        if not id.isdigit():
            Error.e(1, "No es posible buscar email Formato de ID no valido")
            return False
        else:
            if isAlias:
                Error.executing(f"Se seleccionó el modo [Alias]",
                                self.listerrorExecutinModulo)
                Error.executing(f"Buscando Alias con ID:{id}",
                                self.listerrorExecutinModulo)
                sqlquery = f"SELECT alias FROM alias WHERE id=5 AND hasinstagram=0;"
            else:
                Error.executing(f"Se seleccionó el modo [Email]",
                                self.listerrorExecutinModulo)
                Error.executing(f"Buscando Email con ID:{id}",
                                self.listerrorExecutinModulo)
                sqlquery = f"SELECT email FROM emails WHERE id={id} AND hasinstagram=0;"

            self.cursor.execute(sqlquery)
            resp = self.cursor.fetchone()
            if resp == None:
                Error.e(1, f"No se encontro el email con ID:{id}")
                return False
            else:
                Error.executing(f"{resp[0]} esta disponible",
                                self.listerrorExecutinModulo)
                return resp[0]
예제 #2
0
 def deleteEmail(self, idemail):
     Error.executing(
         f"Eliminando email de {Fore.YELLOW}{self.mail}{Style.RESET_ALL} con id:{idemail}",
         self.listerrorExecutinModulo)
     url = f"https://{self.api_domain}/request/delete/id/{idemail}/format/json"
     try:
         r = requests.get(url)
     except Exception as e:
         Error.e(
             1,
             f"No es posible hacer la conexion a {self.listerrorExecutinModulo}"
         )
         Error.warn(e)
         if self.errorReconect > self.errorMaxReconect:
             self.errorReconect = 0
             Error.e(1, f"No es posible eliminar el email:{idemail}")
         else:
             self.errorReconect += 1
             Error.info("Intentando reconectar".center(50, '.'))
             self.deleteEmail(idemail)
     else:
         rj = r.json()
         if rj["result"] == "success":
             Error.ok(f"Se elimino el email:{idemail} con exito")
     pass
예제 #3
0
 def createInstagramAccont(self, **columns):
     sql = "INSERT INTO instagram"
     sql += "("
     values = " VALUES ("
     i = 1
     for column in columns:
         if i == len(columns):
             sql += "{})".format(str(column))
             values += "'{}')".format(str(columns[column]))
         else:
             sql += "{},".format(str(column))
             values += "'{}',".format(str(columns[column]))
         i += 1
     try:
         self.cursor.execute(sql + values)
     except Exception as e:
         Error.e(
             1,
             f"No fue posible insertar la cuenta de instagram en la base de datos"
         )
         Error.warn(e)
         return False
     else:
         self.db.commit()
         Error.ok(f"EXITO: Cuenta de instagram se agrego correctamente.")
         return self.cursor.lastrowid
예제 #4
0
 def lastEmailAliasAvailable(self, social='instagram'):
     Error.executing(f"Buscando un Email valido para {social}.",
                     self.listerrorExecutinModulo)
     query1 = "SELECT id FROM emails "
     query2 = "SELECT id FROM alias "
     if social == 'instagram':
         where = " WHERE hasinstagram='0' LIMIT 1"
         f = self.fetchOne(query1 + where)
         if f is None:
             Error.warn(
                 f"No se pudo encontrar un email valido para {social}")
             Error.executing(f"Buscando un Alias valido para {social}.",
                             self.listerrorExecutinModulo)
             f2 = self.fetchOne(query2 + where)
             if f2 is None:
                 Error.e(1, f"NO HAY EMAILs O ALIAS VALIDO PARA {social}")
                 return False
             else:
                 Error.info(f"Se encontro Alias valido para {social}")
                 return {"createdby": "1", "usedby": f"{str(f2[0])}"}
         else:
             Error.info(f"Se encontro Email valido para {social}")
             return {"createdby": "0", "usedby": f"{str(f[0])}"}
     elif social == 'facebook':
         Error.info(Mensajes["trabajando"])
         return False
     else:
         Error.executing(f"No es posible determinar la red social {social}",
                         self.listerrorExecutinModulo)
         return False
예제 #5
0
 def insertAlias(self, alias='', idemail=1):
     Error.executing(f"Guardando alias {alias} en base de datos",
                     self.listerrorExecutinModulo)
     if not str(idemail).isdigit():
         idemail = self.getIdEmail(idemail)
         if not idemail:
             Error.warn(
                 f"No es posible insertar el alias {alias} en la base de datos, El ID del email es incorrecto"
             )
             return False
     try:
         self.cursor.execute(
             f"INSERT INTO alias(alias,idemail) VALUES('{alias}','{idemail}')"
         )
     except Exception as e:
         Error.e(
             1,
             f"No fue posible insertar alias [{alias}] a la base de datos")
         Error.warn(e)
         return False
     else:
         self.db.commit()
         Error.executing(f"[{alias}] se insertó correctamente",
                         self.listerrorExecutinModulo)
         return self.cursor.lastrowid
예제 #6
0
 def __init__(self, url='https://www.sslproxies.org/'):
     Error.info(f"Restableciendo proxys")
     self.proxys = []
     self.url = url
     Error.executing(f"Generando lista de proxys desde {url}",
                     self.arp_listerrorExecutinModulo)
     try:
         r = requests.get(url)
     except Exception as e:
         Error.e(1, f"No es posible hacer la conexion a {url}")
         Error.warn(e)
         if self.errorReconect > 5:
             self.errorReconect = 0
             sys.exit()
         else:
             self.errorReconect += 1
             Error.info("Intentando reconectar".center(50, '.'))
             self.__init__(url)
     else:
         Error.executing(f"Parseando proxys",
                         self.arp_listerrorExecutinModulo)
         sp = BeautifulSoup(r.text, 'html.parser')
         if url in [
                 "https://www.sslproxies.org/", "http://www.sslproxies.org/"
         ]:
             self.sslproxies(sp)
예제 #7
0
 def __init__(self, table=None):
     if self.db == None:
         Error.e(1, "ERROR FATAL: No db select")
     else:
         if table == None:
             Error.e(1, "ERROR FATAL: No table select")
         else:
             self.Where.db = self.db
             self.Where.delete = "DELETE FROM {} WHERE ".format(table)
예제 #8
0
 def __init__(self, email='', password=''):
     Error.info("Configurando Hushmail para su uso")
     if not email.strip():
         Error.e(1, "No se pudo configurar una cuenta de correo")
         Error.warn("Saliendo del script")
         sys.exit("Saliendo del script")
     if not password.strip():
         Error.e(1, "No se pudo configurar una clave de paso")
         Error.warn("Saliendo del script")
     self.email = email
     self.password = password
예제 #9
0
 def getEmailLogin(self, setnew=False):
     if setnew:
         if self.login is None:
             Error.executing(f"Generando una cuenta de email nueva",
                             self.listerrorExecutinModulo)
             if len(self.Users) == 0:
                 self.generate(1)
             self.login = self.Users[0]['username']
         if self.domain is None:
             Error.executing("Buscando domains validos para tempmail",
                             self.listerrorExecutinModulo)
             url = f"https://{self.api_domain}/request/domains/format/json/"
             try:
                 r = requests.get(url)
             except Exception as e:
                 Error.e(
                     1,
                     f"No es posible hacer la conexion a {self.listerrorExecutinModulo}"
                 )
                 Error.warn(e)
                 if self.errorReconect > self.errorMaxReconect:
                     self.errorReconect = 0
                     Error.e(1, f"No es posible mostrar lista de correo")
                     return False
                 else:
                     self.errorReconect += 1
                     Error.info("Intentando reconectar".center(50, '.'))
                     self.getEmailLogin(setnew)
             else:
                 self.domains = r.json()
                 self.domain = random.choice(self.domains)
         self.mail = "{}{}".format(self.login, self.domain)
         self.mailid = self.getHash()
     else:
         if self.login is None:
             n = self.generate(1)
             Error.executing("Selecionando username para el email",
                             self.listerrorExecutinModulo)
             self.login = n[0]['username']
         if self.domain is None:
             Error.executing("Selecionando dominio de email",
                             self.listerrorExecutinModulo)
             self.domain = random.choice(self.domains)
         mail = "{}{}".format(self.login, self.domain)
         if self.mail is None:
             self.mail = mail
             Error.executing(
                 f"Generando HASH del email: {Fore.YELLOW}{self.mail}{Style.RESET_ALL}",
                 self.listerrorExecutinModulo)
             self.mailid = md5(self.mail.encode('utf-8')).hexdigest()
     return self.mail
예제 #10
0
 def getIdEmail(self, email=''):
     if not email.strip():
         Error.e(1, "No es posible buscar id a un email vacio")
         return False
     else:
         Error.executing(f"Buscando ID de {email}",
                         self.listerrorExecutinModulo)
         self.cursor.execute(
             f"SELECT id FROM emails WHERE email='{str(email)}' ")
         resp = self.cursor.fetchone()
         if resp == None:
             return False
         else:
             return resp[0]
예제 #11
0
 def __init__(self, arr=[], logical="AND", operador='='):
     if self.delete == None:
         Error.e(1, "No es posible ejecutar la query")
     else:
         Error.executing("Parseando Array en WHERE",
                         Sql.listerrorExecutinModulo)
         w = ''
         i = 1
         for column, value in arr:
             w += f'{column}{operador}{value}'
             if i != len(arr):
                 w += logical
             i += 1
         self.delete += w
         self.db.query(self.delete)
         self.db.db.commit()
         numwrro = self.db.cursor.rowcount
         Error.warn(f"{numwrro} record(s) deleted")
예제 #12
0
 def __new__(self):
     qr = f'{self._self._select}{self._self._from}{self._self._inner}{self._self._where}{self._self._order}{self._self._group}{self._self._limit}'
     Error.executing(qr, self._self.db.listerrorExecutinModulo)
     try:
         resp = list(self._self.db.fetchAll(qr))
     except Exception as e:
         Error.e(1, "ERROR AL EJECUTAR QUERY")
         Error.warn(e)
         return []
     else:
         resp_new = []
         field_name = [
             field[0]
             for field in self._self.db.cursor.description
         ]
         for row in resp:
             row_new = zip(field_name, row)
             resp_new.append(dict(row_new))
         return resp_new
예제 #13
0
 def generateFromJson(self, number=10, file=''):
     if not file.strip():
         file = self.path + '/libs/nombres.json'
         Error.executing(f"Archivo {file} por defecto",
                         self.sru_listerrorExecutinModulo)
     if os.path.isfile(file):
         Error.executing("Cargando archivo de nombres...",
                         self.sru_listerrorExecutinModulo)
         with open(file, 'r') as json_file:
             nombres = json.loads(json_file.read())
             self.Nombres.append(nombres)
             Error.executing(f"Generando nombres...",
                             self.sru_listerrorExecutinModulo)
             for nombre in range(number):
                 select = random.sample(nombres, 2)
                 randomNumber = random.randrange(10, 99)
                 randomLetters = ''.join(
                     random.choice(string.ascii_lowercase)
                     for i in range(3))
                 username = "******".join(select) + str(
                     randomNumber) + randomLetters
                 fname = select[0]
                 lname = select[1]
                 fullname = " ".join(select)
                 password = hashlib.md5(
                     str(str(time.time()) +
                         username).encode('utf-8')).hexdigest()
                 self.Users.append({
                     "fname": fname,
                     "lname": lname,
                     "fullname": fullname,
                     "username": username.lower(),
                     "password": password,
                     "country": "CO",
                     "age": random.randrange(18, 50)
                 })
         Error.executing(
             f"Informacion de cuentas generada: #{len(self.Users)} habilitados.",
             self.sru_listerrorExecutinModulo)
         return self.Users
     else:
         Error.e(1, f"FILE {file} NO EXISTE")
     pass
예제 #14
0
 def changeProxy(self):
     self.listerrorExecutinModulo = "INSTAGRAM"
     Error.executing("Cambiando proxy para esta Session",
                     self.listerrorExecutinModulo)
     self.urlproxy = self.proxy.get()
     Error.info(f"Probando conexion del proxy: {self.urlproxy}")
     self.session.proxies = {
         "http": "{}".format(self.urlproxy),
         "https": "{}".format(self.urlproxy),
     }
     try:
         r = self.session.get("https://api.ipify.org/")
     except Exception as e:
         Error.e(1, "PROXY NO CONNECT")
         self.changeProxy()
         return False
     else:
         self.listerrorExecutinModulo = f"INSTAGRAM {Fore.RED}{r.text}{Style.RESET_ALL} "
         Error.executing(f"Ahora el proxy {self.urlproxy} esta en uso",
                         self.listerrorExecutinModulo)
     return self.urlproxy
예제 #15
0
 def getInboxMail(self):
     # https://api4.temp-mail.org/request/mail/id/b867f1fd7346280901b19da061fdc90e/format/json
     Error.executing(
         f"Verificando inbox de:{Fore.YELLOW}{self.mail}{Style.RESET_ALL}",
         self.listerrorExecutinModulo)
     if self.mailid is None:
         Error.executing(
             "No se ha encontrado un HASH de email, procediendo a generar cuenta",
             self.listerrorExecutinModulo)
         self.getEmailLogin(True)
     url = f"https://{self.api_domain}/request/mail/id/{self.mailid}/format/json"
     try:
         r = requests.get(url)
     except Exception as e:
         Error.e(
             1,
             f"No es posible hacer la conexion a {self.listerrorExecutinModulo}"
         )
         Error.warn(e)
         if self.errorReconect > self.errorMaxReconect:
             self.errorReconect = 0
             Error.e(1, f"No es posible mostrar lista de correo")
             return False
         else:
             self.errorReconect += 1
             Error.info("Intentando reconectar".center(50, '.'))
             self.getInboxMail(idemail)
     else:
         mails = r.json()
         if 'error' in mails:
             Error.info(
                 f"La cuenta de correo {Fore.YELLOW}{self.mail}{Style.RESET_ALL}  no tiene emails en INBOX"
             )
             mails = []
         else:
             for mail in mails:
                 mail.pop("mail_html")
                 mail.pop("mail_text_only")
         return mails
예제 #16
0
 def __init__(self, arr=[], logical='AND', operador='='):
     if self.update == None:
         Error.e(1, "No es psible actualizar base de datos")
     else:
         Error.executing("Parseando Array en WHERE",
                         Sql.listerrorExecutinModulo)
         w = ' WHERE '
         i = 1
         for column, value in arr:
             w += f'{column}{operador}{str(value)}'
             if i != len(arr):
                 w += logical
             i += 1
         self.update += w
         self.db.query(self.update)
         self.db.db.commit()
         numwrro = self.db.cursor.rowcount
         if numwrro > 1:
             Error.info(f"Se actualizaron {numwrro} tablas")
         elif numwrro == 1:
             Error.info(f"Se actualizo {numwrro} tabla")
         else:
             Error.warn("No se actualizo la base de datos")
예제 #17
0
 def __init__(self,
              host=Config["mysql"]["host"],
              user=Config["mysql"]["user"],
              password=Config["mysql"]["pass"],
              database=Config["mysql"]["db"]):
     Error.info(f"Creando Conexion a base de datos MYSQL [{host}]")
     try:
         self.db = MySQLdb.connect(host, user, password, database)
     except Exception as e:
         Error.e(1, e)
         Error.e(
             1,
             "Es necesaria una conexion a una base de datos para poder continuar"
         )
         sys.exit()
     else:
         Error.executing(
             f"Conexion a MYSQL establecida como User:[{user}], DB:[{database}]",
             self.listerrorExecutinModulo)
         self.cursor = self.db.cursor()
         self.Update.Where.db = self
         self.Delete.db = self
         self.Select.db = self
예제 #18
0
    def updateEmail(self, email='', arr=[]):
        Error.executing("Configurando Email o Alias para actualizar",
                        self.listerrorExecutinModulo)
        email = str(email)
        tabla = 'emails'
        if not email.isdigit():
            emailId = self.getIdEmail(email)
            if not emailId:
                Error.executing(f"Buscando ID de Alias: {email}",
                                self.listerrorExecutinModulo)
                aliasId = self.fetchOne(
                    "SELECT id FROM alias WHERE alias='{}'".format(email))
                if aliasId is None:
                    Error.e(
                        1,
                        f"No es posible actualizar la tabla: {tabla}, el Email o Alias buscado no Existe"
                    )
                    return False
                else:
                    Error.info(
                        "Se ha encontrado alias con los parametros buscados, Cambiando a modo [Alias]"
                    )
                    tabla = 'alias'
                    email = aliasId[0]
            else:
                Error.info("Manteniendo el modo[Email]")
                email = emailId
        else:
            emailText = self.getEmailById(email)
            if not emailText:
                Error.e(
                    1,
                    f"No es posible actualizar la tabla: {tabla}, el Email o Alias buscado no Existe"
                )
                return False

        self.Update(tabla, arr).Where([("id", email)])
예제 #19
0
 def initialConnect(self):
     self.changeProxy()
     Error.executing(f"Estableciendo conexion inicial",
                     self.listerrorExecutinModulo)
     try:
         resp = requests.get(self.webCreateUrlSharedData)
     except requests.exceptions.ProxyError as err:
         Error.warn("Reconectando".center(widthCenter, '-'))
         Error.e(1, err)
         self.initialConnect()
     except requests.exceptions.SSLError as err:
         Error.warn("Reconectando".center(widthCenter, '-'))
         Error.e(1, err)
         self.initialConnect()
     except Exception as e:
         Error.e(
             1,
             f"No es posible hacer la conexion a {self.listerrorExecutinModulo}"
         )
         Error.warn(e)
         if self.errorReconect > self.errorMaxReconect:
             self.errorReconect = 0
             self.initialConnect()
         else:
             self.errorReconect += 1
             Error.info("Intentando reconectar".center(widthCenter, '.'))
             self.initialConnect()
     else:
         rjson = resp.json()
         self.csrftoken = rjson['config']['csrf_token']
         self.xInstagramAJAX = rjson['rollout_hash']
         self.AcceptLanguage = rjson['language_code']
         self.deviceId = rjson['device_id']
         self.public_key = rjson['encryption']['public_key']
         self.key_id = rjson['encryption']['key_id']
         return rjson
     return False
예제 #20
0
 def postCreateAccount(self):
     Error.info(
         f"{'Username:'******'~')}_{'Email: '+self.email.center(55,'~')}"
     )
     formData = {
         'email': self.email,
         'password': self.password,
         'username': self.username,
         'first_name': self.nombre,
         'seamless_login_enabled': '1',
         'tos_version': 'row',
         'opt_into_one_tap': 'false'
     }
     self.session = requests.Session()
     Error.executing("Actualizando Header", self.listerrorExecutinModulo)
     self.session.headers.update({
         "Accept-Language":
         self.AcceptLanguage,
         "Content-Type":
         "application/x-www-form-urlencoded",
         "X-CSRFToken":
         self.csrftoken,
         "X-IG-App-ID":
         "936619743392459",
         "X-IG-WWW-Claim":
         "0",
         "X-Instagram-AJAX":
         self.xInstagramAJAX,
         "X-Requested-With":
         "XMLHttpRequest",
         "Host":
         "www.instagram.com",
         "Origin":
         "https://www.instagram.com",
         "Referer":
         "https://www.instagram.com/",
         "User-Agent":
         "Mozilla/5.0 (X11; Linux x86_64; rv:73.0) Gecko/20100101 Firefox/73.0",
     })
     Error.executing("Actualizando Cookies", self.listerrorExecutinModulo)
     self.session.cookies.update({
         "csrftoken": self.csrftoken,
         "ig_did": self.deviceId,
     })
     self.session.proxies = {
         "http": "{}".format(self.changeProxy()),
         "https": "{}".format(self.changeProxy()),
     }
     try:
         resp = self.session.post(self.webCreateUrl,
                                  data=formData,
                                  allow_redirects=True)
     except Exception as e:
         Error.e(
             1,
             f"No es posible hacer la conexion a {self.listerrorExecutinModulo}"
         )
         Error.warn(e)
         if self.errorReconect > self.errorMaxReconect:
             self.errorReconect = 0
             self.postCreateAccount()
         else:
             self.errorReconect += 1
             Error.info("Intentando reconectar".center(50, '.'))
             self.postCreateAccount()
     else:
         Error.info(f"Status Code: {resp.status_code}".center(
             widthCenter, '.'))
         if resp.status_code == 200:
             rjson = resp.json()
             if 'errors' in rjson:
                 errorType = rjson['error_type']
                 Error.e(
                     1,
                     f"Se encontraron errores al crear la cuenta de instagram, error type: {Fore.RED}{errorType}{Style.RESET_ALL}"
                 )
                 if errorType == 'generic_request_error':
                     self.checkGenericRequestError()
                 else:
                     for error in rjson['errors']:
                         Error.warn(f"Error en: [{error}]")
                         if error in ["error", "ip"]:
                             for item in rjson['errors'][error]:
                                 Error.e(1, f"[{error}]: {item}")
                                 time.sleep(1)
                             if error == 'ip':
                                 self.changeProxy()
                         else:
                             for item in rjson['errors'][error]:
                                 message = item['message']
                                 code = item['code']
                                 Error.e(
                                     1,
                                     f"[{Fore.RED}{code}{Style.RESET_ALL}]: {message}"
                                 )
                                 if code == 'email_is_taken':
                                     self.emailIsTaken()
                                 if code == 'username_is_taken':
                                     Error.info(
                                         "cambio el nombre de usuario".
                                         center(widthCenter, '-'))
                                     time.sleep(5)
                 self.postCreateAccount()
             else:
                 Error.ok("".center(widthCenter, '-'))
                 Error.ok(
                     "EXITO: Cuenta creada, Email:{} username:{} password: {}"
                     .format(self.email, self.username, self.password))
                 self.guardarcuentacreada()
                 Error.ok("".center(widthCenter, '-'))
         elif resp.status_code == 429:
             self.waitrefresh()
             pass
         elif resp.status_code == 400:
             Error.ok("".center(widthCenter, '-'))
             Error.ok(
                 "EXITO: Cuenta creada, Email:{} username:{} password: {}".
                 format(self.email, self.username, self.password))
             self.guardarcuentacreada()
             Error.ok("".center(widthCenter, '-'))
             pass
         else:
             Error.warn(resp.text)
     return False
예제 #21
0
 def createAlias(self, form_token='', alias='', savealias=False):
     Error.info(f"Iniciando creacion de alias...")
     if not alias.strip():
         Error.warn(f"No es posible crear el alias '{alias}'")
     else:
         Error.executing("Accediendo a alias de hushmail",
                         self.listerrorExecutinModulo)
         try:
             requestsAlias = self.session.get(self.loginUrlAlias)
         except Exception as e:
             Error.e(1, "No es posible hacer la conexion a Hushmail")
             Error.warn(e)
             if self.errorReconect > 5:
                 self.errorReconect = 0
                 return False
             else:
                 self.errorReconect += 1
                 Error.info("Intentando reconectar".center(50, '.'))
                 self.createAlias(form_token=form_token, alias=alias)
         else:
             Error.executing("Verificando form_token",
                             self.listerrorExecutinModulo)
             if not form_token.strip():
                 htmlAlias = BeautifulSoup(
                     requestsAlias.json()['content'][0]['elements'][0]
                     ['html'], 'html.parser')
                 formAlias = htmlAlias.find(
                     "form", {"name": "editPseudonymsForm_new"})
                 self.aliasExtencion = formAlias.find(
                     "span", {
                         "class": "secondary"
                     }).text
                 AliasToken = formAlias.find(
                     "input", {"name": "form_token"})['value']
             else:
                 AliasToken = form_token
             form_token = AliasToken
             self.session.headers.update({
                 "Connection":
                 "keep-alive",
                 "Content-Type":
                 "application/x-www-form-urlencoded; charset=UTF-8",
                 "X-Hush-Ajax-Start-Time":
                 f"{int(time.time()*1000)}",
                 "X-Hush-Generated-Password-Method":
                 "Store",
                 "X-Requested-With":
                 "XMLHttpRequest",
             })
             formDataAlias = {
                 "form_token": form_token,
                 "__hushform_extra_fields": "",
                 "alias": str(alias),
                 "current_alias": "",
                 "save": "Save",
                 "processAjax": "editPseudonymsForm"
             }
             Error.executing(f"Creando Alias {alias}",
                             self.listerrorExecutinModulo)
             try:
                 requestsCreateAlias = self.session.post(
                     self.urlCreateAlias,
                     data=formDataAlias,
                     allow_redirects=True)
             except Exception as e:
                 Error.e(1, "No es posible hacer la conexion a Hushmail")
                 Error.warn(e)
                 Error.info("Intentando reconectar".center(50, '.'))
                 if self.errorReconect > 5:
                     self.errorReconect = 0
                     return False
                 else:
                     self.errorReconect += 1
                     Error.info("Intentando reconectar".center(50, '.'))
                     self.createAlias(form_token=form_token, alias=alias)
             else:
                 responseCreateAlias = requestsCreateAlias.json()
                 if responseCreateAlias['formValidation']:
                     if savealias:
                         sql = Sql()
                         idalias = ql.insertAlias(
                             f"{alias}{self.aliasExtencion}", self.email)
                         if not idalias:
                             return False
                         else:
                             return idalias
                     return True
                 else:
                     return False
예제 #22
0
 def login(self):
     Error.info(f"Iniciando session en Hushmail como [{self.email}]")
     self.session = requests.Session()
     try:
         session_start = self.session.get(self.loginUrlGet)
     except Exception as e:
         Error.e(1, "No es posible hacer la conexion a Hushmail")
         Error.warn(e)
         if self.errorReconect > 5:
             self.errorReconect = 0
             Error.e(1, "SALIENDO DEL SCRIPT".center(50, '.'))
             sys.exit()
         else:
             self.errorReconect += 1
             Error.info("Intentando reconectar".center(50, '.'))
             self.login()
     else:
         Error.executing("Recopilando Headers & Cookies",
                         self.listerrorExecutinModulo)
         soup = BeautifulSoup(session_start.text, 'html.parser')
         Error.executing("Parseando resultado",
                         self.listerrorExecutinModulo)
         form_token = soup.find('input', {'name': 'form_token'})['value']
         Error.executing("Obteniendo form_token para el login",
                         self.listerrorExecutinModulo)
         Error.executing("Aplicando nuevos Headers",
                         self.listerrorExecutinModulo)
         self.session.headers.update({
             "Accept":
             "application/json, text/javascript, */*; q=0.01",
             "Accept-Encoding":
             "gzip, deflate, br",
             "DNT":
             "1",
             "Host":
             "secure.hushmail.com",
             "Origin":
             "https://secure.hushmail.com",
             # "Referer":"https://secure.hushmail.com/preview/hushmail/",
             "Referer":
             self.loginUrlGet,
             "Content-Type":
             "application/x-www-form-urlencoded; charset=UTF-8",
             "X-Hush-Ajax-Start-Time":
             str(int(time.time() * 1000)),
             "X-Requested-With":
             "XMLHttpRequest"
         })
         Error.executing("Construyendo url-encode para el formulario",
                         self.listerrorExecutinModulo)
         dataPost = {
             "form_token": form_token,
             # "form_token":"e1ceed8e70107ef3ee6adb69e3d2cd39_546b90918696",
             "__hushform_extra_fields": "",
             "next_webapp_page": "",
             "hush_domain": "hushmail.com",
             "hush_username": self.email,
             # "hush_username":"******",
             "hush_passphrase": self.password,
             # "hush_passphrase":"edens.123.321",
             "hush_remember_me": "",
             "hush_authcode": "",
             "hush_authenticated": "",
             "hush_customerid": "0000000000000000",
             "processAjax": "authenticationform",
             "formPage": "loginpage",
         }
         try:
             create_request = self.session.post(self.loginUrlPost,
                                                data=dataPost,
                                                allow_redirects=True)
         except Exception as e:
             Error.e(1, "No es posible hacer la conexion a Hushmail")
             if self.errorReconect > 5:
                 self.errorReconect = 0
                 Error.e(1, "SALIENDO DEL SCRIPT".center(50, '.'))
                 sys.exit()
             else:
                 self.errorReconect += 1
                 Error.info("Intentando reconectar".center(50, '.'))
                 self.login()
         else:
             response = create_request.json()
             if response['formValidation']:
                 Error.ok(f"{self.email} Ha iniciado session correctamente")
             else:
                 Error.e(
                     1,
                     f"No fue posible crear la session como [{self.email}]")
                 ppjson(response)
예제 #23
0
 def crearcuenta(self, **kw):
     self.initialConnect()
     self.setVariablesCreate(**kw)
     formData = {
         'email': self.email,
         'password': self.password,
         'username': self.username,
         'first_name': self.nombre,
         'seamless_login_enabled': '1',
         'tos_version': 'row',
         'opt_into_one_tap': 'false'
     }
     s = requests.Session()
     s.headers.update({
         "Accept-Language":
         self.AcceptLanguage,
         "Content-Type":
         "application/x-www-form-urlencoded",
         "X-CSRFToken":
         self.csrftoken,
         "X-IG-App-ID":
         "936619743392459",
         "X-IG-WWW-Claim":
         "0",
         "X-Instagram-AJAX":
         self.xInstagramAJAX,
         "X-Requested-With":
         "XMLHttpRequest",
         "Host":
         "www.instagram.com",
         "Origin":
         "https://www.instagram.com",
         "Referer":
         "https://www.instagram.com/",
         "User-Agent":
         "Mozilla/5.0 (X11; Linux x86_64; rv:73.0) Gecko/20100101 Firefox/73.0",
     })
     s.cookies.update({
         "csrftoken": self.csrftoken,
         "ig_did": self.deviceId,
     })
     s.proxies = {
         "http": "{}".format(self.urlproxy),
         "https": "{}".format(self.urlproxy),
     }
     resp_ip = s.get("https://api.ipify.org/")
     Error.warn("".center(widthCenter, '.'))
     Error.warn(resp_ip.text.center(widthCenter, '.'))
     Error.warn("".center(widthCenter, '.'))
     Error.executing(f"Creando cuenta...", self.listerrorExecutinModulo)
     Error.info(
         f"{'Username:'******'~')} {'Email: '+self.email.center(50,'~')}"
     )
     try:
         resp = s.post(self.webCreateUrl,
                       data=formData,
                       allow_redirects=True)
     except Exception as e:
         Error.info("Intentando reconectar con instagram".center(50, '.'))
         self.crearcuenta(**kw)
     else:
         Error.info(f"Status Code: {resp.status_code}".center(
             widthCenter, '.'))
         if resp.status_code == 200:
             rjson = resp.json()
             if 'errors' in rjson:
                 errorType = rjson['error_type']
                 Error.e(
                     1,
                     f"Se encontraron errores al crear la cuenta de instagram, error type: {Fore.RED}{errorType}{Style.RESET_ALL}"
                 )
                 for error in rjson['errors']:
                     Error.warn(f"Error en: [{error}]")
                     if error in ["error", "ip"]:
                         for item in rjson['errors'][error]:
                             Error.e(
                                 1,
                                 f"{self.listerrorExecutinModulo} [{error}]: {item}"
                             )
                             Error.executing(f"Intentando crear nuevamente",
                                             self.listerrorExecutinModulo)
                             self.crearcuenta(**kw)
                     else:
                         for item in rjson['errors'][error]:
                             message = item['message']
                             code = item['code']
                             Error.e(
                                 1,
                                 f"[{Fore.RED}{code}{Style.RESET_ALL}]: {message}"
                             )
                             sys.exit()
             else:
                 Error.ok("".center(widthCenter, '-'))
                 Error.ok(
                     "EXITO: Cuenta creada, Email:{} username:{} password: {}"
                     .format(self.email, self.username, self.password))
                 self.guardarcuentacreada()
                 Error.ok("".center(widthCenter, '-'))
                 sys.exit()
         elif resp.status_code == 429:
             Error.executing(f"Muchas peticiones, Se detecto como DDOS",
                             self.listerrorExecutinModulo)
             sys.exit()
         elif resp.status_code == 400:
             Error.ok("".center(widthCenter, '-'))
             Error.ok(
                 "EXITO: Cuenta creada, Email:{} username:{} password: {}".
                 format(self.email, self.username, self.password))
             self.guardarcuentacreada()
             Error.ok("".center(widthCenter, '-'))
             sys.exit()
             pass
         else:
             Error.warn(resp.text)
             sys.exit()
예제 #24
0
 def createAccount(self, **kw):
     self.setVariablesCreate(**kw)
     self.initialConnect()
     self.postCreateAccount()
     Error.e(1, "FIN DE CODIGO")
     return True
예제 #25
0
 def checkGenericRequestError(self):
     self.session = requests.Session()
     Error.info("Intentando encontrar solucion a errores")
     formData2 = {
         'email': self.email,
         'password': self.password,
         'username': self.username,
         'first_name': self.nombre,
         'opt_into_one_tap': 'false'
     }
     self.session.headers.update(self.headers)
     self.session.cookies.update(self.cookies)
     Error.executing("Accediendo al attempt", self.listerrorExecutinModulo)
     try:
         check = self.session.post(self.webCreateUrlAttempt,
                                   data=formData2,
                                   allow_redirects=True)
     except Exception as e:
         Error.e(
             1,
             f"No es posible hacer la conexion a {self.listerrorExecutinModulo}"
         )
         Error.warn(e)
         if self.errorReconect > self.errorMaxReconect:
             self.errorReconect = 0
             self.changeProxy()
             self.checkGenericRequestError()
             return False
         else:
             self.errorReconect += 1
             Error.info("Intentando reconectar".center(50, '.'))
             self.checkGenericRequestError()
             return False
     else:
         if check.status_code == 200:
             Error.info(f"Estatus code: {check.status_code}".center(
                 widthCenter, '.'))
             jsoncheck = check.json()
             new_username = jsoncheck["username_suggestions"]
             errorType = jsoncheck["error_type"]
             Error.e(
                 1,
                 f"Tipo de error: {Fore.RED}{errorType}{Style.RESET_ALL}")
             if errorType == 'form_validation_error':
                 if 'errors' in jsoncheck:
                     jsoncheckerrors = jsoncheck['errors']
                     for err in jsoncheckerrors:
                         Error.e(
                             1,
                             f"Error en: [{err}]".center(widthCenter, '-'))
                         if err in ['email', 'username']:
                             for item in jsoncheckerrors[err]:
                                 m = item['message']
                                 c = item['code']
                                 Error.e(
                                     1,
                                     f"[{Fore.RED}{c}{Style.RESET_ALL}]: {m}"
                                 )
                                 if c == 'username_is_taken':
                                     self.username = random.choice(
                                         new_username)
                                     Error.executing(
                                         f"Actualizando username a: {self.username}",
                                         self.listerrorExecutinModulo)
                                     return True
                                 elif c == 'email_is_taken':
                                     self.emailIsTaken()
                                     return True
                 self.postCreateAccount()
             else:
                 Error.e(1, "".center(widthCenter, '-'))
                 ppjson(jsoncheck)
                 Error.e(1, "".center(widthCenter, '-'))
                 return False
         elif check.status_code == 429:
             Error.warn(f"Estatus code: {check.status_code}".center(
                 widthCenter, '.'))
             self.waitrefresh()
             return False
         else:
             Error.warn(check.text)
             time.sleep(10)
     return False