mirror of
https://github.com/cliffe/BreakEscape.git
synced 2026-02-20 13:50:46 +00:00
365 lines
13 KiB
HTML
365 lines
13 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Text File Minigame Test</title>
|
|
<link rel="stylesheet" href="css/main.css">
|
|
<link rel="stylesheet" href="css/minigames-framework.css">
|
|
<link rel="stylesheet" href="css/text-file-minigame.css">
|
|
<style>
|
|
body {
|
|
background: #000;
|
|
color: #00ff00;
|
|
font-family: 'Courier New', monospace;
|
|
margin: 0;
|
|
padding: 20px;
|
|
}
|
|
|
|
.test-container {
|
|
max-width: 800px;
|
|
margin: 0 auto;
|
|
}
|
|
|
|
.test-button {
|
|
background: rgba(0, 255, 0, 0.1);
|
|
border: 2px solid #00ff00;
|
|
color: #00ff00;
|
|
padding: 15px 30px;
|
|
margin: 10px;
|
|
border-radius: 5px;
|
|
cursor: pointer;
|
|
font-family: 'Courier New', monospace;
|
|
font-size: 14px;
|
|
transition: all 0.2s ease;
|
|
}
|
|
|
|
.test-button:hover {
|
|
background: rgba(0, 255, 0, 0.2);
|
|
box-shadow: 0 0 15px rgba(0, 255, 0, 0.3);
|
|
}
|
|
|
|
.test-info {
|
|
background: rgba(0, 255, 0, 0.05);
|
|
border: 1px solid #00ff00;
|
|
padding: 15px;
|
|
margin: 20px 0;
|
|
border-radius: 5px;
|
|
}
|
|
|
|
.test-info h3 {
|
|
margin-top: 0;
|
|
color: #00ff00;
|
|
}
|
|
|
|
.test-info p {
|
|
margin: 5px 0;
|
|
color: #ccc;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="test-container">
|
|
<h1>📄 Text File Minigame Test</h1>
|
|
|
|
<div class="test-info">
|
|
<h3>Test Instructions:</h3>
|
|
<p>1. Click the test buttons below to launch different text file scenarios</p>
|
|
<p>2. Test the "Add to Notebook" functionality</p>
|
|
<p>3. Test copy and select all features</p>
|
|
<p>4. Test keyboard shortcuts (Ctrl+A, Ctrl+C, Escape)</p>
|
|
</div>
|
|
|
|
<button class="test-button" onclick="testBasicTextFile()">
|
|
📄 Test Basic Text File
|
|
</button>
|
|
|
|
<button class="test-button" onclick="testLongTextFile()">
|
|
📄 Test Long Text File
|
|
</button>
|
|
|
|
<button class="test-button" onclick="testCodeFile()">
|
|
💻 Test Code File
|
|
</button>
|
|
|
|
<button class="test-button" onclick="testEmptyFile()">
|
|
📄 Test Empty File
|
|
</button>
|
|
|
|
<button class="test-button" onclick="testCEOExfilFile()">
|
|
🎯 Test CEO Exfil File (from scenario)
|
|
</button>
|
|
|
|
<div class="test-info">
|
|
<h3>Expected Behavior:</h3>
|
|
<p>• Text file minigame should open with Mac-style window decorations</p>
|
|
<p>• VT323 font should be used for all text content</p>
|
|
<p>• Black text on white background (clean, readable interface)</p>
|
|
<p>• Window controls: close (red), minimize (yellow - closes window), maximize (green - toggles fullscreen)</p>
|
|
<p>• "Add to Notebook" button should work (if notes minigame is available)</p>
|
|
<p>• Copy and Select All buttons should function</p>
|
|
<p>• Escape key should close the minigame</p>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Minigame container -->
|
|
<div id="minigame-container" style="display: none;"></div>
|
|
|
|
<script type="module">
|
|
// Import the minigame framework and text file minigame
|
|
import { MinigameFramework } from './js/minigames/framework/minigame-manager.js';
|
|
import { TextFileMinigame } from './js/minigames/text-file/text-file-minigame.js';
|
|
|
|
// Initialize the framework
|
|
window.MinigameFramework = MinigameFramework;
|
|
MinigameFramework.registerScene('text-file', TextFileMinigame);
|
|
|
|
// Test data
|
|
const testFiles = {
|
|
basic: {
|
|
fileName: 'readme.txt',
|
|
fileContent: `Welcome to BreakEscape!
|
|
|
|
This is a test text file to demonstrate the text file minigame functionality.
|
|
|
|
Features:
|
|
- File content display
|
|
- Copy to clipboard
|
|
- Select all text
|
|
- Add to notebook
|
|
- Keyboard shortcuts
|
|
|
|
The minigame should handle this content properly and provide a good user experience.`,
|
|
fileType: 'text',
|
|
observations: 'A simple text file for testing purposes',
|
|
source: 'Test Environment'
|
|
},
|
|
|
|
long: {
|
|
fileName: 'security_report.txt',
|
|
fileContent: `SECURITY INCIDENT REPORT
|
|
================================
|
|
|
|
Date: ${new Date().toLocaleDateString()}
|
|
Time: ${new Date().toLocaleTimeString()}
|
|
Reporter: Security Team
|
|
Classification: CONFIDENTIAL
|
|
|
|
INCIDENT SUMMARY:
|
|
A potential security breach was detected in the main server room. Unauthorized access was attempted through the ventilation system. The intruder appears to have been familiar with the building layout and security protocols.
|
|
|
|
DETAILS:
|
|
- Time of incident: 02:30 AM
|
|
- Location: Server Room A, Floor 3
|
|
- Method: Physical intrusion via ventilation shaft
|
|
- Duration: Approximately 15 minutes
|
|
- Damage: None detected
|
|
- Evidence: Fingerprints on server rack, disturbed dust patterns
|
|
|
|
SUSPECT PROFILE:
|
|
- Height: Approximately 5'8" to 6'0"
|
|
- Build: Average to athletic
|
|
- Clothing: Dark clothing, possibly tactical gear
|
|
- Equipment: Professional lockpicking tools, small flashlight
|
|
- Knowledge: Familiar with building layout and security systems
|
|
|
|
EVIDENCE COLLECTED:
|
|
1. Fingerprint samples from server rack
|
|
2. Dust disturbance patterns
|
|
3. Security camera footage (partially obscured)
|
|
4. Tool marks on ventilation cover
|
|
|
|
RECOMMENDATIONS:
|
|
1. Increase security patrols in server room area
|
|
2. Install additional cameras in ventilation access points
|
|
3. Review and update access control procedures
|
|
4. Conduct security awareness training for all staff
|
|
5. Consider upgrading physical security measures
|
|
|
|
FOLLOW-UP ACTIONS:
|
|
- [ ] Review security camera footage
|
|
- [ ] Interview security personnel on duty
|
|
- [ ] Check access logs for any anomalies
|
|
- [ ] Coordinate with law enforcement if necessary
|
|
- [ ] Update incident response procedures
|
|
|
|
This incident highlights the need for enhanced physical security measures and regular security assessments. All personnel should remain vigilant and report any suspicious activity immediately.
|
|
|
|
END OF REPORT`,
|
|
fileType: 'text',
|
|
observations: 'Confidential security incident report',
|
|
source: 'Security Department'
|
|
},
|
|
|
|
code: {
|
|
fileName: 'access_control.py',
|
|
fileContent: `#!/usr/bin/env python3
|
|
"""
|
|
Access Control System
|
|
Handles authentication and authorization for the BreakEscape system
|
|
"""
|
|
|
|
import hashlib
|
|
import time
|
|
from datetime import datetime, timedelta
|
|
|
|
class AccessControl:
|
|
def __init__(self):
|
|
self.users = {}
|
|
self.sessions = {}
|
|
self.failed_attempts = {}
|
|
self.max_attempts = 3
|
|
self.lockout_duration = 300 # 5 minutes
|
|
|
|
def hash_password(self, password):
|
|
"""Hash password using SHA-256"""
|
|
return hashlib.sha256(password.encode()).hexdigest()
|
|
|
|
def authenticate(self, username, password):
|
|
"""Authenticate user with username and password"""
|
|
if username in self.failed_attempts:
|
|
if self.failed_attempts[username]['count'] >= self.max_attempts:
|
|
if time.time() - self.failed_attempts[username]['last_attempt'] < self.lockout_duration:
|
|
return False, "Account locked due to too many failed attempts"
|
|
|
|
if username in self.users:
|
|
hashed_password = self.hash_password(password)
|
|
if self.users[username]['password'] == hashed_password:
|
|
# Reset failed attempts on successful login
|
|
if username in self.failed_attempts:
|
|
del self.failed_attempts[username]
|
|
|
|
# Create session
|
|
session_id = self.create_session(username)
|
|
return True, session_id
|
|
else:
|
|
self.record_failed_attempt(username)
|
|
return False, "Invalid password"
|
|
else:
|
|
return False, "User not found"
|
|
|
|
def create_session(self, username):
|
|
"""Create a new session for the user"""
|
|
session_id = hashlib.md5(f"{username}{time.time()}".encode()).hexdigest()
|
|
self.sessions[session_id] = {
|
|
'username': username,
|
|
'created': time.time(),
|
|
'last_activity': time.time()
|
|
}
|
|
return session_id
|
|
|
|
def validate_session(self, session_id):
|
|
"""Validate if session is still active"""
|
|
if session_id in self.sessions:
|
|
session = self.sessions[session_id]
|
|
if time.time() - session['last_activity'] < 3600: # 1 hour timeout
|
|
session['last_activity'] = time.time()
|
|
return True, session['username']
|
|
else:
|
|
del self.sessions[session_id]
|
|
return False, "Session expired"
|
|
return False, "Invalid session"
|
|
|
|
def record_failed_attempt(self, username):
|
|
"""Record a failed login attempt"""
|
|
if username not in self.failed_attempts:
|
|
self.failed_attempts[username] = {'count': 0, 'last_attempt': 0}
|
|
|
|
self.failed_attempts[username]['count'] += 1
|
|
self.failed_attempts[username]['last_attempt'] = time.time()
|
|
|
|
def add_user(self, username, password, role='user'):
|
|
"""Add a new user to the system"""
|
|
if username in self.users:
|
|
return False, "User already exists"
|
|
|
|
self.users[username] = {
|
|
'password': self.hash_password(password),
|
|
'role': role,
|
|
'created': time.time()
|
|
}
|
|
return True, "User created successfully"
|
|
|
|
# Example usage
|
|
if __name__ == "__main__":
|
|
ac = AccessControl()
|
|
|
|
# Add some test users
|
|
ac.add_user("admin", "admin123", "admin")
|
|
ac.add_user("user1", "password123", "user")
|
|
|
|
# Test authentication
|
|
success, result = ac.authenticate("admin", "admin123")
|
|
if success:
|
|
print(f"Login successful! Session ID: {result}")
|
|
else:
|
|
print(f"Login failed: {result}")`,
|
|
fileType: 'python',
|
|
observations: 'Python code for access control system',
|
|
source: 'Development Team'
|
|
},
|
|
|
|
empty: {
|
|
fileName: 'empty.txt',
|
|
fileContent: '',
|
|
fileType: 'text',
|
|
observations: 'An empty text file',
|
|
source: 'Test Environment'
|
|
},
|
|
|
|
ceoExfil: {
|
|
fileName: 'Private',
|
|
fileContent: 'Closet keypad code: 7391 - Must move evidence to safe before audit',
|
|
fileType: 'text',
|
|
observations: 'Private file found on reception computer',
|
|
source: 'Reception Computer'
|
|
}
|
|
};
|
|
|
|
// Test functions
|
|
window.testBasicTextFile = function() {
|
|
startTextFileMinigame(testFiles.basic);
|
|
};
|
|
|
|
window.testLongTextFile = function() {
|
|
startTextFileMinigame(testFiles.long);
|
|
};
|
|
|
|
window.testCodeFile = function() {
|
|
startTextFileMinigame(testFiles.code);
|
|
};
|
|
|
|
window.testEmptyFile = function() {
|
|
startTextFileMinigame(testFiles.empty);
|
|
};
|
|
|
|
window.testCEOExfilFile = function() {
|
|
startTextFileMinigame(testFiles.ceoExfil);
|
|
};
|
|
|
|
function startTextFileMinigame(fileData) {
|
|
const container = document.getElementById('minigame-container');
|
|
container.style.display = 'block';
|
|
|
|
const minigameParams = {
|
|
title: `Text File - ${fileData.fileName}`,
|
|
fileName: fileData.fileName,
|
|
fileContent: fileData.fileContent,
|
|
fileType: fileData.fileType,
|
|
observations: fileData.observations,
|
|
source: fileData.source,
|
|
onComplete: (success, result) => {
|
|
console.log('Text file minigame completed:', success, result);
|
|
container.style.display = 'none';
|
|
}
|
|
};
|
|
|
|
MinigameFramework.startMinigame('text-file', container, minigameParams);
|
|
}
|
|
|
|
console.log('Text File Minigame Test Page Loaded');
|
|
console.log('Available test functions:', Object.keys(window).filter(key => key.startsWith('test')));
|
|
</script>
|
|
</body>
|
|
</html>
|