HTMLify

ticket.py
Views: 161 | Author: abh
from requests import get, post

def get_token():
    r = get("https://helpdesk.agrauniv.online/Home/NewTicket")
    html = r.text
    html = html[html.find("__")+49:html.find("__")+204]
    token = html
    return token

def new_ticket(type=0, subject="", enroll=0, name="", email="", mobile=0, message="", filepaths: ["filepaths"]=[]):
    data = {
        "CTypeID": type,
        "Subject": subject,
        "nroll_Roll": enroll,
        "Name": name,
        "Email": email,
        "Mobile": mobile,
        "Message": message,
        "__RequestVerificationToken": get_token(),
        "code": "abhd",
    }

    files = []
    for filepath in filepaths:
        files.append(("file", open(filepath, "rb")))

    r = post("https://helpdesk.agrauniv.online/Home/NewTicket", data=data, files=files)
    html = r.text
    html = html[html.find("S-23"):html.find("S-23")+10]
    return html

def reply(ticket, message="", filepaths=[]):
    data = {
        "Ticket": ticket,
        "Message": message,
        "Status": "Open",
        "__RequestVerificationToken": get_token(),
    }

    files = []
    for filepath in filepaths:
        files.append(("file", open(filepath, "rb")))

    r = post("https://helpdesk.agrauniv.online/Home/Tickets", data=data, files=files)

    return r.ok

Comments

abh 2024-02-09 16:01

new_ticket function not working now because University Put cptcha verification on new ticket page
djdj 2024-04-26 00:49

so we don't use this code practically?
djdj 2024-04-26 00:50

abh 2024-04-26 14:16

@djdj no, you can use it. New ticket functipn is not working but reply function works well, you can use it to inject code in there website.