mirror of
https://github.com/Rushilwiz/SkoolOS.git
synced 2025-04-18 03:10:18 -04:00
commit
ecf81566e8
|
@ -1 +0,0 @@
|
||||||
{"username": "eharris1", "is_student": false, "password": "hackgroup1"}
|
|
|
@ -1 +0,0 @@
|
||||||
{"username": "2022rkhondak", "grade": 9, "is_student": true, "password": "hackgroup1"}
|
|
|
@ -1 +0,0 @@
|
||||||
{"username": "rushilwiz", "grade": 69, "is_student": true, "password": "a"}
|
|
|
@ -1 +0,0 @@
|
||||||
{"username": "sstern1", "is_student": false, "password": "Riya2011"}
|
|
|
@ -569,7 +569,7 @@ class Teacher:
|
||||||
'due_date': str(due),
|
'due_date': str(due),
|
||||||
'owner':self.id
|
'owner':self.id
|
||||||
}
|
}
|
||||||
postDB(self.username, self.password, ass, 'http://127.0.0.1:8000/api/assignments/')
|
print(postDB(self.username, self.password, ass, 'http://127.0.0.1:8000/api/assignments/'))
|
||||||
course['assignments'].append(oname)
|
course['assignments'].append(oname)
|
||||||
|
|
||||||
cinfo = {
|
cinfo = {
|
||||||
|
|
|
@ -1,55 +0,0 @@
|
||||||
Start time: Tuesday, June 16, 2020 22:18:48
|
|
||||||
|
|
||||||
Event: Opened file
|
|
||||||
Event Path: /home/nkenschaft/Sysadmin/skoolos/bgservice/run.py
|
|
||||||
Timestamp: Tuesday, June 16, 2020 22:18:48
|
|
||||||
|
|
||||||
Event: Created file
|
|
||||||
Event Path: /home/nkenschaft/Sysadmin/skoolos/bgservice.run.html
|
|
||||||
Timestamp: Tuesday, June 16, 2020 22:18:48
|
|
||||||
|
|
||||||
Event: Opened file
|
|
||||||
Event Path: /home/nkenschaft/Sysadmin/skoolos/bgservice.run.html
|
|
||||||
Timestamp: Tuesday, June 16, 2020 22:18:48
|
|
||||||
|
|
||||||
wrote bgservice.run.html
|
|
||||||
Event: Wrote to a file
|
|
||||||
Event Path: /home/nkenschaft/Sysadmin/skoolos/bgservice.run.html
|
|
||||||
Timestamp: Tuesday, June 16, 2020 22:18:48
|
|
||||||
|
|
||||||
Event: Opened file
|
|
||||||
Event Path: /home/nkenschaft/Sysadmin/skoolos/bgservice/__pycache__/test.cpython-38.pyc
|
|
||||||
Timestamp: Tuesday, June 16, 2020 22:18:48
|
|
||||||
|
|
||||||
Event: Opened file
|
|
||||||
Event Path: /home/nkenschaft/Sysadmin/skoolos/bgservice/test.py
|
|
||||||
Timestamp: Tuesday, June 16, 2020 22:18:48
|
|
||||||
|
|
||||||
Event: Created file
|
|
||||||
Event Path: /home/nkenschaft/Sysadmin/skoolos/bgservice/__pycache__/test.cpython-38.pyc.139630150929712
|
|
||||||
Timestamp: Tuesday, June 16, 2020 22:18:48
|
|
||||||
|
|
||||||
Event: Opened file
|
|
||||||
Event Path: /home/nkenschaft/Sysadmin/skoolos/bgservice/__pycache__/test.cpython-38.pyc.139630150929712
|
|
||||||
Timestamp: Tuesday, June 16, 2020 22:18:48
|
|
||||||
|
|
||||||
Event: Wrote to a file
|
|
||||||
Event Path: /home/nkenschaft/Sysadmin/skoolos/bgservice/__pycache__/test.cpython-38.pyc.139630150929712
|
|
||||||
Timestamp: Tuesday, June 16, 2020 22:18:48
|
|
||||||
|
|
||||||
Event: Moved a file out
|
|
||||||
Event Path: /home/nkenschaft/Sysadmin/skoolos/bgservice/__pycache__/test.cpython-38.pyc.139630150929712
|
|
||||||
Timestamp: Tuesday, June 16, 2020 22:18:48
|
|
||||||
|
|
||||||
Event: Moved a file in
|
|
||||||
Event Path: /home/nkenschaft/Sysadmin/skoolos/bgservice/__pycache__/test.cpython-38.pyc
|
|
||||||
Timestamp: Tuesday, June 16, 2020 22:18:48
|
|
||||||
|
|
||||||
Event: Created file
|
|
||||||
Event Path: /home/nkenschaft/Sysadmin/skoolos/SkoolOS/logs/skoolos_06162020-221848
|
|
||||||
Timestamp: Tuesday, June 16, 2020 22:18:48
|
|
||||||
|
|
||||||
Event: Opened file
|
|
||||||
Event Path: /home/nkenschaft/Sysadmin/skoolos/SkoolOS/logs/skoolos_06162020-221848
|
|
||||||
Timestamp: Tuesday, June 16, 2020 22:18:48
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
416690
SkoolOS/logs/skooloslog
Normal file
416690
SkoolOS/logs/skooloslog
Normal file
File diff suppressed because it is too large
Load Diff
|
@ -25,7 +25,7 @@ class AssignmentSerializer(serializers.HyperlinkedModelSerializer):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Assignment
|
model = Assignment
|
||||||
# fields = ['url','name', 'due_date', 'path' , "Class","teacher",'owner']
|
# fields = ['url','name', 'due_date', 'path' , "Class","teacher",'owner']
|
||||||
fields = ['name', 'due_date', 'path' ,"teacher",'owner']
|
fields = ['name', 'due_date', 'path' ,'teacher','owner']
|
||||||
|
|
||||||
class ClassSerializer(serializers.ModelSerializer):
|
class ClassSerializer(serializers.ModelSerializer):
|
||||||
# assignments = AssignmentSerializer(many=True, read_only=True,allow_null=True)
|
# assignments = AssignmentSerializer(many=True, read_only=True,allow_null=True)
|
||||||
|
|
|
@ -1,187 +0,0 @@
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
|
||||||
<html><head><title>Python: module bgservice.bgservice</title>
|
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
||||||
</head><body bgcolor="#f0f0f8">
|
|
||||||
|
|
||||||
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
|
|
||||||
<tr bgcolor="#7799ee">
|
|
||||||
<td valign=bottom> <br>
|
|
||||||
<font color="#ffffff" face="helvetica, arial"> <br><big><big><strong><a href="bgservice.html"><font color="#ffffff">bgservice</font></a>.bgservice</strong></big></big></font></td
|
|
||||||
><td align=right valign=bottom
|
|
||||||
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/home/nkenschaft/Sysadmin/skoolos/bgservice/bgservice.py">/home/nkenschaft/Sysadmin/skoolos/bgservice/bgservice.py</a></font></td></tr></table>
|
|
||||||
<p><tt>A simple background service to log events in a directory,<br>
|
|
||||||
check for git commands in bash/zsh history,<br>
|
|
||||||
and check for non-whitelisted files in the watched directory.</tt></p>
|
|
||||||
<p>
|
|
||||||
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
|
|
||||||
<tr bgcolor="#aa55cc">
|
|
||||||
<td colspan=3 valign=bottom> <br>
|
|
||||||
<font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr>
|
|
||||||
|
|
||||||
<tr><td bgcolor="#aa55cc"><tt> </tt></td><td> </td>
|
|
||||||
<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="bgservice.checker.html">bgservice.checker</a><br>
|
|
||||||
<a href="os.html">os</a><br>
|
|
||||||
</td><td width="25%" valign=top><a href="pyinotify.html">pyinotify</a><br>
|
|
||||||
<a href="sys.html">sys</a><br>
|
|
||||||
</td><td width="25%" valign=top><a href="time.html">time</a><br>
|
|
||||||
</td><td width="25%" valign=top></td></tr></table></td></tr></table><p>
|
|
||||||
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
|
|
||||||
<tr bgcolor="#ee77aa">
|
|
||||||
<td colspan=3 valign=bottom> <br>
|
|
||||||
<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
|
|
||||||
|
|
||||||
<tr><td bgcolor="#ee77aa"><tt> </tt></td><td> </td>
|
|
||||||
<td width="100%"><dl>
|
|
||||||
<dt><font face="helvetica, arial"><a href="pyinotify.html#ProcessEvent">pyinotify.ProcessEvent</a>(<a href="pyinotify.html#_ProcessEvent">pyinotify._ProcessEvent</a>)
|
|
||||||
</font></dt><dd>
|
|
||||||
<dl>
|
|
||||||
<dt><font face="helvetica, arial"><a href="bgservice.bgservice.html#EventHandler">EventHandler</a>
|
|
||||||
</font></dt></dl>
|
|
||||||
</dd>
|
|
||||||
</dl>
|
|
||||||
<p>
|
|
||||||
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
|
|
||||||
<tr bgcolor="#ffc8d8">
|
|
||||||
<td colspan=3 valign=bottom> <br>
|
|
||||||
<font color="#000000" face="helvetica, arial"><a name="EventHandler">class <strong>EventHandler</strong></a>(<a href="pyinotify.html#ProcessEvent">pyinotify.ProcessEvent</a>)</font></td></tr>
|
|
||||||
|
|
||||||
<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td>
|
|
||||||
<td colspan=2><tt><a href="#EventHandler">EventHandler</a>(pevent=None, **kargs)<br>
|
|
||||||
<br>
|
|
||||||
Custom event handler for watching a SkoolOS work directory<br> </tt></td></tr>
|
|
||||||
<tr><td> </td>
|
|
||||||
<td width="100%"><dl><dt>Method resolution order:</dt>
|
|
||||||
<dd><a href="bgservice.bgservice.html#EventHandler">EventHandler</a></dd>
|
|
||||||
<dd><a href="pyinotify.html#ProcessEvent">pyinotify.ProcessEvent</a></dd>
|
|
||||||
<dd><a href="pyinotify.html#_ProcessEvent">pyinotify._ProcessEvent</a></dd>
|
|
||||||
<dd><a href="builtins.html#object">builtins.object</a></dd>
|
|
||||||
</dl>
|
|
||||||
<hr>
|
|
||||||
Methods defined here:<br>
|
|
||||||
<dl><dt><a name="EventHandler-process_IN_CLOSE_WRITE"><strong>process_IN_CLOSE_WRITE</strong></a>(self, event)</dt><dd><tt>Generates an output to record for IN_CLOSE_WRITE events<br>
|
|
||||||
param event: event automatically passed to function<br>
|
|
||||||
return: none</tt></dd></dl>
|
|
||||||
|
|
||||||
<dl><dt><a name="EventHandler-process_IN_CREATE"><strong>process_IN_CREATE</strong></a>(self, event)</dt><dd><tt>Generates an output to record for IN_CREATE events<br>
|
|
||||||
param event: event automatically passed to function<br>
|
|
||||||
return: none</tt></dd></dl>
|
|
||||||
|
|
||||||
<dl><dt><a name="EventHandler-process_IN_DELETE"><strong>process_IN_DELETE</strong></a>(self, event)</dt><dd><tt>Generates an output to record for IN_DELETE events<br>
|
|
||||||
param event: event automatically passed to function<br>
|
|
||||||
return: none</tt></dd></dl>
|
|
||||||
|
|
||||||
<dl><dt><a name="EventHandler-process_IN_MOVED_FROM"><strong>process_IN_MOVED_FROM</strong></a>(self, event)</dt><dd><tt>Generates an output to record for IN_MOVED_FROM events<br>
|
|
||||||
param event: event automatically passed to function<br>
|
|
||||||
return: none</tt></dd></dl>
|
|
||||||
|
|
||||||
<dl><dt><a name="EventHandler-process_IN_MOVED_TO"><strong>process_IN_MOVED_TO</strong></a>(self, event)</dt><dd><tt>Generates an output to record for IN_MOVED_TO events<br>
|
|
||||||
param event: event automatically passed to function<br>
|
|
||||||
return: none</tt></dd></dl>
|
|
||||||
|
|
||||||
<dl><dt><a name="EventHandler-process_IN_OPEN"><strong>process_IN_OPEN</strong></a>(self, event)</dt><dd><tt>Generates an output to record for IN_OPEN events<br>
|
|
||||||
param event: event automatically passed to function<br>
|
|
||||||
return: none</tt></dd></dl>
|
|
||||||
|
|
||||||
<hr>
|
|
||||||
Methods inherited from <a href="pyinotify.html#ProcessEvent">pyinotify.ProcessEvent</a>:<br>
|
|
||||||
<dl><dt><a name="EventHandler-__call__"><strong>__call__</strong></a>(self, event)</dt><dd><tt>To behave like a functor the object must be callable.<br>
|
|
||||||
This method is a dispatch method. Its lookup order is:<br>
|
|
||||||
1. process_MASKNAME method<br>
|
|
||||||
2. process_FAMILY_NAME method<br>
|
|
||||||
3. otherwise calls process_default<br>
|
|
||||||
<br>
|
|
||||||
@param event: Event to be processed.<br>
|
|
||||||
@type event: Event object<br>
|
|
||||||
@return: By convention when used from the <a href="pyinotify.html#ProcessEvent">ProcessEvent</a> class:<br>
|
|
||||||
- Returning False or None (default value) means keep on<br>
|
|
||||||
executing next chained functors (see chain.py example).<br>
|
|
||||||
- Returning True instead means do not execute next<br>
|
|
||||||
processing functions.<br>
|
|
||||||
@rtype: bool<br>
|
|
||||||
@raise ProcessEventError: Event object undispatchable,<br>
|
|
||||||
unknown event.</tt></dd></dl>
|
|
||||||
|
|
||||||
<dl><dt><a name="EventHandler-__init__"><strong>__init__</strong></a>(self, pevent=None, **kargs)</dt><dd><tt>Enable chaining of <a href="pyinotify.html#ProcessEvent">ProcessEvent</a> instances.<br>
|
|
||||||
<br>
|
|
||||||
@param pevent: Optional callable object, will be called on event<br>
|
|
||||||
processing (before self).<br>
|
|
||||||
@type pevent: callable<br>
|
|
||||||
@param kargs: This constructor is implemented as a template method<br>
|
|
||||||
delegating its optionals keyworded arguments to the<br>
|
|
||||||
method <a href="#EventHandler-my_init">my_init</a>().<br>
|
|
||||||
@type kargs: dict</tt></dd></dl>
|
|
||||||
|
|
||||||
<dl><dt><a name="EventHandler-my_init"><strong>my_init</strong></a>(self, **kargs)</dt><dd><tt>This method is called from <a href="pyinotify.html#ProcessEvent">ProcessEvent</a>.<a href="#EventHandler-__init__">__init__</a>(). This method is<br>
|
|
||||||
empty here and must be redefined to be useful. In effect, if you<br>
|
|
||||||
need to specifically initialize your subclass' instance then you<br>
|
|
||||||
just have to override this method in your subclass. Then all the<br>
|
|
||||||
keyworded arguments passed to <a href="pyinotify.html#ProcessEvent">ProcessEvent</a>.<a href="#EventHandler-__init__">__init__</a>() will be<br>
|
|
||||||
transmitted as parameters to this method. Beware you MUST pass<br>
|
|
||||||
keyword arguments though.<br>
|
|
||||||
<br>
|
|
||||||
@param kargs: optional delegated arguments from <a href="#EventHandler-__init__">__init__</a>().<br>
|
|
||||||
@type kargs: dict</tt></dd></dl>
|
|
||||||
|
|
||||||
<dl><dt><a name="EventHandler-nested_pevent"><strong>nested_pevent</strong></a>(self)</dt></dl>
|
|
||||||
|
|
||||||
<dl><dt><a name="EventHandler-process_IN_Q_OVERFLOW"><strong>process_IN_Q_OVERFLOW</strong></a>(self, event)</dt><dd><tt>By default this method only reports warning messages, you can overredide<br>
|
|
||||||
it by subclassing <a href="pyinotify.html#ProcessEvent">ProcessEvent</a> and implement your own<br>
|
|
||||||
process_IN_Q_OVERFLOW method. The actions you can take on receiving this<br>
|
|
||||||
event is either to update the variable max_queued_events in order to<br>
|
|
||||||
handle more simultaneous events or to modify your code in order to<br>
|
|
||||||
accomplish a better filtering diminishing the number of raised events.<br>
|
|
||||||
Because this method is defined, IN_Q_OVERFLOW will never get<br>
|
|
||||||
transmitted as arguments to process_default calls.<br>
|
|
||||||
<br>
|
|
||||||
@param event: IN_Q_OVERFLOW event.<br>
|
|
||||||
@type event: dict</tt></dd></dl>
|
|
||||||
|
|
||||||
<dl><dt><a name="EventHandler-process_default"><strong>process_default</strong></a>(self, event)</dt><dd><tt>Default processing event method. By default does nothing. Subclass<br>
|
|
||||||
<a href="pyinotify.html#ProcessEvent">ProcessEvent</a> and redefine this method in order to modify its behavior.<br>
|
|
||||||
<br>
|
|
||||||
@param event: Event to be processed. Can be of any type of events but<br>
|
|
||||||
IN_Q_OVERFLOW events (see method process_IN_Q_OVERFLOW).<br>
|
|
||||||
@type event: Event instance</tt></dd></dl>
|
|
||||||
|
|
||||||
<hr>
|
|
||||||
Data and other attributes inherited from <a href="pyinotify.html#ProcessEvent">pyinotify.ProcessEvent</a>:<br>
|
|
||||||
<dl><dt><strong>pevent</strong> = None</dl>
|
|
||||||
|
|
||||||
<hr>
|
|
||||||
Methods inherited from <a href="pyinotify.html#_ProcessEvent">pyinotify._ProcessEvent</a>:<br>
|
|
||||||
<dl><dt><a name="EventHandler-__repr__"><strong>__repr__</strong></a>(self)</dt><dd><tt>Return repr(self).</tt></dd></dl>
|
|
||||||
|
|
||||||
<hr>
|
|
||||||
Data descriptors inherited from <a href="pyinotify.html#_ProcessEvent">pyinotify._ProcessEvent</a>:<br>
|
|
||||||
<dl><dt><strong>__dict__</strong></dt>
|
|
||||||
<dd><tt>dictionary for instance variables (if defined)</tt></dd>
|
|
||||||
</dl>
|
|
||||||
<dl><dt><strong>__weakref__</strong></dt>
|
|
||||||
<dd><tt>list of weak references to the object (if defined)</tt></dd>
|
|
||||||
</dl>
|
|
||||||
</td></tr></table></td></tr></table><p>
|
|
||||||
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
|
|
||||||
<tr bgcolor="#eeaa77">
|
|
||||||
<td colspan=3 valign=bottom> <br>
|
|
||||||
<font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr>
|
|
||||||
|
|
||||||
<tr><td bgcolor="#eeaa77"><tt> </tt></td><td> </td>
|
|
||||||
<td width="100%"><dl><dt><a name="-stop_watching"><strong>stop_watching</strong></a>()</dt><dd><tt>Stops the watch started by <a href="#-watch_dir">watch_dir</a>()<br>
|
|
||||||
return: none</tt></dd></dl>
|
|
||||||
<dl><dt><a name="-watch_dir"><strong>watch_dir</strong></a>(watched_dir='/home/nkenschaft', log_dir='SkoolOS/logs')</dt><dd><tt>Watches the specified directory for changes and outputs it in<br>
|
|
||||||
human readable format to a log file in the specified log directory.<br>
|
|
||||||
param watched_dir: directory to watch for changes<br>
|
|
||||||
param log_dir: directory to store log files<br>
|
|
||||||
return: none</tt></dd></dl>
|
|
||||||
</td></tr></table><p>
|
|
||||||
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
|
|
||||||
<tr bgcolor="#55aa55">
|
|
||||||
<td colspan=3 valign=bottom> <br>
|
|
||||||
<font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr>
|
|
||||||
|
|
||||||
<tr><td bgcolor="#55aa55"><tt> </tt></td><td> </td>
|
|
||||||
<td width="100%"><strong>DIR</strong> = None<br>
|
|
||||||
<strong>NOTIFIER</strong> = None<br>
|
|
||||||
<strong>START_TIME</strong> = None<br>
|
|
||||||
<strong>STDOUT</strong> = <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'></td></tr></table>
|
|
||||||
</body></html>
|
|
|
@ -1,44 +0,0 @@
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
|
||||||
<html><head><title>Python: module bgservice.checker</title>
|
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
||||||
</head><body bgcolor="#f0f0f8">
|
|
||||||
|
|
||||||
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
|
|
||||||
<tr bgcolor="#7799ee">
|
|
||||||
<td valign=bottom> <br>
|
|
||||||
<font color="#ffffff" face="helvetica, arial"> <br><big><big><strong><a href="bgservice.html"><font color="#ffffff">bgservice</font></a>.checker</strong></big></big></font></td
|
|
||||||
><td align=right valign=bottom
|
|
||||||
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/home/nkenschaft/Sysadmin/skoolos/bgservice/checker.py">/home/nkenschaft/Sysadmin/skoolos/bgservice/checker.py</a></font></td></tr></table>
|
|
||||||
<p></p>
|
|
||||||
<p>
|
|
||||||
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
|
|
||||||
<tr bgcolor="#aa55cc">
|
|
||||||
<td colspan=3 valign=bottom> <br>
|
|
||||||
<font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr>
|
|
||||||
|
|
||||||
<tr><td bgcolor="#aa55cc"><tt> </tt></td><td> </td>
|
|
||||||
<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="os.html">os</a><br>
|
|
||||||
</td><td width="25%" valign=top></td><td width="25%" valign=top></td><td width="25%" valign=top></td></tr></table></td></tr></table><p>
|
|
||||||
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
|
|
||||||
<tr bgcolor="#eeaa77">
|
|
||||||
<td colspan=3 valign=bottom> <br>
|
|
||||||
<font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr>
|
|
||||||
|
|
||||||
<tr><td bgcolor="#eeaa77"><tt> </tt></td><td> </td>
|
|
||||||
<td width="100%"><dl><dt><a name="-file_check"><strong>file_check</strong></a>(dir_)</dt><dd><tt>Checks specified dir_ for non-whitelisted files using <a href="#-verify_file">verify_file</a>()<br>
|
|
||||||
param dir_: directory to check<br>
|
|
||||||
return: list of suspicious files</tt></dd></dl>
|
|
||||||
<dl><dt><a name="-shell_check"><strong>shell_check</strong></a>()</dt><dd><tt>Check .bash_history and .histfile for git commands that could interfere with SkoolOS<br>
|
|
||||||
return: results of the check</tt></dd></dl>
|
|
||||||
<dl><dt><a name="-verify_file"><strong>verify_file</strong></a>(file_)</dt><dd><tt>Check if the file name has an extension in the list of whitelisted file exentsions<br>
|
|
||||||
param file_: path to file<br>
|
|
||||||
return: whether or not the file's extension is whitelisted</tt></dd></dl>
|
|
||||||
</td></tr></table><p>
|
|
||||||
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
|
|
||||||
<tr bgcolor="#55aa55">
|
|
||||||
<td colspan=3 valign=bottom> <br>
|
|
||||||
<font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr>
|
|
||||||
|
|
||||||
<tr><td bgcolor="#55aa55"><tt> </tt></td><td> </td>
|
|
||||||
<td width="100%"><strong>file_whitelist</strong> = ['.doc', '.docx', '.odt', '.pdf', '.rtf', '.tex', '.txt', '.wpd', '.3g2', '.3gp', '.avi', '.flv', '.h264', '.m4v', '.mkv', '.mov', '.mp4', '.mpg', '.mpeg', '.rm', ...]</td></tr></table>
|
|
||||||
</body></html>
|
|
|
@ -1,23 +0,0 @@
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
|
||||||
<html><head><title>Python: package bgservice</title>
|
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
||||||
</head><body bgcolor="#f0f0f8">
|
|
||||||
|
|
||||||
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
|
|
||||||
<tr bgcolor="#7799ee">
|
|
||||||
<td valign=bottom> <br>
|
|
||||||
<font color="#ffffff" face="helvetica, arial"> <br><big><big><strong>bgservice</strong></big></big></font></td
|
|
||||||
><td align=right valign=bottom
|
|
||||||
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/home/nkenschaft/Sysadmin/skoolos/bgservice/__init__.py">/home/nkenschaft/Sysadmin/skoolos/bgservice/__init__.py</a></font></td></tr></table>
|
|
||||||
<p></p>
|
|
||||||
<p>
|
|
||||||
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
|
|
||||||
<tr bgcolor="#aa55cc">
|
|
||||||
<td colspan=3 valign=bottom> <br>
|
|
||||||
<font color="#ffffff" face="helvetica, arial"><big><strong>Package Contents</strong></big></font></td></tr>
|
|
||||||
|
|
||||||
<tr><td bgcolor="#aa55cc"><tt> </tt></td><td> </td>
|
|
||||||
<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="bgservice.bgservice.html">bgservice</a><br>
|
|
||||||
</td><td width="25%" valign=top><a href="bgservice.checker.html">checker</a><br>
|
|
||||||
</td><td width="25%" valign=top></td><td width="25%" valign=top></td></tr></table></td></tr></table>
|
|
||||||
</body></html>
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -7,10 +7,184 @@ import time
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
import pyinotify
|
import pyinotify
|
||||||
from . import checker
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
from glob import glob
|
||||||
|
|
||||||
|
|
||||||
|
NOTIFIER = None
|
||||||
|
STDOUT = sys.stdout
|
||||||
|
DIR = None
|
||||||
|
START_TIME = None
|
||||||
|
|
||||||
|
|
||||||
|
def watch_dir(watched_dir=str(Path.home()), log_dir="SkoolOS/logs"):
|
||||||
|
"""
|
||||||
|
Watches the specified directory for changes and outputs it in
|
||||||
|
human readable format to a log file in the specified log directory.
|
||||||
|
param watched_dir: directory to watch for changes
|
||||||
|
param log_dir: directory to store log files
|
||||||
|
return: none
|
||||||
|
"""
|
||||||
|
global DIR
|
||||||
|
global START_TIME
|
||||||
|
global NOTIFIER
|
||||||
|
DIR = watched_dir
|
||||||
|
if not os.path.exists(log_dir):
|
||||||
|
os.makedirs(log_dir)
|
||||||
|
logfile_ = log_dir + "/skooloslog"
|
||||||
|
if os.path.isfile(logfile_):
|
||||||
|
os.remove(logfile_)
|
||||||
|
logfile = open(logfile_, 'w')
|
||||||
|
START_TIME = time.time()
|
||||||
|
wm = pyinotify.WatchManager()
|
||||||
|
mask = pyinotify.IN_CREATE | pyinotify.IN_CLOSE_WRITE | pyinotify.IN_DELETE | \
|
||||||
|
pyinotify.IN_MOVED_TO | pyinotify.IN_MOVED_FROM | pyinotify.IN_OPEN
|
||||||
|
NOTIFIER = pyinotify.ThreadedNotifier(wm, EventHandler())
|
||||||
|
NOTIFIER.start()
|
||||||
|
sys.stdout = open("/dev/null", 'w')
|
||||||
|
wm.add_watch(watched_dir, mask, rec=True)
|
||||||
|
time.sleep(1)
|
||||||
|
sys.stdout = logfile
|
||||||
|
print("Start time: " +
|
||||||
|
time.strftime("%A, %B %d, %Y %H:%M:%S", time.localtime()) + "\n")
|
||||||
|
|
||||||
|
|
||||||
|
def stop_watching():
|
||||||
|
"""
|
||||||
|
Stops the watch started by watch_dir()
|
||||||
|
return: none
|
||||||
|
"""
|
||||||
|
NOTIFIER.stop()
|
||||||
|
now = time.time()
|
||||||
|
print("End time: " +
|
||||||
|
time.strftime("%A, %B %d, %Y %H:%M:%S", time.localtime()))
|
||||||
|
print("\nTotal work time: " +
|
||||||
|
time.strftime("%H:%M:%S", time.gmtime(now - START_TIME)))
|
||||||
|
print("\n" + shell_check())
|
||||||
|
suspicious_files = file_check(DIR)
|
||||||
|
if suspicious_files != []:
|
||||||
|
print(
|
||||||
|
"\n\n--------------------------------------------------\n\n\n" +
|
||||||
|
"WARNING: One or more file did not have file extensions that are acceptable.\n"
|
||||||
|
+ "The paths to these files are listed below:\n")
|
||||||
|
print(*suspicious_files, sep='\n')
|
||||||
|
sys.stdout = STDOUT
|
||||||
|
|
||||||
|
file_whitelist = [
|
||||||
|
# text and document files
|
||||||
|
".doc",
|
||||||
|
".docx",
|
||||||
|
".odt",
|
||||||
|
".pdf",
|
||||||
|
".rtf",
|
||||||
|
".tex",
|
||||||
|
".txt",
|
||||||
|
".wpd",
|
||||||
|
# video files
|
||||||
|
".3g2",
|
||||||
|
".3gp",
|
||||||
|
".avi",
|
||||||
|
".flv",
|
||||||
|
".h264",
|
||||||
|
".m4v",
|
||||||
|
".mkv",
|
||||||
|
".mov",
|
||||||
|
".mp4",
|
||||||
|
".mpg",
|
||||||
|
".mpeg",
|
||||||
|
".rm",
|
||||||
|
".swf",
|
||||||
|
".vob",
|
||||||
|
".wmv",
|
||||||
|
# spreadsheet files
|
||||||
|
".ods",
|
||||||
|
".xls",
|
||||||
|
".xlsm",
|
||||||
|
".xlsx",
|
||||||
|
".csv",
|
||||||
|
# programming files
|
||||||
|
".c",
|
||||||
|
".class",
|
||||||
|
".cpp",
|
||||||
|
".cs",
|
||||||
|
".go",
|
||||||
|
".h",
|
||||||
|
".java",
|
||||||
|
".pl",
|
||||||
|
".sh",
|
||||||
|
".swift",
|
||||||
|
".vb",
|
||||||
|
# presentation files
|
||||||
|
".key",
|
||||||
|
".odp",
|
||||||
|
".pps",
|
||||||
|
".ppt",
|
||||||
|
".pptx",
|
||||||
|
# image files
|
||||||
|
".ai",
|
||||||
|
".bmp",
|
||||||
|
".gif",
|
||||||
|
".ico",
|
||||||
|
".jpeg",
|
||||||
|
".jpg",
|
||||||
|
".png",
|
||||||
|
".ps",
|
||||||
|
".psd",
|
||||||
|
".svg",
|
||||||
|
".tif",
|
||||||
|
".tiff",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
def shell_check():
|
||||||
|
"""
|
||||||
|
Check .bash_history and .histfile for git commands that could interfere with SkoolOS
|
||||||
|
return: results of the check
|
||||||
|
"""
|
||||||
|
bash_history = [
|
||||||
|
line.strip()
|
||||||
|
for line in open(os.path.expanduser("~/.bash_history"), 'r')
|
||||||
|
]
|
||||||
|
zsh_history = [
|
||||||
|
line.strip() for line in open(os.path.expanduser("~/.histfile"), 'r')
|
||||||
|
]
|
||||||
|
suspicious_commands = []
|
||||||
|
for i in bash_history + zsh_history:
|
||||||
|
if "git" in i:
|
||||||
|
suspicious_commands.append(i)
|
||||||
|
if suspicious_commands:
|
||||||
|
return str(
|
||||||
|
len(suspicious_commands)
|
||||||
|
) + " suspicious commands found:\n" + "\n".join(suspicious_commands)
|
||||||
|
return "Nothing suspicious found in bash or zsh history."
|
||||||
|
|
||||||
|
|
||||||
|
def verify_file(file_):
|
||||||
|
"""
|
||||||
|
Check if the file name has an extension in the list of whitelisted file exentsions
|
||||||
|
param file_: path to file
|
||||||
|
return: whether or not the file's extension is whitelisted
|
||||||
|
"""
|
||||||
|
for ext in file_whitelist:
|
||||||
|
if len(file_) > len(ext):
|
||||||
|
if file_[len(file_) - len(ext):] == ext:
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
def file_check(dir_):
|
||||||
|
"""
|
||||||
|
Checks specified dir_ for non-whitelisted files using verify_file()
|
||||||
|
param dir_: directory to check
|
||||||
|
return: list of suspicious files
|
||||||
|
"""
|
||||||
|
files = glob(dir_ + "/**/*", recursive=True)
|
||||||
|
suspicious_files = []
|
||||||
|
for file_ in files:
|
||||||
|
if not verify_file(file_):
|
||||||
|
suspicious_files.append(file_)
|
||||||
|
return suspicious_files
|
||||||
|
|
||||||
class EventHandler(pyinotify.ProcessEvent):
|
class EventHandler(pyinotify.ProcessEvent):
|
||||||
"""
|
"""
|
||||||
Custom event handler for watching a SkoolOS work directory
|
Custom event handler for watching a SkoolOS work directory
|
||||||
|
@ -113,63 +287,3 @@ class EventHandler(pyinotify.ProcessEvent):
|
||||||
time.strftime("%A, %B %d, %Y %H:%M:%S", time.localtime())
|
time.strftime("%A, %B %d, %Y %H:%M:%S", time.localtime())
|
||||||
)
|
)
|
||||||
print(description)
|
print(description)
|
||||||
|
|
||||||
|
|
||||||
NOTIFIER = None
|
|
||||||
STDOUT = sys.stdout
|
|
||||||
DIR = None
|
|
||||||
START_TIME = None
|
|
||||||
|
|
||||||
|
|
||||||
def watch_dir(watched_dir=str(Path.home()), log_dir="SkoolOS/logs"):
|
|
||||||
"""
|
|
||||||
Watches the specified directory for changes and outputs it in
|
|
||||||
human readable format to a log file in the specified log directory.
|
|
||||||
param watched_dir: directory to watch for changes
|
|
||||||
param log_dir: directory to store log files
|
|
||||||
return: none
|
|
||||||
"""
|
|
||||||
global DIR
|
|
||||||
global START_TIME
|
|
||||||
global NOTIFIER
|
|
||||||
DIR = watched_dir
|
|
||||||
if not os.path.exists(log_dir):
|
|
||||||
os.makedirs(log_dir)
|
|
||||||
logfile_ = log_dir + "/skooloslog"
|
|
||||||
if os.path.isfile(logfile_):
|
|
||||||
os.remove(logfile_)
|
|
||||||
logfile = open(logfile_, 'w')
|
|
||||||
START_TIME = time.time()
|
|
||||||
wm = pyinotify.WatchManager()
|
|
||||||
mask = pyinotify.IN_CREATE | pyinotify.IN_CLOSE_WRITE | pyinotify.IN_DELETE | \
|
|
||||||
pyinotify.IN_MOVED_TO | pyinotify.IN_MOVED_FROM | pyinotify.IN_OPEN
|
|
||||||
NOTIFIER = pyinotify.ThreadedNotifier(wm, EventHandler())
|
|
||||||
NOTIFIER.start()
|
|
||||||
sys.stdout = open("/dev/null", 'w')
|
|
||||||
wm.add_watch(watched_dir, mask, rec=True)
|
|
||||||
time.sleep(1)
|
|
||||||
sys.stdout = logfile
|
|
||||||
print("Start time: " +
|
|
||||||
time.strftime("%A, %B %d, %Y %H:%M:%S", time.localtime()) + "\n")
|
|
||||||
|
|
||||||
|
|
||||||
def stop_watching():
|
|
||||||
"""
|
|
||||||
Stops the watch started by watch_dir()
|
|
||||||
return: none
|
|
||||||
"""
|
|
||||||
NOTIFIER.stop()
|
|
||||||
now = time.time()
|
|
||||||
print("End time: " +
|
|
||||||
time.strftime("%A, %B %d, %Y %H:%M:%S", time.localtime()))
|
|
||||||
print("\nTotal work time: " +
|
|
||||||
time.strftime("%H:%M:%S", time.gmtime(now - START_TIME)))
|
|
||||||
print("\n" + checker.shell_check())
|
|
||||||
suspicious_files = checker.file_check(DIR)
|
|
||||||
if suspicious_files != []:
|
|
||||||
print(
|
|
||||||
"\n\n--------------------------------------------------\n\n\n" +
|
|
||||||
"WARNING: One or more file did not have file extensions that are acceptable.\n"
|
|
||||||
+ "The paths to these files are listed below:\n")
|
|
||||||
print(*suspicious_files, sep='\n')
|
|
||||||
sys.stdout = STDOUT
|
|
||||||
|
|
|
@ -1,117 +0,0 @@
|
||||||
import os
|
|
||||||
from glob import glob
|
|
||||||
|
|
||||||
file_whitelist = [
|
|
||||||
# text and document files
|
|
||||||
".doc",
|
|
||||||
".docx",
|
|
||||||
".odt",
|
|
||||||
".pdf",
|
|
||||||
".rtf",
|
|
||||||
".tex",
|
|
||||||
".txt",
|
|
||||||
".wpd",
|
|
||||||
# video files
|
|
||||||
".3g2",
|
|
||||||
".3gp",
|
|
||||||
".avi",
|
|
||||||
".flv",
|
|
||||||
".h264",
|
|
||||||
".m4v",
|
|
||||||
".mkv",
|
|
||||||
".mov",
|
|
||||||
".mp4",
|
|
||||||
".mpg",
|
|
||||||
".mpeg",
|
|
||||||
".rm",
|
|
||||||
".swf",
|
|
||||||
".vob",
|
|
||||||
".wmv",
|
|
||||||
# spreadsheet files
|
|
||||||
".ods",
|
|
||||||
".xls",
|
|
||||||
".xlsm",
|
|
||||||
".xlsx",
|
|
||||||
".csv",
|
|
||||||
# programming files
|
|
||||||
".c",
|
|
||||||
".class",
|
|
||||||
".cpp",
|
|
||||||
".cs",
|
|
||||||
".go",
|
|
||||||
".h",
|
|
||||||
".java",
|
|
||||||
".pl",
|
|
||||||
".sh",
|
|
||||||
".swift",
|
|
||||||
".vb",
|
|
||||||
# presentation files
|
|
||||||
".key",
|
|
||||||
".odp",
|
|
||||||
".pps",
|
|
||||||
".ppt",
|
|
||||||
".pptx",
|
|
||||||
# image files
|
|
||||||
".ai",
|
|
||||||
".bmp",
|
|
||||||
".gif",
|
|
||||||
".ico",
|
|
||||||
".jpeg",
|
|
||||||
".jpg",
|
|
||||||
".png",
|
|
||||||
".ps",
|
|
||||||
".psd",
|
|
||||||
".svg",
|
|
||||||
".tif",
|
|
||||||
".tiff",
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
def shell_check():
|
|
||||||
"""
|
|
||||||
Check .bash_history and .histfile for git commands that could interfere with SkoolOS
|
|
||||||
return: results of the check
|
|
||||||
"""
|
|
||||||
bash_history = [
|
|
||||||
line.strip()
|
|
||||||
for line in open(os.path.expanduser("~/.bash_history"), 'r')
|
|
||||||
]
|
|
||||||
zsh_history = [
|
|
||||||
line.strip() for line in open(os.path.expanduser("~/.histfile"), 'r')
|
|
||||||
]
|
|
||||||
suspicious_commands = []
|
|
||||||
for i in bash_history + zsh_history:
|
|
||||||
if "git" in i:
|
|
||||||
suspicious_commands.append(i)
|
|
||||||
if suspicious_commands:
|
|
||||||
return str(
|
|
||||||
len(suspicious_commands)
|
|
||||||
) + " suspicious commands found:\n" + "\n".join(suspicious_commands)
|
|
||||||
return "Nothing suspicious found in bash or zsh history."
|
|
||||||
|
|
||||||
|
|
||||||
def verify_file(file_):
|
|
||||||
"""
|
|
||||||
Check if the file name has an extension in the list of whitelisted file exentsions
|
|
||||||
param file_: path to file
|
|
||||||
return: whether or not the file's extension is whitelisted
|
|
||||||
"""
|
|
||||||
for ext in file_whitelist:
|
|
||||||
if len(file_) > len(ext):
|
|
||||||
if file_[len(file_) - len(ext):] == ext:
|
|
||||||
return True
|
|
||||||
return False
|
|
||||||
|
|
||||||
|
|
||||||
def file_check(dir_):
|
|
||||||
"""
|
|
||||||
Checks specified dir_ for non-whitelisted files using verify_file()
|
|
||||||
param dir_: directory to check
|
|
||||||
return: list of suspicious files
|
|
||||||
"""
|
|
||||||
files = glob(dir_ + "/**/*", recursive=True)
|
|
||||||
suspicious_files = []
|
|
||||||
for file_ in files:
|
|
||||||
if not verify_file(file_):
|
|
||||||
suspicious_files.append(file_)
|
|
||||||
return suspicious_files
|
|
|
@ -8,24 +8,25 @@ Making a user:
|
||||||
|
|
||||||
You will be redirected to a login page for the SkoolOS website. If you have already created an account on the website, enter login informatiton. If not, select
|
You will be redirected to a login page for the SkoolOS website. If you have already created an account on the website, enter login informatiton. If not, select
|
||||||
the registration button bellow and create an account. Once you create an account via Ion OAuth and SkoolOS, login. The window should close, prompting:
|
the registration button bellow and create an account. Once you create an account via Ion OAuth and SkoolOS, login. The window should close, prompting:
|
||||||
|
::
|
||||||
|
Enter SkoolOS Username:
|
||||||
|
Enter SkoolOS Password:
|
||||||
|
|
||||||
Enter SkoolOS Username:
|
Enter the valid SkoolOS username and password. Congratialations, you have successfully logged in.
|
||||||
Enter SkoolOS Password:
|
|
||||||
|
|
||||||
Enter the valid SkoolOS username and password. Congratialations, you have successfully logged in.
|
|
||||||
|
|
||||||
1. CLI as a teacher:
|
1. CLI as a teacher:
|
||||||
============
|
============
|
||||||
|
|
||||||
|
Start the CLI and select your username. For instance, teacher 'eharris1'::
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
python skoolos.py
|
python skoolos.py
|
||||||
? Select User: (Use arrow keys)
|
? Select User: (Use arrow keys)
|
||||||
1) 2022rkhondak
|
1) 2022rkhondak
|
||||||
❯ 2) eharris1
|
❯ 2) eharris1
|
||||||
3) Make new user
|
3) Make new user
|
||||||
|
|
||||||
You will then be given the choice to select an existing class, Make a new class, or exit the CLI:::
|
You will then be given the choice to select an existing class, Make a new class, or exit the CLI:
|
||||||
|
::
|
||||||
|
|
||||||
? Select class: (Use arrow keys)
|
? Select class: (Use arrow keys)
|
||||||
❯ Art12_eharris1
|
❯ Art12_eharris1
|
||||||
|
@ -37,7 +38,7 @@ You will then be given the choice to select an existing class, Make a new class,
|
||||||
Making a new class:
|
Making a new class:
|
||||||
-------
|
-------
|
||||||
|
|
||||||
Select 'Make a New Class'. You will then be prompted to enter a class name. The format for every class must be <subject>_<teacher_username> (Example: Art12_eharris1).
|
Select 'Make a New Class'. You will then be prompted to enter a class name. The format for every class must be <subject>_<teacher_username> (Example: Art12_eharris1).
|
||||||
Enter Period (must be a positive integer). You will then be prompted to add students. If you have a list of students, enter the relative path of a text file with the student usernames.
|
Enter Period (must be a positive integer). You will then be prompted to add students. If you have a list of students, enter the relative path of a text file with the student usernames.
|
||||||
The file must be a .txt file and have one student username per line. If you add an individual student, simply enter their ion username.
|
The file must be a .txt file and have one student username per line. If you add an individual student, simply enter their ion username.
|
||||||
one username per line.::
|
one username per line.::
|
||||||
|
@ -48,12 +49,12 @@ one username per line.::
|
||||||
History12_eharris1
|
History12_eharris1
|
||||||
❯ Make New Class
|
❯ Make New Class
|
||||||
Exit SkoolOS
|
Exit SkoolOS
|
||||||
|
|
||||||
? Add Students): (Use arrow keys)
|
? Add Students): (Use arrow keys)
|
||||||
❯ 1) Add individual student
|
❯ 1) Add individual student
|
||||||
2) Add list of students through path
|
2) Add list of students through path
|
||||||
3) Exit
|
3) Exit
|
||||||
|
|
||||||
? Add Students): 2) Add list of students through path
|
? Add Students): 2) Add list of students through path
|
||||||
File must be .txt and have 1 student username per line
|
File must be .txt and have 1 student username per line
|
||||||
Relative Path: students.txt
|
Relative Path: students.txt
|
||||||
|
@ -69,7 +70,6 @@ Accessing an existing class
|
||||||
Once you have created a class, you can then view and modify certain fields. (Open opening a class, any students who have accepted the request will be automatically
|
Once you have created a class, you can then view and modify certain fields. (Open opening a class, any students who have accepted the request will be automatically
|
||||||
added you the class.)::
|
added you the class.)::
|
||||||
|
|
||||||
:
|
|
||||||
? Select class: (Use arrow keys)
|
? Select class: (Use arrow keys)
|
||||||
Art12_eharris1
|
Art12_eharris1
|
||||||
Civ_eharris1
|
Civ_eharris1
|
||||||
|
@ -79,7 +79,7 @@ added you the class.)::
|
||||||
Truck_eharris1
|
Truck_eharris1
|
||||||
Make New Class
|
Make New Class
|
||||||
Exit SkoolOS
|
Exit SkoolOS
|
||||||
|
|
||||||
Class: English12_eharris1
|
Class: English12_eharris1
|
||||||
? Select option: (Use arrow keys)
|
? Select option: (Use arrow keys)
|
||||||
❯ 1) Request Student
|
❯ 1) Request Student
|
||||||
|
@ -94,7 +94,89 @@ Select 'Request Student'. You will then be prompted to add students. If you have
|
||||||
The file must be a .txt file and have one student username per line. If you add an individual student, simply enter their ion username.
|
The file must be a .txt file and have one student username per line. If you add an individual student, simply enter their ion username.
|
||||||
one username per line.::
|
one username per line.::
|
||||||
|
|
||||||
:
|
Class: English12_eharris1
|
||||||
|
? Select option: (Use arrow keys)
|
||||||
|
❯ 1) Request Student
|
||||||
|
2) Add assignment
|
||||||
|
3) View student information
|
||||||
|
4) Exit
|
||||||
|
|
||||||
|
? Add list of students (input path): (Use arrow keys)
|
||||||
|
❯ 1) Add individual student
|
||||||
|
2) Add list of students through path
|
||||||
|
3) Exit
|
||||||
|
|
||||||
|
? Select option: 1) Request Student
|
||||||
|
? Add list of students (input path): 1) Add individual student
|
||||||
|
? Student Name: 2022rkhondak
|
||||||
|
|
||||||
|
OR::
|
||||||
|
|
||||||
|
? Add Students): 2) Add list of students through path
|
||||||
|
File must be .txt and have 1 student username per line
|
||||||
|
Relative Path: students.txt
|
||||||
|
|
||||||
|
Adding an assignment
|
||||||
|
-------
|
||||||
|
|
||||||
|
To add an assignment, make an assginment subdirectory in the corresponding class wiht at least 1 file. Somehting like:
|
||||||
|
::
|
||||||
|
|
||||||
|
eharris1/English12_eharris1/Assignment1/instruct.txt
|
||||||
|
|
||||||
|
You must also put a due date in the correct format.::
|
||||||
|
|
||||||
|
? Select new assignment: Assignment1
|
||||||
|
Enter due date (Example: 2020-08-11 16:58): 2020-08-11 16:58
|
||||||
|
|
||||||
|
View student information
|
||||||
|
-------
|
||||||
|
|
||||||
|
You can view certain information of any student requested or confirmed in the given class. Simply select enter their name and see their profile. You are also given the choice
|
||||||
|
to view their logs (files they have saved, written, git commands, and file that dont match the extention whitelist). Note that as a teacher, you can view a student's current
|
||||||
|
work at ANY TIME. Simply go to the 'Students' directory and select the student's directory.::
|
||||||
|
|
||||||
|
eharris1/Students/English12_eharris1/2022rkhondak
|
||||||
|
eharris1/Students/English12_eharris1/2023rumareti
|
||||||
|
|
||||||
|
? Select option: (Use arrow keys)
|
||||||
|
1) Request Student
|
||||||
|
OR::
|
||||||
|
|
||||||
|
? Add Students):
|
||||||
|
1) Add individual student
|
||||||
|
Student name: 2022rkhondak
|
||||||
|
|
||||||
|
Accessing an existing class
|
||||||
|
=====================
|
||||||
|
|
||||||
|
Once you have created a class, you can then view and modify certain fields. (Open opening a class, any students who have accepted the request will be automatically
|
||||||
|
added you the class.)::
|
||||||
|
|
||||||
|
? Select class: (Use arrow keys)
|
||||||
|
Art12_eharris1
|
||||||
|
Civ_eharris1
|
||||||
|
❯ English12_eharris1
|
||||||
|
History12_eharris1
|
||||||
|
Random_eharris1
|
||||||
|
Truck_eharris1
|
||||||
|
Make New Class
|
||||||
|
Exit SkoolOS
|
||||||
|
|
||||||
|
Class: English12_eharris1
|
||||||
|
? Select option: (Use arrow keys)
|
||||||
|
❯ 1) Request Student
|
||||||
|
2) Add assignment
|
||||||
|
3) View student information
|
||||||
|
4) Exit
|
||||||
|
|
||||||
|
Requesting Students
|
||||||
|
-------
|
||||||
|
|
||||||
|
Select 'Request Student'. You will then be prompted to add students. If you have a list of students, enter the relative path of a text file with the student usernames.
|
||||||
|
The file must be a .txt file and have one student username per line. If you add an individual student, simply enter their ion username.
|
||||||
|
one username per line.::
|
||||||
|
|
||||||
Class: English12_eharris1
|
Class: English12_eharris1
|
||||||
? Select option: (Use arrow keys)
|
? Select option: (Use arrow keys)
|
||||||
❯ 1) Request Student
|
❯ 1) Request Student
|
||||||
|
@ -117,137 +199,56 @@ OR::
|
||||||
File must be .txt and have 1 student username per line
|
File must be .txt and have 1 student username per line
|
||||||
Relative Path: students.txt
|
Relative Path: students.txt
|
||||||
|
|
||||||
Adding an assignment
|
|
||||||
-------
|
|
||||||
|
|
||||||
To add an assignment, make an assginment subdirectory in the corresponding class wiht at least 1 file. Somehting like:
|
|
||||||
|
|
||||||
eharris1/English12_eharris1/Assignment1/instruct.txt
|
|
||||||
|
|
||||||
You must also put a due date in the correct format.
|
|
||||||
|
|
||||||
:
|
|
||||||
? Select new assignment: Assignment1
|
|
||||||
Enter due date (Example: 2020-08-11 16:58): 2020-08-11 16:58
|
|
||||||
|
|
||||||
View student information
|
|
||||||
-------
|
|
||||||
|
|
||||||
You can view certain information of any student requested or confirmed in the given class. Simply select enter their name and see their profile. You are also given the choice
|
|
||||||
to view their logs (files they have saved, written, git commands, and file that dont match the extention whitelist). Note that as a teacher, you can view a student's current
|
|
||||||
work at ANY TIME. Simply go to the 'Students' directory and select the student's directory.
|
|
||||||
|
|
||||||
eharris1/Students/English12_eharris1/2022rkhondak
|
|
||||||
eharris1/Students/English12_eharris1/2023rumareti
|
|
||||||
|
|
||||||
OR
|
|
||||||
|
|
||||||
? Add Students): 1) Add individual student
|
|
||||||
Student name: 2022rkhondak
|
|
||||||
|
|
||||||
Accessing an existing class
|
|
||||||
=====================
|
|
||||||
|
|
||||||
Once you have created a class, you can then view and modify certain fields. (Open opening a class, any students who have accepted the request will be automatically
|
|
||||||
added you the class.)
|
|
||||||
|
|
||||||
? Select class: (Use arrow keys)
|
|
||||||
Art12_eharris1
|
|
||||||
Civ_eharris1
|
|
||||||
❯ English12_eharris1
|
|
||||||
History12_eharris1
|
|
||||||
Random_eharris1
|
|
||||||
Truck_eharris1
|
|
||||||
Make New Class
|
|
||||||
Exit SkoolOS
|
|
||||||
|
|
||||||
Class: English12_eharris1
|
|
||||||
? Select option: (Use arrow keys)
|
|
||||||
❯ 1) Request Student
|
|
||||||
2) Add assignment
|
|
||||||
3) View student information
|
|
||||||
4) Exit
|
|
||||||
|
|
||||||
Requesting Students
|
|
||||||
-------
|
|
||||||
|
|
||||||
Select 'Request Student'. You will then be prompted to add students. If you have a list of students, enter the relative path of a text file with the student usernames.
|
|
||||||
The file must be a .txt file and have one student username per line. If you add an individual student, simply enter their ion username.
|
|
||||||
one username per line.
|
|
||||||
|
|
||||||
Class: English12_eharris1
|
|
||||||
? Select option: (Use arrow keys)
|
|
||||||
❯ 1) Request Student
|
|
||||||
2) Add assignment
|
|
||||||
3) View student information
|
|
||||||
4) Exit
|
|
||||||
|
|
||||||
? Add list of students (input path): (Use arrow keys)
|
|
||||||
❯ 1) Add individual student
|
|
||||||
2) Add list of students through path
|
|
||||||
3) Exit
|
|
||||||
|
|
||||||
? Select option: 1) Request Student
|
|
||||||
? Add list of students (input path): 1) Add individual student
|
|
||||||
? Student Name: 2022rkhondak
|
|
||||||
|
|
||||||
OR
|
|
||||||
|
|
||||||
? Add Students): 2) Add list of students through path
|
|
||||||
File must be .txt and have 1 student username per line
|
|
||||||
Relative Path: students.txt
|
|
||||||
|
|
||||||
Adding Assignments
|
Adding Assignments
|
||||||
-------
|
-------
|
||||||
|
|
||||||
To add an assignment, you must first make a subdirectory for that assignment in the given class. You must then add a file wihin that subdirectory. For Example:
|
To add an assignment, you must first make a subdirectory for that assignment in the given class. You must then add a file wihin that subdirectory. For Example:
|
||||||
For teacher eharris1 and class English11_eharris1, valid assignment folder would look like:
|
For teacher eharris1 and class English11_eharris1, valid assignment folder would look like:
|
||||||
|
::
|
||||||
|
|
||||||
eharris1/English11_eharris1/Assignment1/instructions.txt
|
eharris1/English11_eharris1/Assignment1/instructions.txt
|
||||||
|
|
||||||
Then, select an assignment from the given options. Then enter a due date in the correct format: YYYY-MM-DD HH:MM. The assignment will then be coppied to every student
|
Then, select an assignment from the given options. Then enter a due date in the correct format: YYYY-MM-DD HH:MM. The assignment will then be coppied to every student
|
||||||
who has confirmed the class.
|
who has confirmed the class.::
|
||||||
|
|
||||||
Class: Truck_eharris1
|
Class: Truck_eharris1
|
||||||
GET:200
|
GET:200
|
||||||
? Select option: (Use arrow keys)
|
? Select option: (Use arrow keys)
|
||||||
1) Request Student
|
1) Request Student
|
||||||
❯ 2) Add assignment
|
❯ 2) Add assignment
|
||||||
3) View student information
|
3) View student information
|
||||||
4) Exit
|
4) Exit
|
||||||
|
|
||||||
? Select new assignment: (Use arrow keys)
|
? Select new assignment: (Use arrow keys)
|
||||||
❯ Assignment1
|
❯ Assignment1
|
||||||
|
|
||||||
? Select new assignment: Assignment1
|
? Select new assignment: Assignment1
|
||||||
Enter due date (Example: 2020-08-11 16:58): 2020-08-11 16:58
|
Enter due date (Example: 2020-08-11 16:58): 2020-08-11 16:58
|
||||||
|
|
||||||
Students in class:
|
Students in class:
|
||||||
2022rkhondak
|
2022rkhondak
|
||||||
Requsted Students:
|
Requsted Students:
|
||||||
2023rumareti
|
2023rumareti
|
||||||
View student (Enter student's ion username):
|
View student (Enter student's ion username):
|
||||||
|
|
||||||
|
|
||||||
2. CLI as a student:
|
2. CLI as a student:
|
||||||
============
|
============
|
||||||
|
|
||||||
As a student, you can edit your work for certain classes and submit assignments. By default, your workr directory (your username) has a single readme. AND IT SHOULD STAY THAT WAY.
|
As a student, you can edit your work for certain classes and submit assignments. By default, your workr directory (your username) has a single readme. AND IT SHOULD STAY THAT WAY.
|
||||||
To make changes to a class, you must first select that class via the CLI.
|
To make changes to a class, you must first select that class via the CLI.
|
||||||
|
|
||||||
|
Select a class first:
|
||||||
::
|
::
|
||||||
|
|
||||||
Select a class first:
|
|
||||||
? Select class: (Use arrow keys)
|
? Select class: (Use arrow keys)
|
||||||
English12_eharris1
|
English12_eharris1
|
||||||
Art12_eharris1
|
Art12_eharris1
|
||||||
❯ Random_eharris1
|
❯ Random_eharris1
|
||||||
Exit SkoolOS
|
Exit SkoolOS
|
||||||
|
|
||||||
You can then view the assignments associated with the class. Open you work directory and modify files within your assignments. At any time, you can 'Save' or go 'Back'.
|
You can then view the assignments associated with the class. Open you work directory and modify files within your assignments. At any time, you can 'Save' or go 'Back'.
|
||||||
When you are ready, you can submit an assignment:
|
When you are ready, you can submit an assignment:
|
||||||
|
::
|
||||||
:
|
|
||||||
|
|
||||||
? Select: (Use arrow keys)
|
? Select: (Use arrow keys)
|
||||||
Save
|
Save
|
||||||
|
@ -269,5 +270,3 @@ For testing purposes, we recommed having both student and teacher users on the C
|
||||||
On a teacher user (eharris1), add an student to a given class (English12_eharris1). Then, exit out of the CLI and run skoolos.py again, but select a student account.
|
On a teacher user (eharris1), add an student to a given class (English12_eharris1). Then, exit out of the CLI and run skoolos.py again, but select a student account.
|
||||||
Selecting a student account should automatically accept the teacher's invitation. You can then begin creating assignments as a teacher. We recommend switching between accounts,
|
Selecting a student account should automatically accept the teacher's invitation. You can then begin creating assignments as a teacher. We recommend switching between accounts,
|
||||||
modifying assignments on the students end, exiting, then viewing them in the 'Student' directory as a teacher.
|
modifying assignments on the students end, exiting, then viewing them in the 'Student' directory as a teacher.
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4,13 +4,14 @@ Installation
|
||||||
Git clone repository:
|
Git clone repository:
|
||||||
-------
|
-------
|
||||||
|
|
||||||
https://gitlab.tjhsst.edu/understudyathon-2020/group-1/schoolos.git
|
https://gitlab.tjhsst.edu/understudyathon-2020/group-1/skoolos.git
|
||||||
|
|
||||||
Install repository and create env
|
Install repository and create env
|
||||||
-------
|
-------
|
||||||
|
Run the following commands in order to install SkoolOS:
|
||||||
cd SkoolOS
|
::
|
||||||
python3 -m venv env
|
git clone https://gitlab.tjhsst.edu/understudyathon-2020/group-1/skoolos.git SkoolOS
|
||||||
source env/bin/activate
|
cd SkoolOS
|
||||||
pip install -r requirements.txt
|
python3 -m venv env
|
||||||
|
source env/bin/activate
|
||||||
|
pip install -r requirements.txt
|
||||||
|
|
|
@ -1,2 +1,15 @@
|
||||||
Django Web App
|
Django Web App
|
||||||
=============
|
=============
|
||||||
|
|
||||||
|
Installing:
|
||||||
|
-------
|
||||||
|
Package the Django app and run it on a remote server, to get started,
|
||||||
|
run a
|
||||||
|
.. code-block:: python
|
||||||
|
pip3 install -r requirements.text
|
||||||
|
python manage.py makemigrations api
|
||||||
|
python manage.py makemigrations users
|
||||||
|
python manage.py migrate
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
------
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
Subproject commit b80d7ed56b7d649a74be4e7f906d26e7be43702d
|
|
31
skoolos.py
31
skoolos.py
|
@ -18,7 +18,7 @@ import datetime
|
||||||
import os
|
import os
|
||||||
import argparse
|
import argparse
|
||||||
import webbrowser
|
import webbrowser
|
||||||
#from bgservice import bgservice as bg
|
from bgservice import bgservice as bg
|
||||||
import atexit
|
import atexit
|
||||||
|
|
||||||
client_id = r'QeZPBSKqdvWFfBv1VYTSv9iFGz5T9pVJtNUjbEr6'
|
client_id = r'QeZPBSKqdvWFfBv1VYTSv9iFGz5T9pVJtNUjbEr6'
|
||||||
|
@ -88,11 +88,9 @@ 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()
|
# bg.watch_dir()
|
||||||
|
# atexit.register(stop_bg_service)
|
||||||
studentCLI(USER, PWD)
|
studentCLI(USER, PWD)
|
||||||
|
|
||||||
atexit.register(stop_bg_service)
|
|
||||||
else:
|
else:
|
||||||
teacherCLI(USER, PWD)
|
teacherCLI(USER, PWD)
|
||||||
|
|
||||||
|
@ -100,21 +98,16 @@ def main():
|
||||||
#################################################################################################### STUDENT METHODS
|
#################################################################################################### STUDENT METHODS
|
||||||
|
|
||||||
def stop_bg_service():
|
def stop_bg_service():
|
||||||
#bg.stop_watching()
|
print("good")
|
||||||
cur_path = os.path.dirname(__file__)
|
bg.stop_watching()
|
||||||
#newpath = os.path.relpath('bgservice/SkoolOS/logs')
|
print('also')
|
||||||
|
cur_path = os.path.dirname('') # Change to definite SkoolOS dir
|
||||||
# def empty_logs():
|
print('yes')
|
||||||
# logs_folder = os.path.dirname(__file__) + 'bgservice/SkoolOS/logs/'
|
newpath = os.path.relpath('bgservice/SkoolOS/logs/')
|
||||||
# for filename in os.listdir(logs_folder):
|
logText = ""
|
||||||
# file_path = os.path.join(folder, filename)
|
with open(newpath + '/skooloslog', 'r') as logfile:
|
||||||
# try:
|
logfile.read()
|
||||||
# if os.path.isfile(file_path) or os.path.islink(file_path):
|
print (logText)
|
||||||
# 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))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
Subproject commit ca356ef8532873bf52ec67a647fbb91a25ca1cb7
|
|
|
@ -1 +0,0 @@
|
||||||
Subproject commit 4df0d29276f82f25d75cd03e53ca5b754a10db1f
|
|
|
@ -1 +0,0 @@
|
||||||
its hailstone easy
|
|
Loading…
Reference in New Issue
Block a user