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 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
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 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
"enc_password": "******", 'username': username, 'first_name': nombre, 'seamless_login_enabled': '1', 'tos_version': 'row', 'opt_into_one_tap': 'false' } Error.executing(f"GRNERANDO CUENTA DE INSTAGRAM [{username}] ", ip) resp2 = s.post(webCreateUrl, data=formData, allow_redirects=True) jsonr = resp2.json() Error.executing(resp2.status_code, "STATUS") Error.executing(jsonr, "RESPONSE") if 'checkpoint_url' in jsonr: Error.ok( "EXITO: Cuenta creada, Email:{} username:{} password: {}".format( email, username, "temp_password")) sql = Sql() sql.query( f"INSERT INTO emails(nombre,email,hasinstagram,istemp) VALUES('{user['fullname']}','{email}','1','1')" ) sql.db.commit() idemail = sql.cursor.lastrowid usedby = idemail payload = { "username": username, "password": "******", "createdby": "0", "usedby": usedby, } sql.createInstagramAccont(**payload)