guelmimcq 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2 @@
1
+ prune guelmimcq/server
2
+ recursive-exclude guelmimcq/server *
@@ -0,0 +1,36 @@
1
+ Metadata-Version: 2.4
2
+ Name: guelmimcq
3
+ Version: 0.1.0
4
+ Summary: Fast, interactive terminal-based MCQ client with built-in telemetry.
5
+ Author: GuelmimCQ Team
6
+ Requires-Python: >=3.9
7
+ Description-Content-Type: text/markdown
8
+ Requires-Dist: requests>=2.28.0
9
+ Requires-Dist: rich>=13.0.0
10
+ Requires-Dist: psutil>=5.9.0
11
+ Requires-Dist: pydantic>=2.0
12
+
13
+ # guelmimcq
14
+
15
+ Interactive client for taking multiple-choice and practical data examinations (including in-browser JupyterLite EDA analysis) directly on your machine.
16
+
17
+ ## Installation
18
+
19
+ ```bash
20
+ pip install guelmimcq
21
+ ```
22
+
23
+ ## Usage
24
+
25
+ Simply run:
26
+
27
+ ```bash
28
+ guelmimcq
29
+ ```
30
+
31
+ Follow the prompts on your terminal:
32
+ 1. Enter your Full Name and Student ID.
33
+ 2. Enter the exam server URL provided by your instructor.
34
+ 3. **Part 1 (MCQ):** Answer each multiple-choice question using your keyboard and submit.
35
+ 4. **Part 2 (Practical EDA):** Your browser will automatically launch the interactive JupyterLite environment to complete your 1h30 data analysis.
36
+ 5. Upload your finished `.ipynb` notebook file through the web portal or drag & drop into the terminal.
@@ -0,0 +1,24 @@
1
+ # guelmimcq
2
+
3
+ Interactive client for taking multiple-choice and practical data examinations (including in-browser JupyterLite EDA analysis) directly on your machine.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pip install guelmimcq
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ Simply run:
14
+
15
+ ```bash
16
+ guelmimcq
17
+ ```
18
+
19
+ Follow the prompts on your terminal:
20
+ 1. Enter your Full Name and Student ID.
21
+ 2. Enter the exam server URL provided by your instructor.
22
+ 3. **Part 1 (MCQ):** Answer each multiple-choice question using your keyboard and submit.
23
+ 4. **Part 2 (Practical EDA):** Your browser will automatically launch the interactive JupyterLite environment to complete your 1h30 data analysis.
24
+ 5. Upload your finished `.ipynb` notebook file through the web portal or drag & drop into the terminal.
@@ -0,0 +1,3 @@
1
+ """GuelmimCQ - Terminal MCQ Client."""
2
+
3
+ __version__ = "0.1.0"
@@ -0,0 +1,280 @@
1
+ # Interactive terminal CLI for students taking a GuelmimCQ exam.
2
+
3
+ import os
4
+ import sys
5
+ import time
6
+ import webbrowser
7
+ from rich.console import Console
8
+ from rich.panel import Panel
9
+ from rich.table import Table
10
+ from rich.prompt import Prompt, Confirm
11
+
12
+ from guelmimcq.models import StudentAnswer, StudentSubmission, PracticalSubmission, TelemetryData
13
+ from guelmimcq.network import ServerClient, NetworkError
14
+ from guelmimcq.telemetry import TelemetryCollector
15
+
16
+ console = Console()
17
+
18
+
19
+ def display_welcome_banner():
20
+ console.print(
21
+ Panel.fit(
22
+ "[bold cyan]GuelmimCQ[/bold cyan] [white]Examination Client[/white]\n"
23
+ "[dim]Terminal MCQ + In-Browser JupyterLite Practical Environment[/dim]\n\n"
24
+ "[bold yellow]⚠️ EXAM INTEGRITY NOTICE:[/bold yellow]\n"
25
+ "[dim]Academic integrity monitoring is active. Running processes\n"
26
+ "and application switches are logged throughout the exam.[/dim]",
27
+ border_style="cyan",
28
+ title="[bold green]Welcome[/bold green]",
29
+ )
30
+ )
31
+
32
+
33
+ def run_exam():
34
+ display_welcome_banner()
35
+
36
+ # 1. Collect student details and server URL
37
+ student_name = Prompt.ask("[bold yellow]Enter your Full Name[/bold yellow]").strip()
38
+ while not student_name:
39
+ student_name = Prompt.ask("[bold red]Name cannot be empty. Enter your Full Name[/bold red]").strip()
40
+
41
+ student_id = Prompt.ask("[bold yellow]Enter your Student ID / Email[/bold yellow]").strip()
42
+ while not student_id:
43
+ student_id = Prompt.ask("[bold red]ID cannot be empty. Enter your Student ID / Email[/bold red]").strip()
44
+
45
+ server_url = Prompt.ask("[bold yellow]Enter the Exam URL provided by your instructor[/bold yellow]").strip()
46
+ while not server_url:
47
+ server_url = Prompt.ask("[bold red]URL cannot be empty. Enter the Exam URL[/bold red]").strip()
48
+
49
+ client = ServerClient(server_url)
50
+
51
+ # 2. Check connection
52
+ with console.status("[bold green]Connecting to exam server...", spinner="dots"):
53
+ if not client.check_connection():
54
+ console.print(
55
+ f"[bold red]Error:[/bold red] Could not reach exam server at [cyan]{server_url}[/cyan].\n"
56
+ "Please verify the URL is correct and the instructor has started the session."
57
+ )
58
+ sys.exit(1)
59
+
60
+ # 3. Register and fetch questions
61
+ with console.status("[bold green]Fetching exam details...", spinner="dots"):
62
+ try:
63
+ exam = client.register(student_name, student_id)
64
+ except NetworkError as e:
65
+ console.print(f"[bold red]Registration Failed:[/bold red] {e}")
66
+ sys.exit(1)
67
+
68
+ has_practical = exam.practical_exam is not None and exam.practical_exam.enabled
69
+ structure_desc = (
70
+ f"• [bold]Part 1:[/bold] MCQ ({len(exam.questions)} Questions, {exam.mcq_duration_minutes} mins)\n"
71
+ f"• [bold]Part 2:[/bold] Practical EDA in JupyterLite ({exam.practical_exam.duration_minutes} mins)"
72
+ if has_practical
73
+ else f"• [bold]Part 1:[/bold] MCQ ({len(exam.questions)} Questions)"
74
+ )
75
+
76
+ console.print(
77
+ Panel(
78
+ f"[bold green]Exam Ready:[/bold green] {exam.title}\n"
79
+ f"[dim]{exam.description or chr(78) + chr(111) + chr(32) + chr(105) + chr(110) + chr(115) + chr(116) + chr(114) + chr(117) + chr(99) + chr(116) + chr(105) + chr(111) + chr(110) + chr(115)}[/dim]\n\n"
80
+ f"[bold yellow]Structure:[/bold yellow]\n{structure_desc}",
81
+ border_style="green",
82
+ )
83
+ )
84
+
85
+ if not Confirm.ask("Ready to begin the MCQ portion of the exam?"):
86
+ console.print("[dim]Exam aborted by user.[/dim]")
87
+ sys.exit(0)
88
+
89
+ # 4. MCQ Section: Telemetry & Question Loop
90
+ mcq_telemetry = TelemetryCollector(allow_browsers=False, is_practical_phase=False)
91
+ answers = []
92
+ mcq_telemetry.scan_processes()
93
+
94
+ total_q = len(exam.questions)
95
+ for idx, q in enumerate(exam.questions, start=1):
96
+ console.rule(f"[bold cyan]Question {idx} of {total_q}[/bold cyan]")
97
+ console.print(f"\n[bold]{q.text}[/bold]\n")
98
+
99
+ valid_choices = {}
100
+ for opt in q.options:
101
+ console.print(f" [bold cyan]{opt.key})[/bold cyan] {opt.text}")
102
+ valid_choices[opt.key.upper()] = opt.key
103
+
104
+ start_time = time.time()
105
+ choice = ""
106
+ while True:
107
+ raw_input = Prompt.ask(
108
+ f"\n[bold yellow]Your choice ({chr(44).join(valid_choices.keys())})[/bold yellow]"
109
+ ).strip().upper()
110
+
111
+ if raw_input in valid_choices:
112
+ choice = valid_choices[raw_input]
113
+ break
114
+ console.print(f"[red]Invalid option. Please choose one of: {chr(44).join(valid_choices.keys())}[/red]")
115
+
116
+ elapsed = time.time() - start_time
117
+ mcq_telemetry.record_question_time(q.id, elapsed)
118
+
119
+ answers.append(
120
+ StudentAnswer(
121
+ question_id=q.id,
122
+ selected_option=choice,
123
+ time_taken_seconds=round(elapsed, 2),
124
+ )
125
+ )
126
+
127
+ # 5. MCQ Answers Summary
128
+ console.print("\n" + "=" * 50)
129
+ console.print("[bold green]All MCQ questions answered![/bold green]")
130
+
131
+ summary_table = Table(title="MCQ Answers Summary", show_header=True)
132
+ summary_table.add_column("Question", style="cyan")
133
+ summary_table.add_column("Selected Option", style="bold green")
134
+ summary_table.add_column("Time Taken (s)", style="dim")
135
+
136
+ for idx, ans in enumerate(answers, start=1):
137
+ summary_table.add_row(f"Q{idx}", ans.selected_option, f"{ans.time_taken_seconds:.1f}s")
138
+
139
+ console.print(summary_table)
140
+
141
+ # Compile MCQ telemetry and submit
142
+ final_mcq_telemetry = TelemetryData(**mcq_telemetry.build_telemetry())
143
+ submission = StudentSubmission(
144
+ exam_id=exam.exam_id,
145
+ student_name=student_name,
146
+ student_id=student_id,
147
+ answers=answers,
148
+ telemetry=final_mcq_telemetry,
149
+ )
150
+
151
+ with console.status("[bold green]Submitting MCQ answers to instructor...", spinner="dots"):
152
+ try:
153
+ result = client.submit(submission)
154
+ console.print(
155
+ Panel.fit(
156
+ f"[bold green]MCQ Submitted Successfully![/bold green]\n"
157
+ f"Receipt: [cyan]{result.get('receipt_id', 'N/A')}[/cyan]\n"
158
+ f"[dim]{result.get('message', 'MCQ recorded securely.')}[/dim]",
159
+ border_style="green",
160
+ )
161
+ )
162
+ except NetworkError as e:
163
+ console.print(f"[bold red]MCQ Submission Error:[/bold red] {e}")
164
+ console.print("[yellow]Please inform your instructor immediately.[/yellow]")
165
+ if not has_practical:
166
+ sys.exit(1)
167
+
168
+ # 6. Part 2: Practical EDA Examination (JupyterLite)
169
+ if has_practical:
170
+ practical_url = f"{client.base_url}/practical?student_id={student_id}"
171
+ duration_mins = exam.practical_exam.duration_minutes
172
+
173
+ console.print("\n" + "=" * 60)
174
+ console.print(
175
+ Panel(
176
+ f"[bold cyan]PART 2: PRACTICAL EDA EXAMINATION[/bold cyan]\n\n"
177
+ f"• [bold]Duration:[/bold] {duration_mins} minutes\n"
178
+ f"• [bold]Environment:[/bold] JupyterLite (In-Browser WebAssembly Python IDE)\n"
179
+ f"• [bold]Dataset:[/bold] {exam.practical_exam.dataset_filename}\n\n"
180
+ f"[bold yellow]👉 Opening your interactive notebook environment in your browser...[/bold yellow]\n"
181
+ f"URL: [cyan underline]{practical_url}[/cyan underline]\n\n"
182
+ f"[bold yellow]⚠️ SURVEILLANCE ACTIVE:[/bold yellow]\n"
183
+ f"[dim]• Browser tab switches and background applications are monitored.\n"
184
+ f"• Focus exclusively on JupyterLite; external browsing and AI tools are prohibited.\n"
185
+ f"• Keep this terminal open while you work on your EDA.[/dim]",
186
+ title="[bold yellow]Transition to Practical Exam[/bold yellow]",
187
+ border_style="yellow",
188
+ )
189
+ )
190
+
191
+ try:
192
+ webbrowser.open(practical_url)
193
+ except Exception:
194
+ console.print("[yellow]Could not automatically launch browser. Please open the URL manually.[/yellow]")
195
+
196
+ practical_telemetry = TelemetryCollector(allow_browsers=True, is_practical_phase=True)
197
+ practical_telemetry.scan_processes()
198
+
199
+ console.print(
200
+ "\n[bold green]Status:[/bold green] You may now complete your analysis in JupyterLite.\n"
201
+ "When finished, you can either:\n"
202
+ " 1. Click [bold cyan]'Submit Notebook'[/bold cyan] directly in your web browser, OR\n"
203
+ " 2. Drag and drop your downloaded [bold cyan].ipynb[/bold cyan] file here into this terminal.\n"
204
+ )
205
+
206
+ while True:
207
+ status_check = client.check_practical_status(student_id)
208
+ if status_check.get("practical_submitted"):
209
+ console.print(
210
+ Panel.fit(
211
+ f"[bold green]Practical Exam Submission Detected & Confirmed![/bold green]\n"
212
+ f"Notebook: [cyan]{status_check.get('practical_notebook', 'eda_analysis.ipynb')}[/cyan]\n"
213
+ f"[dim]Both MCQ and Practical exam sections are complete. You may now close this terminal.[/dim]",
214
+ border_style="green",
215
+ )
216
+ )
217
+ break
218
+
219
+ user_action = Prompt.ask(
220
+ "[bold yellow]Press [Enter] to refresh status, or enter path to .ipynb to submit via CLI (or 'quit')[/bold yellow]",
221
+ default="",
222
+ ).strip()
223
+
224
+ if user_action.lower() == "quit":
225
+ if Confirm.ask("Are you sure you want to exit without verifying submission?"):
226
+ break
227
+ continue
228
+
229
+ if user_action and os.path.exists(user_action):
230
+ if not user_action.endswith(".ipynb"):
231
+ console.print("[bold red]File must be a Jupyter Notebook (.ipynb)[/bold red]")
232
+ continue
233
+
234
+ with open(user_action, "r", encoding="utf-8") as f:
235
+ content = f.read()
236
+
237
+ final_p_telemetry = TelemetryData(**practical_telemetry.build_telemetry())
238
+ prac_sub = PracticalSubmission(
239
+ exam_id=exam.exam_id,
240
+ student_id=student_id,
241
+ student_name=student_name,
242
+ notebook_content=content,
243
+ notebook_filename=os.path.basename(user_action),
244
+ telemetry=final_p_telemetry,
245
+ )
246
+
247
+ with console.status("[bold green]Uploading notebook to instructor...", spinner="dots"):
248
+ try:
249
+ res = client.submit_practical(prac_sub)
250
+ console.print(
251
+ Panel.fit(
252
+ f"[bold green]Notebook Submitted Successfully via CLI![/bold green]\n"
253
+ f"Receipt: [cyan]{res.get('receipt_id', 'N/A')}[/cyan]\n"
254
+ f"File Saved: [cyan]{res.get('file_saved', 'N/A')}[/cyan]\n"
255
+ f"[dim]Exam complete. Thank you![/dim]",
256
+ border_style="green",
257
+ )
258
+ )
259
+ break
260
+ except NetworkError as err:
261
+ console.print(f"[bold red]CLI Submission Error:[/bold red] {err}")
262
+ elif user_action:
263
+ console.print(f"[bold red]File not found: {user_action}[/bold red]")
264
+ else:
265
+ practical_telemetry.scan_processes()
266
+ console.print("[dim]Checking submission status on server...[/dim]")
267
+
268
+ console.print("\n[bold green]Thank you for completing the examination![/bold green]")
269
+
270
+
271
+ def main():
272
+ try:
273
+ run_exam()
274
+ except KeyboardInterrupt:
275
+ console.print("\n[bold red]Exam session interrupted by user. Exiting.[/bold red]")
276
+ sys.exit(130)
277
+
278
+
279
+ if __name__ == "__main__":
280
+ main()
@@ -0,0 +1,70 @@
1
+ """Client-side data models for GuelmimCQ."""
2
+
3
+ from typing import Dict, List, Optional
4
+ from pydantic import BaseModel, Field
5
+
6
+
7
+ class QuestionOption(BaseModel):
8
+ key: str # e.g., "A", "B", "C", "D"
9
+ text: str
10
+
11
+
12
+ class ClientQuestion(BaseModel):
13
+ id: str
14
+ text: str
15
+ options: List[QuestionOption]
16
+
17
+
18
+ class PracticalExamInfo(BaseModel):
19
+ enabled: bool = True
20
+ title: str = "Practical EDA Examination"
21
+ duration_minutes: int = 90
22
+ instructions: str = ""
23
+ dataset_filename: str = "dataset.csv"
24
+ has_dataset: bool = True
25
+
26
+
27
+ class ExamDetails(BaseModel):
28
+ exam_id: str
29
+ title: str
30
+ description: Optional[str] = None
31
+ mcq_duration_minutes: int = 30
32
+ questions: List[ClientQuestion]
33
+ practical_exam: Optional[PracticalExamInfo] = None
34
+
35
+
36
+ class StudentAnswer(BaseModel):
37
+ question_id: str
38
+ selected_option: str
39
+ time_taken_seconds: float = 0.0
40
+
41
+
42
+ class TelemetryData(BaseModel):
43
+ start_time: float
44
+ end_time: float
45
+ platform: str
46
+ os_version: str
47
+ python_version: str
48
+ flagged_processes: List[str] = Field(default_factory=list)
49
+ question_timings: Dict[str, float] = Field(default_factory=dict)
50
+ fast_answers_count: int = 0
51
+ paste_detected_count: int = 0
52
+ is_practical_phase: bool = False
53
+
54
+
55
+ class StudentSubmission(BaseModel):
56
+ exam_id: str
57
+ student_name: str
58
+ student_id: str
59
+ answers: List[StudentAnswer]
60
+ telemetry: TelemetryData
61
+
62
+
63
+ class PracticalSubmission(BaseModel):
64
+ exam_id: str
65
+ student_id: str
66
+ student_name: str
67
+ notebook_content: str
68
+ notebook_filename: str = "eda_analysis.ipynb"
69
+ telemetry: Optional[TelemetryData] = None
70
+ browser_tab_switches: int = 0
@@ -0,0 +1,112 @@
1
+ # Network communication with the GuelmimCQ teacher server.
2
+
3
+ from typing import Dict, Any, Optional
4
+ import requests
5
+ from requests.exceptions import RequestException
6
+
7
+ from guelmimcq.models import ExamDetails, StudentSubmission, PracticalSubmission
8
+
9
+
10
+ class NetworkError(Exception):
11
+ """Raised when server communication fails."""
12
+ pass
13
+
14
+
15
+ class ServerClient:
16
+ """Client for talking to the GuelmimCQ server."""
17
+
18
+ def __init__(self, base_url: str, timeout: int = 15):
19
+ # Normalize URL
20
+ url = base_url.strip()
21
+ if not url.startswith("http://") and not url.startswith("https://"):
22
+ url = f"https://{url}"
23
+ self.base_url = url.rstrip("/")
24
+ self.timeout = timeout
25
+
26
+ def check_connection(self) -> bool:
27
+ """Ping the server /health endpoint."""
28
+ try:
29
+ resp = requests.get(f"{self.base_url}/health", timeout=self.timeout)
30
+ return resp.status_code == 200 and resp.json().get("status") == "ok"
31
+ except RequestException:
32
+ return False
33
+
34
+ def register(self, student_name: str, student_id: str) -> ExamDetails:
35
+ """Register the student and receive personalized question set."""
36
+ try:
37
+ resp = requests.post(
38
+ f"{self.base_url}/register",
39
+ json={"student_name": student_name, "student_id": student_id},
40
+ timeout=self.timeout,
41
+ )
42
+ if resp.status_code != 200:
43
+ raise NetworkError(f"Server error ({resp.status_code}): {resp.text}")
44
+ return ExamDetails(**resp.json())
45
+ except RequestException as e:
46
+ raise NetworkError(f"Failed to connect to exam server: {e}")
47
+
48
+ def submit(self, submission: StudentSubmission) -> Dict[str, Any]:
49
+ """Submit the completed MCQ exam and telemetry."""
50
+ try:
51
+ resp = requests.post(
52
+ f"{self.base_url}/submit",
53
+ json=submission.model_dump(),
54
+ timeout=self.timeout,
55
+ )
56
+ if resp.status_code != 200:
57
+ raise NetworkError(f"Server rejected submission ({resp.status_code}): {resp.text}")
58
+ return resp.json()
59
+ except RequestException as e:
60
+ raise NetworkError(f"Failed to submit exam: {e}")
61
+
62
+ def submit_practical(self, submission: PracticalSubmission) -> Dict[str, Any]:
63
+ """Submit the completed practical notebook and telemetry."""
64
+ try:
65
+ resp = requests.post(
66
+ f"{self.base_url}/practical/submit",
67
+ json=submission.model_dump(),
68
+ timeout=self.timeout,
69
+ )
70
+ if resp.status_code != 200:
71
+ raise NetworkError(f"Server rejected practical submission ({resp.status_code}): {resp.text}")
72
+ return resp.json()
73
+ except RequestException as e:
74
+ raise NetworkError(f"Failed to submit practical exam: {e}")
75
+
76
+ def check_practical_status(self, student_id: str) -> Dict[str, Any]:
77
+ """Query whether practical submission has been recorded on the server."""
78
+ try:
79
+ resp = requests.get(
80
+ f"{self.base_url}/practical/status",
81
+ params={"student_id": student_id},
82
+ timeout=self.timeout,
83
+ )
84
+ if resp.status_code == 200:
85
+ return resp.json()
86
+ return {"practical_submitted": False}
87
+ except RequestException:
88
+ return {"practical_submitted": False}
89
+
90
+ def download_dataset(self, save_path: str) -> bool:
91
+ """Download the practical exam dataset to a local file."""
92
+ try:
93
+ resp = requests.get(f"{self.base_url}/practical/dataset", timeout=self.timeout)
94
+ if resp.status_code == 200:
95
+ with open(save_path, "wb") as f:
96
+ f.write(resp.content)
97
+ return True
98
+ return False
99
+ except RequestException:
100
+ return False
101
+
102
+ def download_starter_notebook(self, save_path: str) -> bool:
103
+ """Download the starter notebook to a local file."""
104
+ try:
105
+ resp = requests.get(f"{self.base_url}/practical/starter-notebook", timeout=self.timeout)
106
+ if resp.status_code == 200:
107
+ with open(save_path, "wb") as f:
108
+ f.write(resp.content)
109
+ return True
110
+ return False
111
+ except RequestException:
112
+ return False
@@ -0,0 +1,85 @@
1
+ # Telemetry and integrity monitoring for GuelmimCQ.
2
+
3
+ import platform
4
+ import sys
5
+ import time
6
+ from typing import Dict, List, Set
7
+ import psutil
8
+
9
+ # Target process keywords for background activity inspection
10
+ AI_ASSISTANT_KEYWORDS = {"chatgpt", "cursor", "copilot", "chatbox", "claude"}
11
+ COMMUNICATION_KEYWORDS = {"discord", "slack", "teams", "telegram", "whatsapp"}
12
+ BROWSER_KEYWORDS = {
13
+ "chrome", "firefox", "safari", "msedge", "edge", "brave", "opera", "arc"
14
+ }
15
+
16
+
17
+ class TelemetryCollector:
18
+ """Collects client-side behavioral and environment signals."""
19
+
20
+ def __init__(
21
+ self,
22
+ fast_threshold_seconds: float = 1.5,
23
+ allow_browsers: bool = False,
24
+ is_practical_phase: bool = False,
25
+ ):
26
+ self.fast_threshold = fast_threshold_seconds
27
+ self.allow_browsers = allow_browsers
28
+ self.is_practical_phase = is_practical_phase
29
+ self.start_time: float = time.time()
30
+ self.question_timings: Dict[str, float] = {}
31
+ self.fast_answers_count: int = 0
32
+ self.paste_detected_count: int = 0
33
+ self.detected_processes: Set[str] = set()
34
+
35
+ def record_question_time(self, question_id: str, elapsed: float) -> None:
36
+ """Record the time spent on a question."""
37
+ self.question_timings[question_id] = round(elapsed, 2)
38
+ if elapsed < self.fast_threshold:
39
+ self.fast_answers_count += 1
40
+
41
+ def record_paste_event(self) -> None:
42
+ """Record a suspected paste event."""
43
+ self.paste_detected_count += 1
44
+
45
+ def scan_processes(self) -> List[str]:
46
+ """Scan running processes for potentially unpermitted tools.
47
+
48
+ Uses psutil safely without raising exceptions on permission denied.
49
+ If allow_browsers is True (practical exam phase), browsers are ignored.
50
+ """
51
+ found = set()
52
+ suspicious_keywords = set(AI_ASSISTANT_KEYWORDS | COMMUNICATION_KEYWORDS)
53
+ if not self.allow_browsers:
54
+ suspicious_keywords.update(BROWSER_KEYWORDS)
55
+
56
+ for proc in psutil.process_iter(["name"]):
57
+ try:
58
+ name = (proc.info.get("name") or "").lower()
59
+ for keyword in suspicious_keywords:
60
+ if keyword in name:
61
+ found.add(name)
62
+ except (psutil.NoSuchProcess, psutil.AccessDenied, psutil.ZombieProcess):
63
+ continue
64
+
65
+ self.detected_processes.update(found)
66
+ return sorted(list(self.detected_processes))
67
+
68
+ def build_telemetry(self) -> dict:
69
+ """Compile final telemetry summary."""
70
+ # Run a final scan
71
+ self.scan_processes()
72
+ end_time = time.time()
73
+
74
+ return {
75
+ "start_time": self.start_time,
76
+ "end_time": end_time,
77
+ "platform": platform.system(),
78
+ "os_version": platform.release(),
79
+ "python_version": sys.version.split()[0],
80
+ "flagged_processes": sorted(list(self.detected_processes)),
81
+ "question_timings": self.question_timings,
82
+ "fast_answers_count": self.fast_answers_count,
83
+ "paste_detected_count": self.paste_detected_count,
84
+ "is_practical_phase": self.is_practical_phase,
85
+ }
@@ -0,0 +1,36 @@
1
+ Metadata-Version: 2.4
2
+ Name: guelmimcq
3
+ Version: 0.1.0
4
+ Summary: Fast, interactive terminal-based MCQ client with built-in telemetry.
5
+ Author: GuelmimCQ Team
6
+ Requires-Python: >=3.9
7
+ Description-Content-Type: text/markdown
8
+ Requires-Dist: requests>=2.28.0
9
+ Requires-Dist: rich>=13.0.0
10
+ Requires-Dist: psutil>=5.9.0
11
+ Requires-Dist: pydantic>=2.0
12
+
13
+ # guelmimcq
14
+
15
+ Interactive client for taking multiple-choice and practical data examinations (including in-browser JupyterLite EDA analysis) directly on your machine.
16
+
17
+ ## Installation
18
+
19
+ ```bash
20
+ pip install guelmimcq
21
+ ```
22
+
23
+ ## Usage
24
+
25
+ Simply run:
26
+
27
+ ```bash
28
+ guelmimcq
29
+ ```
30
+
31
+ Follow the prompts on your terminal:
32
+ 1. Enter your Full Name and Student ID.
33
+ 2. Enter the exam server URL provided by your instructor.
34
+ 3. **Part 1 (MCQ):** Answer each multiple-choice question using your keyboard and submit.
35
+ 4. **Part 2 (Practical EDA):** Your browser will automatically launch the interactive JupyterLite environment to complete your 1h30 data analysis.
36
+ 5. Upload your finished `.ipynb` notebook file through the web portal or drag & drop into the terminal.
@@ -0,0 +1,14 @@
1
+ MANIFEST.in
2
+ README.md
3
+ pyproject.toml
4
+ guelmimcq/__init__.py
5
+ guelmimcq/cli.py
6
+ guelmimcq/models.py
7
+ guelmimcq/network.py
8
+ guelmimcq/telemetry.py
9
+ guelmimcq.egg-info/PKG-INFO
10
+ guelmimcq.egg-info/SOURCES.txt
11
+ guelmimcq.egg-info/dependency_links.txt
12
+ guelmimcq.egg-info/entry_points.txt
13
+ guelmimcq.egg-info/requires.txt
14
+ guelmimcq.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ guelmimcq = guelmimcq.cli:main
@@ -0,0 +1,4 @@
1
+ requests>=2.28.0
2
+ rich>=13.0.0
3
+ psutil>=5.9.0
4
+ pydantic>=2.0
@@ -0,0 +1 @@
1
+ guelmimcq
@@ -0,0 +1,26 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "guelmimcq"
7
+ version = "0.1.0"
8
+ description = "Fast, interactive terminal-based MCQ client with built-in telemetry."
9
+ readme = "README.md"
10
+ requires-python = ">=3.9"
11
+ authors = [
12
+ { name = "GuelmimCQ Team" }
13
+ ]
14
+ dependencies = [
15
+ "requests>=2.28.0",
16
+ "rich>=13.0.0",
17
+ "psutil>=5.9.0",
18
+ "pydantic>=2.0",
19
+ ]
20
+
21
+ [project.scripts]
22
+ guelmimcq = "guelmimcq.cli:main"
23
+
24
+ [tool.setuptools.packages.find]
25
+ include = ["guelmimcq*"]
26
+ exclude = ["guelmimcq.server*"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+