Saltar al contenido
Underc0de /foro

[ayuda] pitón con proyecto de apertura de membresía ilimitada

Iniciado por rfve, Agosto 06, 2020, 06:14:55 AM

Tema anterior - Siguiente tema

0 Miembros y 0 Visitantes están viendo este tema.

Avatar de rfve
Agosto 06, 2020, 06:14:55 AM Ultima modificación: Agosto 06, 2020, 06:59:19 AM por Gabriela
Hola
Propósito:
1-n para producir correos electrónicos
2-n para generar contraseñas
3- Para crear n miembros en total.

Sólo estoy aprendiendo a codificar pitones. Quiero hacer un nuevo proyecto basado en el proyecto a continuación.
pero no tuve éxito

Siento lo de mi español. traducción de Google. :)

Código: text
import requests
import random
from random import getrandbits
import time

session = requests.session()

url = 'https://www.trendyol.com/login'
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36'}


email = 'test+{}@gmail.com'.format(getrandbits(40)) #enter your email, dont     change anything after '+'
password = 'Testing1234' #enter your password, minimum 8 characters

times = int(input("[" + (time.strftime("%H:%M:%S") + "]" + " - Enter the number of account(s) you would like to create: ")))
text_file = open("chmielna accounts.txt", "w")

def create_account():
    print("[" + (time.strftime("%H:%M:%S")) + "]" + " - SUBMITTING INFO.....")
    global session
    global email
    payload = {
        "RegisterModel_Email": email,
        "RegisterModel_Password": password,
        "newTermsOfUse": "on"
    }

def write():
    text_file.write(email + ":" + password + "\n")
    if "Success" in response.text:
        print("[" + (time.strftime("%H:%M:%S")) + "]" +" - SUCCESSFULLY CREATED     ACCOUNT "+email+":"+password)
        write()
    else:
        print("[" + (time.strftime("%H:%M:%S")) + "]" +" - ERROR COULD NOT CREATE "+email+":"+password)

for i in range (times):
    create_account()


La respuesta del código es la siguiente. No es inoperante.

[ayuda] pitón con proyecto de apertura de membresía ilimitada
WhatsApp Telegram

1 respuesta

Avatar de tr0n
HI @rfve,

As with this question https://underc0de.org/foro/dudas-generales-121/ayuda-script-python/ the problem is that the code is making no request at all, it is just defining the variables, you need to make the post request using the requests python library, something like this

Código: text

x = requests.post(url, data = payload, headers = headers)


There are other things you have to be aware of

- I saw the page you put in the code and I noticed the form action is actually "Los enlaces son solo para miembros. Registrate o iniciá sesión" instead of "Los enlaces son solo para miembros. Registrate o iniciá sesión"
- There is a hidden field named "__RequestVerificationToken" which has a value that changes everytime you visit the page. This is the csrf validation token and you have to include it in your request otherwise the server will reject any of them. Maybe this SO answer will help you: Los enlaces son solo para miembros. Registrate o iniciá sesión
- Last but not least, I don't know exactly how python deals with SSL, but because the page you are trying to connect to has https you need to include the certificate or maybe disable the verification for SSL. I found this Los enlaces son solo para miembros. Registrate o iniciá sesión

¿Te quedó una duda sobre Dudas y pedidos generales?

Preguntala y te responde la comunidad (y el asistente Underc0de IA si nadie llega antes). Es gratis y tarda un minuto.

Ya tengo cuenta
Guardamos tu pregunta en este navegador: después de entrar la publicás con un clic.
Grupo de WhatsApp