Revert "Bugfix/fakelog" (#69)

This commit is contained in:
Patryk 2021-06-08 14:56:27 +02:00 committed by GitHub
parent bddb15d8e2
commit 09470cc763
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 22 additions and 22 deletions

View file

@ -5,10 +5,10 @@ from bs4 import BeautifulSoup
from .generate_cookies import autogenerate_cookies from .generate_cookies import autogenerate_cookies
def get_dashboard(register_id, students, s, diary_url, symbol): def get_dashboard(register_id, students, s, diary_url, symbol):
if diary_url != 'http://cufs.fakelog.tk/': if diary_url != 'http://cufs.fakelog.cf/':
diary_url = 'http://uonetplus.vulcan.net.pl/' diary_url = 'http://uonetplus.vulcan.net.pl/'
else: else:
diary_url = 'http://uonetplus.fakelog.tk/' diary_url = 'http://uonetplus.fakelog.cf/'
cookies = autogenerate_cookies(students, s) cookies = autogenerate_cookies(students, s)

View file

@ -11,8 +11,8 @@ def get_received_messages(register_id, students, oun, s, date, school_year, symb
now = calendar.timegm(time.gmtime()) now = calendar.timegm(time.gmtime())
if oun == 'http://uonetplus-uczen.fakelog.tk/powiatwulkanowy/123458': if oun == 'http://uonetplus-uczen.fakelog.cf/powiatwulkanowy/123458':
received_messages = requests.get(f'http://uonetplus-uzytkownik.fakelog.tk/{symbol}/Wiadomosc.mvc/GetInboxMessages?_dc={now}&dataOd=&dataDo=&page=1&start=0&limit=25', headers=headers, cookies=s) received_messages = requests.get(f'http://uonetplus-uzytkownik.fakelog.cf/{symbol}/Wiadomosc.mvc/GetInboxMessages?_dc={now}&dataOd=&dataDo=&page=1&start=0&limit=25', headers=headers, cookies=s)
else: else:
received_messages = requests.get(f'https://uonetplus-uzytkownik.vulcan.net.pl/{symbol}/Wiadomosc.mvc/GetInboxMessages?_dc={now}&dataOd=&dataDo=&page=1&start=0&limit=25', headers=headers, cookies=s) received_messages = requests.get(f'https://uonetplus-uzytkownik.vulcan.net.pl/{symbol}/Wiadomosc.mvc/GetInboxMessages?_dc={now}&dataOd=&dataDo=&page=1&start=0&limit=25', headers=headers, cookies=s)
@ -24,8 +24,8 @@ def get_sent_messages(register_id, students, oun, s, date, school_year, symbol):
now = calendar.timegm(time.gmtime()) now = calendar.timegm(time.gmtime())
if oun == 'http://uonetplus-uczen.fakelog.tk/powiatwulkanowy/123458': if oun == 'http://uonetplus-uczen.fakelog.cf/powiatwulkanowy/123458':
sent_messages = requests.get(f'http://uonetplus-uzytkownik.fakelog.tk/{symbol}/Wiadomosc.mvc/GetInboxMessages?_dc={now}&dataOd=&dataDo=&page=1&start=0&limit=25', headers=headers, cookies=s) sent_messages = requests.get(f'http://uonetplus-uzytkownik.fakelog.cf/{symbol}/Wiadomosc.mvc/GetInboxMessages?_dc={now}&dataOd=&dataDo=&page=1&start=0&limit=25', headers=headers, cookies=s)
else: else:
sent_messages = requests.get(f'https://uonetplus-uzytkownik.vulcan.net.pl/{symbol}/Wiadomosc.mvc/GetInboxMessages?_dc={now}&dataOd=&dataDo=&page=1&start=0&limit=25', headers=headers, cookies=s) sent_messages = requests.get(f'https://uonetplus-uzytkownik.vulcan.net.pl/{symbol}/Wiadomosc.mvc/GetInboxMessages?_dc={now}&dataOd=&dataDo=&page=1&start=0&limit=25', headers=headers, cookies=s)
@ -37,8 +37,8 @@ def get_deleted_messages(register_id, students, oun, s, date, school_year, symbo
now = calendar.timegm(time.gmtime()) now = calendar.timegm(time.gmtime())
if oun == 'http://uonetplus-uczen.fakelog.tk/powiatwulkanowy/123458': if oun == 'http://uonetplus-uczen.fakelog.cf/powiatwulkanowy/123458':
deleted_messages = requests.get(f'http://uonetplus-uzytkownik.fakelog.tk/{symbol}/Wiadomosc.mvc/GetOutboxMessages?_dc={now}&dataOd=&dataDo=&page=1&start=0&limit=25', headers=headers, cookies=s) deleted_messages = requests.get(f'http://uonetplus-uzytkownik.fakelog.cf/{symbol}/Wiadomosc.mvc/GetOutboxMessages?_dc={now}&dataOd=&dataDo=&page=1&start=0&limit=25', headers=headers, cookies=s)
else: else:
deleted_messages = requests.get(f'https://uonetplus-uzytkownik.vulcan.net.pl/{symbol}/Wiadomosc.mvc/GetOutboxMessages?_dc={now}&dataOd=&dataDo=&page=1&start=0&limit=25', headers=headers, cookies=s) deleted_messages = requests.get(f'https://uonetplus-uzytkownik.vulcan.net.pl/{symbol}/Wiadomosc.mvc/GetOutboxMessages?_dc={now}&dataOd=&dataDo=&page=1&start=0&limit=25', headers=headers, cookies=s)
@ -48,8 +48,8 @@ def get_recipients(register_id, students, oun, s, date, school_year, symbol):
with open('app/API/headers.json') as f: with open('app/API/headers.json') as f:
headers = json.load(f) headers = json.load(f)
if oun == 'http://uonetplus-uczen.fakelog.tk/powiatwulkanowy/123458': if oun == 'http://uonetplus-uczen.fakelog.cf/powiatwulkanowy/123458':
link = f'http://uonetplus-uzytkownik.fakelog.tk/{symbol}' link = f'http://uonetplus-uzytkownik.fakelog.cf/{symbol}'
else: else:
link = f'https://uonetplus-uzytkownik.vulcan.net.pl/{symbol}' link = f'https://uonetplus-uzytkownik.vulcan.net.pl/{symbol}'
@ -66,8 +66,8 @@ def send_message(register_id, students, oun, s, date, school_year, symbol, send_
with open('app/API/headers.json') as f: with open('app/API/headers.json') as f:
headers = json.load(f) headers = json.load(f)
if oun == 'http://uonetplus-uczen.fakelog.tk/powiatwulkanowy/123458': if oun == 'http://uonetplus-uczen.fakelog.cf/powiatwulkanowy/123458':
link = f'http://uonetplus-uzytkownik.fakelog.tk/{symbol}' link = f'http://uonetplus-uzytkownik.fakelog.cf/{symbol}'
else: else:
link = f'https://uonetplus-uzytkownik.vulcan.net.pl/{symbol}' link = f'https://uonetplus-uzytkownik.vulcan.net.pl/{symbol}'
@ -142,8 +142,8 @@ def get_message_content(register_id, students, oun, s, date, school_year, symbol
with open('app/API/headers.json') as f: with open('app/API/headers.json') as f:
headers = json.load(f) headers = json.load(f)
if oun == 'http://uonetplus-uczen.fakelog.tk/powiatwulkanowy/123458': if oun == 'http://uonetplus-uczen.fakelog.cf/powiatwulkanowy/123458':
link = f'http://uonetplus-uzytkownik.fakelog.tk/{symbol}' link = f'http://uonetplus-uzytkownik.fakelog.cf/{symbol}'
else: else:
link = f'https://uonetplus-uzytkownik.vulcan.net.pl/{symbol}' link = f'https://uonetplus-uzytkownik.vulcan.net.pl/{symbol}'

View file

@ -27,8 +27,8 @@ def send(url, data, fail, diary_url, symbol, s):
if fail in page.text: if fail in page.text:
return {'success': False} return {'success': False}
else: else:
if diary_url == 'http://cufs.fakelog.tk/': if diary_url == 'http://cufs.fakelog.cf/':
page = s.get('http://cufs.fakelog.tk/powiatwulkanowy/FS/LS?wa=wsignin1.0&wtrealm=http://uonetplus.fakelog.localhost:300/powiatwulkanowy/LoginEndpoint.aspx&wctx=http://uonetplus.fakelog.localhost:300/powiatwulkanowy/LoginEndpoint.aspx') page = s.get('http://cufs.fakelog.cf/powiatwulkanowy/FS/LS?wa=wsignin1.0&wtrealm=http://uonetplus.fakelog.localhost:300/powiatwulkanowy/LoginEndpoint.aspx&wctx=http://uonetplus.fakelog.localhost:300/powiatwulkanowy/LoginEndpoint.aspx')
bs = BeautifulSoup(page.text, 'html.parser') bs = BeautifulSoup(page.text, 'html.parser')
wa = bs.find('input', {'name': 'wa'})['value'] wa = bs.find('input', {'name': 'wa'})['value']
cert = bs.find('input', {'name': 'wresult'})['value'] cert = bs.find('input', {'name': 'wresult'})['value']
@ -44,8 +44,8 @@ def send(url, data, fail, diary_url, symbol, s):
school_url = a['href'] school_url = a['href']
break break
if diary_url == 'http://cufs.fakelog.tk/': if diary_url == 'http://cufs.fakelog.cf/':
school_url = 'http://uonetplus-uczen.fakelog.tk/powiatwulkanowy/123458' school_url = 'http://uonetplus-uczen.fakelog.cf/powiatwulkanowy/123458'
cookies = get_cookies(symbol, school_url, s, diary_url) cookies = get_cookies(symbol, school_url, s, diary_url)

View file

@ -33,10 +33,10 @@ def login(request, *args, **kwargs):
Password = data['Password'] Password = data['Password']
symbol = data['Symbol'] symbol = data['Symbol']
diary_url = data['diaryUrl'] diary_url = data['diaryUrl']
if diary_url != 'http://cufs.fakelog.tk/': if diary_url != 'http://cufs.fakelog.cf/':
link = f'{diary_url}{symbol}/Account/LogOn?ReturnUrl=%2F{symbol}%2FFS%2FLS%3Fwa%3Dwsignin1.0%26wtrealm%3Dhttps%253a%252f%252fuonetplus.vulcan.net.pl%252f{symbol}%252fLoginEndpoint.aspx%26wctx%3Dhttps%253a%252f%252fuonetplus.vulcan.net.pl%252f{symbol}%252fLoginEndpoint.aspx' link = f'{diary_url}{symbol}/Account/LogOn?ReturnUrl=%2F{symbol}%2FFS%2FLS%3Fwa%3Dwsignin1.0%26wtrealm%3Dhttps%253a%252f%252fuonetplus.vulcan.net.pl%252f{symbol}%252fLoginEndpoint.aspx%26wctx%3Dhttps%253a%252f%252fuonetplus.vulcan.net.pl%252f{symbol}%252fLoginEndpoint.aspx'
else: else:
link = 'http://cufs.fakelog.tk/powiatwulkanowy/FS/LS?wa=wsignin1.0&wtrealm=http://uonetplus.fakelog.localhost:300/powiatwulkanowy/LoginEndpoint.aspx&wctx=http://uonetplus.fakelog.localhost:300/powiatwulkanowy/LoginEndpoint.aspx' link = 'http://cufs.fakelog.cf/powiatwulkanowy/FS/LS?wa=wsignin1.0&wtrealm=http://uonetplus.fakelog.localhost:300/powiatwulkanowy/LoginEndpoint.aspx&wctx=http://uonetplus.fakelog.localhost:300/powiatwulkanowy/LoginEndpoint.aspx'
s = requests.Session() s = requests.Session()
sender_return = sender(link, loginName, Password, ('loginName', 'Password'), 'Zła nazwa użytkownika lub hasło', symbol, diary_url, s) sender_return = sender(link, loginName, Password, ('loginName', 'Password'), 'Zła nazwa użytkownika lub hasło', symbol, diary_url, s)
if sender_return == {'success': False}: if sender_return == {'success': False}:

View file

@ -15,7 +15,7 @@ export default {
loginName: email, loginName: email,
Password: password, Password: password,
Symbol: symbol, Symbol: symbol,
diaryUrl: 'http://cufs.fakelog.tk/', diaryUrl: 'http://cufs.fakelog.cf/',
}, },
}); });

View file

@ -46,7 +46,7 @@ class TestViews(TestCase):
"loginName": "jan@fakelog.cf", "loginName": "jan@fakelog.cf",
"Password": "jan123", "Password": "jan123",
"Symbol": "powiatwulkanowy", "Symbol": "powiatwulkanowy",
"diaryUrl": "http://cufs.fakelog.tk/" "diaryUrl": "http://cufs.fakelog.cf/"
} }
print("\033[94mTesting login...") print("\033[94mTesting login...")