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 3598c6d..cdce72e 100644 --- a/CLI/oauth/index.html +++ b/CLI/oauth/index.html @@ -14,8 +14,8 @@
- - + + Sign in with Ion
diff --git a/CLI/skoolos.py b/CLI/skoolos.py index e318c72..73c7e37 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' @@ -69,6 +70,11 @@ def authenticate(): browser.get("localhost:8000/") + while "http://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/callback/?", "")) while "http://localhost:8000/callback/?code" not in browser.current_url: time.sleep(0.25) @@ -101,6 +107,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()