diff --git a/.profile b/.profile new file mode 100644 index 0000000..df779be --- /dev/null +++ b/.profile @@ -0,0 +1 @@ +{'absences': 2, 'address': None, 'counselor': {'first_name': 'Sean', 'full_name': 'Sean Burke', 'id': 37, 'last_name': 'Burke', 'url': 'https://ion.tjhsst.edu/api/profile/37', 'user_type': 'counselor', 'username': 'SPBurke'}, 'display_name': 'Raffu Khondaker', 'emails': [], 'first_name': 'Raffu', 'full_name': 'Raffu Khondaker', 'grade': {'name': 'sophomore', 'number': 10}, 'graduation_year': 2022, 'id': 36508, 'ion_username': '2022rkhondak', 'is_announcements_admin': False, 'is_eighth_admin': False, 'is_student': True, 'is_teacher': False, 'last_name': 'Khondaker', 'middle_name': 'Al', 'nickname': '', 'phones': [], 'picture': 'https://ion.tjhsst.edu/api/profile/36508/picture', 'sex': 'Male', 'short_name': 'Raffu', 'title': None, 'tj_email': '2022rkhondak@tjhsst.edu', 'user_type': 'student', 'websites': []} \ No newline at end of file diff --git a/CLI/oauth/index.html b/CLI/oauth/index.html index 1c8f1f3..a0b45cf 100644 --- a/CLI/oauth/index.html +++ b/CLI/oauth/index.html @@ -14,7 +14,7 @@
- + Sign in with Ion diff --git a/CLI/skoolos.py b/CLI/skoolos.py index e818d3a..372b28c 100644 --- a/CLI/skoolos.py +++ b/CLI/skoolos.py @@ -14,6 +14,7 @@ from PyInquirer import prompt, print_json import json import os import argparse +from cryptography.fernet import Fernet client_id = r'QeZPBSKqdvWFfBv1VYTSv9iFGz5T9pVJtNUjbEr6' client_secret = r'0Wl3hAIGY9SvYOqTOLUiLNYa4OlCgZYdno9ZbcgCT7RGQ8x2f1l2HzZHsQ7ijC74A0mrOhhCVeZugqAmOADHIv5fHxaa7GqFNtQr11HX9ySTw3DscKsphCVi5P71mlGY' @@ -71,13 +72,14 @@ def authenticate(): server.start() browser.get("localhost:8000/") - - while "http://localhost:8000/?code" not in browser.current_url: + print(1) + while "localhost:8000/callback/?code" not in browser.current_url: time.sleep(0.25) url = browser.current_url - gets = url_decode(url.replace("http://localhost:8000/?", "")) + gets = url_decode(url.replace("localhost:8000/callback/?", "")) code = gets.get("code") + print(2) if state == gets.get("state"): state = gets.get("state") print("states good") @@ -104,6 +106,10 @@ def authenticate(): os.chdir(cdir) profileFile = open(".profile", "w") #profileFile.write(profile.text()) + key = Fernet.generate_key() + file = open('key.key', 'wb') + file.write(key) # The key is type bytes still + file.close() profileFile.write(str(profile)) profileFile.close()