dualis-poc
This commit is contained in:
31
dualisauth.py
Normal file
31
dualisauth.py
Normal file
@ -0,0 +1,31 @@
|
||||
import requests
|
||||
from requests.utils import requote_uri, unquote_unreserved
|
||||
import urllib.parse
|
||||
|
||||
|
||||
def checkUser(email: str, password: str):
|
||||
url = "https://dualis.dhbw.de/scripts/mgrqispi.dll"
|
||||
fpw = urllib.parse.quote(password, safe='', encoding=None, errors=None)
|
||||
fmail = urllib.parse.quote(email, safe='', encoding=None, errors=None)
|
||||
payload = 'usrname=' + fmail + '&pass=' + fpw + '&ARGUMENTS=clino%2Cusrname%2Cpass%2Cmenuno%2Cmenu_type%2Cbrowser%2Cplatform&APPNAME=CampusNet&PRGNAME=LOGINCHECK'
|
||||
headers = {
|
||||
'Cookie': 'cnsc=0',
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36'
|
||||
}
|
||||
|
||||
response = requests.request("POST", url, headers=headers, data=payload)
|
||||
header = response.headers
|
||||
try:
|
||||
refresh = header["REFRESH"]
|
||||
arg = refresh.find("=-N") + 3
|
||||
komma = refresh[arg:].find(",")
|
||||
except KeyError:
|
||||
return -2
|
||||
|
||||
token = refresh[arg:komma + arg]
|
||||
return token
|
||||
|
||||
|
||||
def getName(token: str):
|
||||
print(token)
|
||||
Reference in New Issue
Block a user