def __init__(self): ##os.system('clear') Error.info("Configurando Instagram para su uso") self.proxy = RandomProxy() urlproxy = self.proxy.get() self.session = requests.Session() Error.executing("Configurando proxy", self.listerrorExecutinModulo)
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)
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
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
def __init__(self, login=None, domain=None, api_domain="api4.temp-mail.org"): Error.info("Iniciando configuracoin de TempMail") self.login = login self.domain = domain self.api_domain = api_domain Error.executing("Buscando domains validos para tempmail", self.listerrorExecutinModulo) url = f"https://{self.api_domain}/request/domains/format/json/" r = requests.get(url) self.domains = r.json()
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
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
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
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
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
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")
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
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)])
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
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)
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()
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
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