diff --git a/.sstern1profile b/.sstern1profile index b141284..a51e01c 100644 --- a/.sstern1profile +++ b/.sstern1profile @@ -1 +1 @@ -{"username": "eharris1", "is_student": false, "password": "hackgroup1"} \ No newline at end of file +{"username": "sstern1", "is_student": false, "password": "Riya2011"} \ No newline at end of file diff --git a/CLI/student.py b/CLI/student.py index 285b001..1a1e7ec 100644 --- a/CLI/student.py +++ b/CLI/student.py @@ -109,7 +109,7 @@ def command(command): process = subprocess.Popen(ar, stdout=subprocess.PIPE, stderr=subprocess.PIPE) p = process.poll() output = process.communicate()[0] - print(output.decode('utf-8')) + # print(output.decode('utf-8')) return output.decode('utf-8') diff --git a/CLI/teacher.py b/CLI/teacher.py index 0bbd7f3..c4c9f9b 100644 --- a/CLI/teacher.py +++ b/CLI/teacher.py @@ -133,7 +133,7 @@ def command(command): process = subprocess.Popen(ar, stdout=subprocess.PIPE, stderr=subprocess.PIPE) p = process.poll() output = process.communicate()[1] - print(output.decode('utf-8')) + # print(output.decode('utf-8')) #################################################################################################################################### diff --git a/bgservice/bgservice.py b/bgservice/bgservice.py index 3c3e635..8a443a3 100644 --- a/bgservice/bgservice.py +++ b/bgservice/bgservice.py @@ -7,7 +7,7 @@ import time import sys import os import pyinotify -import checker +from . import checker from pathlib import Path diff --git a/bgservice/bgservice.sh b/bgservice/bgservice.sh deleted file mode 100755 index 9d43de7..0000000 --- a/bgservice/bgservice.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -python3 bgservice.py diff --git a/skoolos.py b/skoolos.py index 1f63a02..82fbe17 100644 --- a/skoolos.py +++ b/skoolos.py @@ -3,9 +3,11 @@ from urllib.parse import urlparse import requests from requests_oauthlib import OAuth2Session from selenium import webdriver +import os import os.path import time import http.server +import shutil import socketserver from threading import Thread from werkzeug.urls import url_decode @@ -16,6 +18,8 @@ import datetime import os import argparse import webbrowser +from bgservice import bgservice as bg +import atexit client_id = r'QeZPBSKqdvWFfBv1VYTSv9iFGz5T9pVJtNUjbEr6' client_secret = r'0Wl3hAIGY9SvYOqTOLUiLNYa4OlCgZYdno9ZbcgCT7RGQ8x2f1l2HzZHsQ7ijC74A0mrOhhCVeZugqAmOADHIv5fHxaa7GqFNtQr11HX9ySTw3DscKsphCVi5P71mlGY' @@ -84,13 +88,37 @@ def main(): USER = data['username'] print(data['username']) if data['is_student']: + empty_logs() + bg.watch_dir() studentCLI(USER, PWD) + + atexit.register(stop_bg_service) else: teacherCLI(USER, PWD) #################################################################################################### STUDENT METHODS +def stop_bg_service(): + bg.stop_watching() + cur_path = os.path.dirname(__file__) + newpath = os.path.relpath('bgservice/SkoolOS/logs') + +def empty_logs(): + logs_folder = os.path.dirname(__file__) + 'bgservice/SkoolOS/logs/' + for filename in os.listdir(logs_folder): + file_path = os.path.join(folder, filename) + try: + if os.path.isfile(file_path) or os.path.islink(file_path): + os.unlink(file_path) + elif os.path.isdir(file_path): + shutil.rmtree(file_path) + except Exception as e: + print('Failed to delete %s. Reason: %s' % (file_path, e)) + + + + def studentCLI(user, password): """ The CLI for students to access @@ -448,9 +476,15 @@ def viewStudentsTeacher(teacher, course): s = f.split("_")[0] alist.append(s) print("Has submitted: " + str(alist)) - #Y/N - - #put log stuff + answer = None + while answer not in ("yes", "no"): + answer = input("Would you like to view the student's logs?: ") + if answer == "yes" or answer=="y": + print (sinfo['log']) + elif answer == "no" or answer=="n": + print("OK!") + else: + print("Please enter yes or no.") ############################################################################################################################################ diff --git a/sstern1/Students/wow4_sstern1/rushilwiz b/sstern1/Students/wow4_sstern1/rushilwiz new file mode 160000 index 0000000..4df0d29 --- /dev/null +++ b/sstern1/Students/wow4_sstern1/rushilwiz @@ -0,0 +1 @@ +Subproject commit 4df0d29276f82f25d75cd03e53ca5b754a10db1f diff --git a/sstern1/wow4_sstern1/Hackathon/fuck.txt b/sstern1/wow4_sstern1/Hackathon/fuck.txt new file mode 100644 index 0000000..e69de29 diff --git a/sstern1/wow4_sstern1/Hailstone/Driver.java b/sstern1/wow4_sstern1/Hailstone/Driver.java new file mode 100644 index 0000000..e69de29 diff --git a/sstern1/wow4_sstern1/Hailstone/instructions.txt b/sstern1/wow4_sstern1/Hailstone/instructions.txt new file mode 100644 index 0000000..e62b53d --- /dev/null +++ b/sstern1/wow4_sstern1/Hailstone/instructions.txt @@ -0,0 +1 @@ +its hailstone easy