-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconstants.tsx
More file actions
209 lines (203 loc) · 11.2 KB
/
constants.tsx
File metadata and controls
209 lines (203 loc) · 11.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
import { Level, CodexEntry } from './types';
export const LEVELS: Level[] = [
{
id: 1,
title: "The First Breach: Exact Value Scanning",
description: "The Sentinels are patrolling. Your health is at 100. Find the address holding this value and change it to 9999 to survive the first wave.",
requiredSkill: "Exact Value Search",
objective: (state) => state.health >= 9000,
hint: "Use the Scanner to find the value '100'. Take a small hit, then scan for the new value.",
tutorPersona: "You are Morpheus. Guide the recruit through their first memory scan. Explain that health is stored as a 4-byte integer and they must find the address holding '100'.",
memoryLayout: [{ key: 'health', label: 'HEALTH_VAL', type: 'int', offset: 0x10 }]
},
{
id: 2,
title: "Float Manipulation: The Ghost Walk",
description: "A hard-coded barrier blocks the exit at X=600. Your coordinates are stored as floating-point numbers. Find your X-coordinate and 'teleport' past 600.",
requiredSkill: "Float Scanning",
objective: (state) => state.playerX > 600,
hint: "Coordinates are often 'Float' types. Search for your current X position (visible in the debug overlay).",
tutorPersona: "You are Morpheus. Explain that the physics of the Matrix are defined by floating-point precision. Show them how to track their X-coordinate as it changes.",
memoryLayout: [{ key: 'playerX', label: 'COORD_X', type: 'float', offset: 0x44 }]
},
{
id: 3,
title: "Pointer Logic: Static vs Dynamic",
description: "The Matrix re-randomizes addresses. Find the Static Base Pointer for 'Ammo' so your hack persists even after a memory shift.",
requiredSkill: "Pointer Scanning & Offsets",
objective: (state) => state.ammo > 500,
hint: "A value that changes address on restart is dynamic. You need to find the green 'Static' address that points to it.",
tutorPersona: "You are Morpheus. Teach them about the volatility of dynamic memory. Explain that static base pointers are the only truth in a shifting reality. They must find the green pointer and apply the offset 28.",
memoryLayout: [
{ key: 'baseAddress', label: 'PTR_TO_PLAYER', type: 'pointer', offset: 0x0, isStatic: true },
{ key: 'ammo', label: 'AMMO_COUNT', type: 'int', offset: 28 }
]
},
{
id: 4,
title: "Logic Hijacking: The Admin Flag",
description: "The system uses a boolean flag 'isAdmin' to control the security gate. Find the boolean address and flip it from 0 to 1.",
requiredSkill: "Boolean Toggling",
objective: (state) => state.isAdmin === true,
hint: "Sometimes '0' means false and '1' means true. Look for a 1-byte value near the player structure.",
tutorPersona: "You are Morpheus. Reveal that authority is just a bit in the machine. Guide them to find the isAdmin flag and rewrite it from false (0) to true (1).",
memoryLayout: [{ key: 'isAdmin', label: 'ADMIN_FLAG', type: 'bool', offset: 0x30 }]
}
];
export const SYSTEM_BASE_ADDR = "0x7FFD00";
// Exported memory map for components that require static address lookups
export const MEMORY_ADDRESS_MAP = [
{ address: "0x0040000", label: "Health", type: "int", key: "health" },
{ address: "0x0040004", label: "Ammo", type: "int", key: "ammo" },
{ address: "0x0040008", label: "PosX", type: "float", key: "playerX" },
{ address: "0x004000C", label: "isAdmin", type: "bool", key: "isAdmin" },
{ address: "0x0040010", label: "Compliance", type: "float", key: "compliance" },
];
// REINFORCEMENT LEARNING DATABASE
export const CODEX_ENTRIES: CodexEntry[] = [
{
id: 'mem_basics',
title: "The Nature of Memory",
category: "MEM",
requiredLevel: 2,
content: "Memory is not a solid storage unit; it is a fluid grid of voltage states. When you change 'Health' from 10 to 100, you are not healing a wound; you are rearranging electrons at a specific offset. The 'Address' is simply the coordinate of that arrangement."
},
{
id: 'pointers',
title: "The Pointer Paradox",
category: "MEM",
requiredLevel: 3,
content: "A Pointer is a signpost, not the destination. Dynamic Memory Allocation (ASLR, Heap) means the destination moves every time the universe reboots. The Pointer is the only constant. To control the chaos, you must hold the signpost, not the building."
},
{
id: 'binary_logic',
title: "The Illusion of Choice",
category: "ASM",
requiredLevel: 4,
content: "A locked door in the Matrix is not a physical barrier. It is a 'JZ' (Jump Zero) instruction. It checks a single bit: 0 or 1. If you flip the bit, the wall dissolves. Authority is just a boolean variable."
},
{
id: 'nop_sled',
title: "The Art of Doing Nothing",
category: "ASM",
requiredLevel: 6,
content: "0x90 (NOP) tells the processor to 'No Operation'. By replacing a security check with NOPs, you don't fight the guard; you make the guard vanish. The CPU simply slides past the check as if it never existed."
},
{
id: 'stack_frame',
title: "The Stack: A Tower of Time",
category: "MEM",
requiredLevel: 9,
content: "The Stack records the history of execution. It grows downwards. When a function calls another, it pushes a 'Return Address' onto the stack so it knows where to go back. If you overwrite this address, you rewrite history."
},
{
id: 'heap_mgmt',
title: "The Heap: Chaos Theory",
category: "MEM",
requiredLevel: 10,
content: "Unlike the Stack, the Heap is unstructured. Objects are allocated and freed in any order. Use-After-Free bugs occur when the system forgets an object is dead, allowing a new 'soul' (data) to inhabit the old body (address)."
},
{
id: 'xor_cipher',
title: "XOR: The Perfect Mirror",
category: "ASM",
requiredLevel: 12,
content: "XOR is the only reversible logic gate. A ^ B = C, and C ^ B = A. If you XOR a secret with itself (A ^ A), it becomes Zero. This property makes it the foundation of both encryption and erasure."
},
{
id: 'trampoline',
title: "The Trampoline Jump",
category: "ASM",
requiredLevel: 18,
content: "When space is tight, you cannot build a castle. But you can build a bridge. A Trampoline is a small jump instruction that redirects traffic to a 'Code Cave' (Empty Memory) where you have unlimited space to work."
},
{
id: 'aslr',
title: "ASLR: The Shifting Sands",
category: "MEM",
requiredLevel: 28,
content: "Address Space Layout Randomization ensures the map changes every time. You cannot memorize coordinates. You must learn relative navigation. Find a leak (Info Leak) to determine the offset, then calculate the absolute truth."
},
{
id: 'rop_chain',
title: "Return Oriented Programming",
category: "ASM",
requiredLevel: 34,
content: "When they take away your ability to write (NX Bit), you must speak using their words. ROP uses 'Gadgets'—tiny snippets of existing code ending in RET. You chain these snippets together to form sentences they never intended to speak."
},
{
id: 'ring0',
title: "Ring 0: The Core",
category: "KER",
requiredLevel: 44,
content: "User Mode (Ring 3) is a simulation. Kernel Mode (Ring 0) is the hardware reality. There are no protections in Ring 0. If you corrupt the kernel, the simulation ends. You become the hardware."
},
// MEMORY LOOT ENTRIES - Hidden in unused memory
{
id: 'loot_phrack',
title: "Phrack Magazine Archive",
category: "MEM",
requiredLevel: 1,
content: "Phrack Magazine (1985-present) was the voice of the underground. Issue 49, Article 14: 'Smashing The Stack For Fun And Profit' by Aleph One changed exploit development forever. The knowledge was free, the impact was immeasurable."
},
{
id: 'loot_cuckoo',
title: "The Cuckoo's Egg",
category: "NET",
requiredLevel: 1,
content: "In 1986, astronomer Cliff Stoll discovered a 75-cent accounting error that led to catching a KGB hacker. His patience and attention to detail became the foundation of modern intrusion detection. Sometimes the smallest anomaly reveals the largest breach."
},
{
id: 'loot_morris',
title: "The Morris Worm",
category: "NET",
requiredLevel: 1,
content: "November 2, 1988: Robert Tappan Morris released the first internet worm. It exploited finger daemon, sendmail, and weak passwords. 6,000 machines crashed (10% of the internet). He didn't intend destruction, but proved that networked systems are fragile ecosystems."
},
{
id: 'loot_bluebox',
title: "The Blue Box Chronicles",
category: "NET",
requiredLevel: 1,
content: "1971: John Draper (Captain Crunch) discovered a toy whistle that generated a perfect 2600Hz tone, seizing AT&T trunk lines. Steve Jobs and Steve Wozniak sold blue boxes before Apple. Phreaking was the precursor to hacking - exploiting systems by understanding their language."
},
{
id: 'loot_jargon',
title: "The Jargon File",
category: "MEM",
requiredLevel: 1,
content: "Started at MIT in 1975, the Jargon File documented hacker culture's vocabulary. It wasn't just slang - it was philosophy. Terms like 'hack', 'kludge', and 'wizard' carried deep meaning about elegance, craftsmanship, and the joy of mastery."
},
{
id: 'loot_l0pht',
title: "L0pht Heavy Industries",
category: "ASM",
requiredLevel: 1,
content: "1992-2000: Seven hackers in a Boston loft changed security. They testified to Congress (1998) that they could take down the internet in 30 minutes. L0phtCrack, AntiSniff, and their research forced vendors to take security seriously. The underground became the vanguard."
},
{
id: 'loot_def_con',
title: "DEF CON Origins",
category: "NET",
requiredLevel: 1,
content: "June 1993: The Dark Tangent organized DEF CON 1 at the Sands Hotel, Las Vegas. 100 hackers. No rules. Total chaos. It became the world's largest hacker convention. What happens in Vegas... gets documented in conference proceedings."
},
{
id: 'loot_2600',
title: "2600: The Hacker Quarterly",
category: "NET",
requiredLevel: 1,
content: "1984: Emmanuel Goldstein founded 2600 Magazine. The name came from the phreaking tone. Every issue was a manifesto: information wants to be free, systems want to be understood, authority wants to be questioned. The meetings still happen, first Friday of every month."
}
];
// Memory Loot Map - Associates memory addresses with codex entry IDs
export const MEMORY_LOOT_MAP: Record<number, string> = {
0xFA: 'loot_phrack', // Address 250
0xFB: 'loot_cuckoo', // Address 251
0xFC: 'loot_morris', // Address 252
0xFD: 'loot_bluebox', // Address 253
0xFE: 'loot_jargon', // Address 254
0xF5: 'loot_l0pht', // Address 245
0xF6: 'loot_def_con', // Address 246
0xF7: 'loot_2600', // Address 247
};