This commit is contained in:
Rushil Umaretiya 2020-06-16 23:09:35 -04:00
parent 491754ef9e
commit 342ebe497c
10 changed files with 43 additions and 10 deletions

View File

@ -1 +1 @@
{"username": "eharris1", "is_student": false, "password": "hackgroup1"} {"username": "sstern1", "is_student": false, "password": "Riya2011"}

View File

@ -109,7 +109,7 @@ def command(command):
process = subprocess.Popen(ar, stdout=subprocess.PIPE, stderr=subprocess.PIPE) process = subprocess.Popen(ar, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
p = process.poll() p = process.poll()
output = process.communicate()[0] output = process.communicate()[0]
print(output.decode('utf-8')) # print(output.decode('utf-8'))
return output.decode('utf-8') return output.decode('utf-8')

View File

@ -133,7 +133,7 @@ def command(command):
process = subprocess.Popen(ar, stdout=subprocess.PIPE, stderr=subprocess.PIPE) process = subprocess.Popen(ar, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
p = process.poll() p = process.poll()
output = process.communicate()[1] output = process.communicate()[1]
print(output.decode('utf-8')) # print(output.decode('utf-8'))
#################################################################################################################################### ####################################################################################################################################

View File

@ -7,7 +7,7 @@ import time
import sys import sys
import os import os
import pyinotify import pyinotify
import checker from . import checker
from pathlib import Path from pathlib import Path

View File

@ -1,3 +0,0 @@
#!/bin/sh
python3 bgservice.py

View File

@ -3,9 +3,11 @@ from urllib.parse import urlparse
import requests import requests
from requests_oauthlib import OAuth2Session from requests_oauthlib import OAuth2Session
from selenium import webdriver from selenium import webdriver
import os
import os.path import os.path
import time import time
import http.server import http.server
import shutil
import socketserver import socketserver
from threading import Thread from threading import Thread
from werkzeug.urls import url_decode from werkzeug.urls import url_decode
@ -16,6 +18,8 @@ import datetime
import os import os
import argparse import argparse
import webbrowser import webbrowser
from bgservice import bgservice as bg
import atexit
client_id = r'QeZPBSKqdvWFfBv1VYTSv9iFGz5T9pVJtNUjbEr6' client_id = r'QeZPBSKqdvWFfBv1VYTSv9iFGz5T9pVJtNUjbEr6'
client_secret = r'0Wl3hAIGY9SvYOqTOLUiLNYa4OlCgZYdno9ZbcgCT7RGQ8x2f1l2HzZHsQ7ijC74A0mrOhhCVeZugqAmOADHIv5fHxaa7GqFNtQr11HX9ySTw3DscKsphCVi5P71mlGY' client_secret = r'0Wl3hAIGY9SvYOqTOLUiLNYa4OlCgZYdno9ZbcgCT7RGQ8x2f1l2HzZHsQ7ijC74A0mrOhhCVeZugqAmOADHIv5fHxaa7GqFNtQr11HX9ySTw3DscKsphCVi5P71mlGY'
@ -84,13 +88,37 @@ def main():
USER = data['username'] USER = data['username']
print(data['username']) print(data['username'])
if data['is_student']: if data['is_student']:
empty_logs()
bg.watch_dir()
studentCLI(USER, PWD) studentCLI(USER, PWD)
atexit.register(stop_bg_service)
else: else:
teacherCLI(USER, PWD) teacherCLI(USER, PWD)
#################################################################################################### STUDENT METHODS #################################################################################################### 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): def studentCLI(user, password):
""" """
The CLI for students to access The CLI for students to access
@ -448,9 +476,15 @@ def viewStudentsTeacher(teacher, course):
s = f.split("_")[0] s = f.split("_")[0]
alist.append(s) alist.append(s)
print("Has submitted: " + str(alist)) print("Has submitted: " + str(alist))
#Y/N answer = None
while answer not in ("yes", "no"):
#put log stuff 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.")
############################################################################################################################################ ############################################################################################################################################

@ -0,0 +1 @@
Subproject commit 4df0d29276f82f25d75cd03e53ca5b754a10db1f

View File

View File

@ -0,0 +1 @@
its hailstone easy