erosolar-cli 2.1.270 → 2.1.272
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.
- package/dist/capabilities/index.d.ts +0 -1
- package/dist/capabilities/index.d.ts.map +1 -1
- package/dist/capabilities/index.js +1 -1
- package/dist/capabilities/index.js.map +1 -1
- package/dist/capabilities/orchestrationCapability.d.ts.map +1 -1
- package/dist/capabilities/orchestrationCapability.js +56 -108
- package/dist/capabilities/orchestrationCapability.js.map +1 -1
- package/dist/core/iMessageVerification.d.ts +1 -1
- package/dist/core/infrastructureTemplates.d.ts +1 -1
- package/dist/core/infrastructureTemplates.js +5 -5
- package/dist/core/infrastructureTemplates.js.map +1 -1
- package/dist/core/persistentObjectiveStore.d.ts +13 -1
- package/dist/core/persistentObjectiveStore.d.ts.map +1 -1
- package/dist/core/persistentObjectiveStore.js.map +1 -1
- package/dist/core/securityDeliverableGenerator.d.ts +1 -1
- package/dist/core/securityDeliverableGenerator.d.ts.map +1 -1
- package/dist/core/securityDeliverableGenerator.js +3 -3
- package/dist/core/securityDeliverableGenerator.js.map +1 -1
- package/dist/core/toolRuntime.d.ts.map +1 -1
- package/dist/core/toolRuntime.js +11 -5
- package/dist/core/toolRuntime.js.map +1 -1
- package/dist/core/types.js.map +1 -1
- package/dist/core/unifiedOrchestrator.d.ts +265 -77
- package/dist/core/unifiedOrchestrator.d.ts.map +1 -1
- package/dist/core/unifiedOrchestrator.js +911 -254
- package/dist/core/unifiedOrchestrator.js.map +1 -1
- package/dist/providers/anthropicProvider.d.ts +1 -1
- package/dist/shell/interactiveShell.d.ts +1 -1
- package/dist/shell/interactiveShell.d.ts.map +1 -1
- package/dist/shell/interactiveShell.js +188 -207
- package/dist/shell/interactiveShell.js.map +1 -1
- package/dist/tools/tao/rl.js +1 -1
- package/dist/tools/tao/rl.js.map +1 -1
- package/dist/tools/taoTools.js +5 -5
- package/dist/tools/taoTools.js.map +1 -1
- package/package.json +1 -1
- package/dist/capabilities/unifiedInvestigationCapability.d.ts +0 -22
- package/dist/capabilities/unifiedInvestigationCapability.d.ts.map +0 -1
- package/dist/capabilities/unifiedInvestigationCapability.js +0 -41
- package/dist/capabilities/unifiedInvestigationCapability.js.map +0 -1
- package/dist/core/agentOrchestrator.d.ts +0 -400
- package/dist/core/agentOrchestrator.d.ts.map +0 -1
- package/dist/core/agentOrchestrator.js +0 -2133
- package/dist/core/agentOrchestrator.js.map +0 -1
- package/dist/core/autoExecutionOrchestrator.d.ts +0 -172
- package/dist/core/autoExecutionOrchestrator.d.ts.map +0 -1
- package/dist/core/autoExecutionOrchestrator.js +0 -591
- package/dist/core/autoExecutionOrchestrator.js.map +0 -1
- package/dist/core/dualAgentOrchestrator.d.ts +0 -34
- package/dist/core/dualAgentOrchestrator.d.ts.map +0 -1
- package/dist/core/dualAgentOrchestrator.js +0 -94
- package/dist/core/dualAgentOrchestrator.js.map +0 -1
- package/dist/core/failureRecovery.d.ts +0 -26
- package/dist/core/failureRecovery.d.ts.map +0 -1
- package/dist/core/failureRecovery.js +0 -54
- package/dist/core/failureRecovery.js.map +0 -1
- package/dist/core/intelligentTestFlows.d.ts +0 -45
- package/dist/core/intelligentTestFlows.d.ts.map +0 -1
- package/dist/core/intelligentTestFlows.js +0 -25
- package/dist/core/intelligentTestFlows.js.map +0 -1
- package/dist/core/learningPersistence.d.ts +0 -58
- package/dist/core/learningPersistence.d.ts.map +0 -1
- package/dist/core/learningPersistence.js +0 -46
- package/dist/core/learningPersistence.js.map +0 -1
- package/dist/core/metricsTracker.d.ts +0 -40
- package/dist/core/metricsTracker.d.ts.map +0 -1
- package/dist/core/metricsTracker.js +0 -83
- package/dist/core/metricsTracker.js.map +0 -1
- package/dist/core/orchestration.d.ts +0 -534
- package/dist/core/orchestration.d.ts.map +0 -1
- package/dist/core/orchestration.js +0 -2009
- package/dist/core/orchestration.js.map +0 -1
- package/dist/core/performanceMonitor.d.ts +0 -30
- package/dist/core/performanceMonitor.d.ts.map +0 -1
- package/dist/core/performanceMonitor.js +0 -39
- package/dist/core/performanceMonitor.js.map +0 -1
- package/dist/core/selfEvolution.d.ts +0 -61
- package/dist/core/selfEvolution.d.ts.map +0 -1
- package/dist/core/selfEvolution.js +0 -38
- package/dist/core/selfEvolution.js.map +0 -1
- package/dist/core/selfImprovement.d.ts +0 -82
- package/dist/core/selfImprovement.d.ts.map +0 -1
- package/dist/core/selfImprovement.js +0 -25
- package/dist/core/selfImprovement.js.map +0 -1
- package/dist/core/unifiedFraudOrchestrator.d.ts +0 -738
- package/dist/core/unifiedFraudOrchestrator.d.ts.map +0 -1
- package/dist/core/unifiedFraudOrchestrator.js +0 -3312
- package/dist/core/unifiedFraudOrchestrator.js.map +0 -1
- package/dist/core/unifiedRealOrchestrator.d.ts +0 -126
- package/dist/core/unifiedRealOrchestrator.d.ts.map +0 -1
- package/dist/core/unifiedRealOrchestrator.js +0 -558
- package/dist/core/unifiedRealOrchestrator.js.map +0 -1
- package/dist/core/userDefenseOrchestrator.d.ts +0 -202
- package/dist/core/userDefenseOrchestrator.d.ts.map +0 -1
- package/dist/core/userDefenseOrchestrator.js +0 -1006
- package/dist/core/userDefenseOrchestrator.js.map +0 -1
- package/dist/plugins/tools/unifiedInvestigation/unifiedInvestigationPlugin.d.ts +0 -3
- package/dist/plugins/tools/unifiedInvestigation/unifiedInvestigationPlugin.d.ts.map +0 -1
- package/dist/plugins/tools/unifiedInvestigation/unifiedInvestigationPlugin.js +0 -14
- package/dist/plugins/tools/unifiedInvestigation/unifiedInvestigationPlugin.js.map +0 -1
- package/dist/tools/frontendTestingTools.d.ts +0 -9
- package/dist/tools/frontendTestingTools.d.ts.map +0 -1
- package/dist/tools/frontendTestingTools.js +0 -291
- package/dist/tools/frontendTestingTools.js.map +0 -1
- package/dist/tools/unifiedInvestigationTools.d.ts +0 -19
- package/dist/tools/unifiedInvestigationTools.d.ts.map +0 -1
- package/dist/tools/unifiedInvestigationTools.js +0 -1163
- package/dist/tools/unifiedInvestigationTools.js.map +0 -1
- package/scripts/human-verification.mjs +0 -380
- package/scripts/isolated-verification-runner.mjs +0 -364
- package/scripts/isolated-verification-wrapper.mjs +0 -276
- package/scripts/verify-task-completion.mjs +0 -143
|
@@ -1,1006 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* User Defense Orchestrator
|
|
3
|
-
*
|
|
4
|
-
* Unified system for user defense against corporate privacy violations.
|
|
5
|
-
* Integrates all ethical offensive and defensive capabilities.
|
|
6
|
-
*
|
|
7
|
-
* CAPABILITIES:
|
|
8
|
-
* 1. Counter-Surveillance - Monitor corporate monitoring of YOUR systems
|
|
9
|
-
* 2. Evidence Collection - Automated, cryptographically-secured evidence gathering
|
|
10
|
-
* 3. Evidence Permanence - Distributed, censorship-resistant storage
|
|
11
|
-
* 4. Transparency Auditing - Continuous verification of corporate claims
|
|
12
|
-
* 5. Regulatory Automation - Mass filing of complaints
|
|
13
|
-
* 6. Coalition Coordination - Multi-user synchronized action
|
|
14
|
-
* 7. Symmetric Response - Mirror corporate capabilities ethically
|
|
15
|
-
* 8. Economic Pressure - Legal cost imposition strategies
|
|
16
|
-
* 9. Narrative Operations - Truth-based counter-messaging
|
|
17
|
-
* 10. Temporal Persistence - Sustained indefinite pressure
|
|
18
|
-
*
|
|
19
|
-
* ETHICAL FRAMEWORK:
|
|
20
|
-
* - All operations on user-owned systems only
|
|
21
|
-
* - All external data from public sources only
|
|
22
|
-
* - All actions legal and documented
|
|
23
|
-
* - No unauthorized system access
|
|
24
|
-
* - No attacks on infrastructure
|
|
25
|
-
* - Truth and transparency as weapons
|
|
26
|
-
*/
|
|
27
|
-
import { execSync } from 'node:child_process';
|
|
28
|
-
import * as fs from 'node:fs';
|
|
29
|
-
import * as path from 'node:path';
|
|
30
|
-
import * as crypto from 'node:crypto';
|
|
31
|
-
import * as https from 'node:https';
|
|
32
|
-
import * as dns from 'node:dns';
|
|
33
|
-
import { promisify } from 'node:util';
|
|
34
|
-
import { EventEmitter } from 'node:events';
|
|
35
|
-
const dnsResolve4 = promisify(dns.resolve4);
|
|
36
|
-
// ═══════════════════════════════════════════════════════════════════════════════
|
|
37
|
-
// COUNTER-SURVEILLANCE SYSTEM
|
|
38
|
-
// ═══════════════════════════════════════════════════════════════════════════════
|
|
39
|
-
export class CounterSurveillanceSystem extends EventEmitter {
|
|
40
|
-
target;
|
|
41
|
-
logDir;
|
|
42
|
-
isRunning = false;
|
|
43
|
-
monitorInterval = null;
|
|
44
|
-
connections = new Map();
|
|
45
|
-
daemons = new Map();
|
|
46
|
-
// Target-specific IP ranges and services
|
|
47
|
-
targetSignatures = {
|
|
48
|
-
apple: {
|
|
49
|
-
ipPatterns: ['17.', '18.'],
|
|
50
|
-
daemons: ['identityservicesd', 'imagent', 'apsd', 'cloudd', 'assistantd', 'sharingd', 'IMDPersistenceAgent', 'nsurlsessiond', 'bird'],
|
|
51
|
-
services: {
|
|
52
|
-
'5223': 'APNs Push Notifications',
|
|
53
|
-
'443': 'HTTPS (iCloud/IDS/CloudKit)',
|
|
54
|
-
'80': 'HTTP (Updates)',
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
google: {
|
|
58
|
-
ipPatterns: ['142.', '172.217.', '216.58.', '74.125.'],
|
|
59
|
-
daemons: ['Google', 'Chrome', 'GoogleSoftwareUpdate'],
|
|
60
|
-
services: {
|
|
61
|
-
'443': 'Google Services',
|
|
62
|
-
'5228': 'GCM Push',
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
|
-
meta: {
|
|
66
|
-
ipPatterns: ['157.240.', '31.13.', '179.60.'],
|
|
67
|
-
daemons: ['Facebook', 'Messenger', 'WhatsApp', 'Instagram'],
|
|
68
|
-
services: {
|
|
69
|
-
'443': 'Meta Services',
|
|
70
|
-
'5222': 'XMPP',
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
microsoft: {
|
|
74
|
-
ipPatterns: ['13.', '20.', '40.', '52.', '104.'],
|
|
75
|
-
daemons: ['Microsoft', 'OneDrive', 'Teams', 'Outlook'],
|
|
76
|
-
services: {
|
|
77
|
-
'443': 'Microsoft Services',
|
|
78
|
-
},
|
|
79
|
-
},
|
|
80
|
-
amazon: {
|
|
81
|
-
ipPatterns: ['18.', '52.', '54.', '3.'],
|
|
82
|
-
daemons: ['Amazon', 'Alexa'],
|
|
83
|
-
services: {
|
|
84
|
-
'443': 'AWS Services',
|
|
85
|
-
},
|
|
86
|
-
},
|
|
87
|
-
};
|
|
88
|
-
constructor(target, logDir) {
|
|
89
|
-
super();
|
|
90
|
-
this.target = target;
|
|
91
|
-
this.logDir = logDir;
|
|
92
|
-
if (!fs.existsSync(logDir)) {
|
|
93
|
-
fs.mkdirSync(logDir, { recursive: true });
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
async start(intervalMs = 5000) {
|
|
97
|
-
if (this.isRunning)
|
|
98
|
-
return;
|
|
99
|
-
this.isRunning = true;
|
|
100
|
-
this.emit('started', { target: this.target, timestamp: new Date().toISOString() });
|
|
101
|
-
// Initial scan
|
|
102
|
-
await this.performScan();
|
|
103
|
-
// Continuous monitoring
|
|
104
|
-
this.monitorInterval = setInterval(async () => {
|
|
105
|
-
await this.performScan();
|
|
106
|
-
}, intervalMs);
|
|
107
|
-
}
|
|
108
|
-
stop() {
|
|
109
|
-
if (this.monitorInterval) {
|
|
110
|
-
clearInterval(this.monitorInterval);
|
|
111
|
-
this.monitorInterval = null;
|
|
112
|
-
}
|
|
113
|
-
this.isRunning = false;
|
|
114
|
-
this.emit('stopped', { target: this.target, timestamp: new Date().toISOString() });
|
|
115
|
-
}
|
|
116
|
-
async performScan() {
|
|
117
|
-
const timestamp = new Date().toISOString();
|
|
118
|
-
try {
|
|
119
|
-
// Scan network connections
|
|
120
|
-
const connections = await this.scanConnections();
|
|
121
|
-
this.processConnections(connections, timestamp);
|
|
122
|
-
// Scan daemon activity
|
|
123
|
-
const daemons = await this.scanDaemons();
|
|
124
|
-
this.processDaemons(daemons, timestamp);
|
|
125
|
-
this.emit('scan_complete', {
|
|
126
|
-
timestamp,
|
|
127
|
-
connections: connections.length,
|
|
128
|
-
daemons: daemons.length,
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
catch (error) {
|
|
132
|
-
this.emit('scan_error', { timestamp, error });
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
async scanConnections() {
|
|
136
|
-
const connections = [];
|
|
137
|
-
const signatures = this.targetSignatures[this.target];
|
|
138
|
-
try {
|
|
139
|
-
const netstat = this.exec('netstat -anv 2>/dev/null | grep ESTABLISHED');
|
|
140
|
-
const lines = netstat.split('\n').filter(l => l.trim());
|
|
141
|
-
for (const line of lines) {
|
|
142
|
-
for (const pattern of signatures.ipPatterns) {
|
|
143
|
-
if (line.includes(pattern)) {
|
|
144
|
-
const conn = this.parseNetstatLine(line, signatures);
|
|
145
|
-
if (conn) {
|
|
146
|
-
connections.push(conn);
|
|
147
|
-
}
|
|
148
|
-
break;
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
catch { }
|
|
154
|
-
return connections;
|
|
155
|
-
}
|
|
156
|
-
parseNetstatLine(line, signatures) {
|
|
157
|
-
const parts = line.trim().split(/\s+/);
|
|
158
|
-
if (parts.length < 9)
|
|
159
|
-
return null;
|
|
160
|
-
try {
|
|
161
|
-
const localAddr = parts[3] ?? '';
|
|
162
|
-
const remoteAddr = parts[4] ?? '';
|
|
163
|
-
const state = parts[5] ?? 'UNKNOWN';
|
|
164
|
-
const localMatch = localAddr.match(/^(.+)\.(\d+)$/);
|
|
165
|
-
const remoteMatch = remoteAddr.match(/^(.+)\.(\d+)$/);
|
|
166
|
-
if (!localMatch || !remoteMatch)
|
|
167
|
-
return null;
|
|
168
|
-
const remotePort = remoteMatch[2] ?? '0';
|
|
169
|
-
return {
|
|
170
|
-
timestamp: new Date().toISOString(),
|
|
171
|
-
localIP: localMatch[1] ?? '',
|
|
172
|
-
localPort: parseInt(localMatch[2] ?? '0', 10),
|
|
173
|
-
remoteIP: remoteMatch[1] ?? '',
|
|
174
|
-
remotePort: parseInt(remotePort, 10),
|
|
175
|
-
process: 'unknown',
|
|
176
|
-
pid: 0,
|
|
177
|
-
state,
|
|
178
|
-
bytesIn: 0,
|
|
179
|
-
bytesOut: 0,
|
|
180
|
-
service: signatures.services[remotePort] || 'Unknown Service',
|
|
181
|
-
riskLevel: this.assessConnectionRisk(parseInt(remotePort, 10)),
|
|
182
|
-
};
|
|
183
|
-
}
|
|
184
|
-
catch {
|
|
185
|
-
return null;
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
assessConnectionRisk(port) {
|
|
189
|
-
if (port === 5223)
|
|
190
|
-
return 'high'; // APNs - persistent surveillance channel
|
|
191
|
-
if (port === 443)
|
|
192
|
-
return 'medium'; // HTTPS - data exfiltration possible
|
|
193
|
-
return 'low';
|
|
194
|
-
}
|
|
195
|
-
async scanDaemons() {
|
|
196
|
-
const daemons = [];
|
|
197
|
-
const signatures = this.targetSignatures[this.target];
|
|
198
|
-
for (const daemonName of signatures.daemons) {
|
|
199
|
-
try {
|
|
200
|
-
const ps = this.exec(`ps aux | grep -i "${daemonName}" | grep -v grep | head -1`);
|
|
201
|
-
if (ps.trim()) {
|
|
202
|
-
const parts = ps.trim().split(/\s+/);
|
|
203
|
-
if (parts.length >= 11) {
|
|
204
|
-
daemons.push({
|
|
205
|
-
timestamp: new Date().toISOString(),
|
|
206
|
-
daemon: daemonName,
|
|
207
|
-
pid: parseInt(parts[1] ?? '0', 10),
|
|
208
|
-
cpu: parseFloat(parts[2] ?? '0'),
|
|
209
|
-
memory: parseFloat(parts[3] ?? '0'),
|
|
210
|
-
threads: 0,
|
|
211
|
-
openFiles: 0,
|
|
212
|
-
networkConnections: 0,
|
|
213
|
-
state: parts[7] ?? 'unknown',
|
|
214
|
-
});
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
catch { }
|
|
219
|
-
}
|
|
220
|
-
return daemons;
|
|
221
|
-
}
|
|
222
|
-
processConnections(connections, timestamp) {
|
|
223
|
-
for (const conn of connections) {
|
|
224
|
-
const key = `${conn.remoteIP}:${conn.remotePort}`;
|
|
225
|
-
if (!this.connections.has(key)) {
|
|
226
|
-
// New connection detected
|
|
227
|
-
this.emit('new_connection', conn);
|
|
228
|
-
this.logEvent('connection', conn);
|
|
229
|
-
}
|
|
230
|
-
this.connections.set(key, conn);
|
|
231
|
-
}
|
|
232
|
-
// Check for closed connections
|
|
233
|
-
const currentKeys = new Set(connections.map(c => `${c.remoteIP}:${c.remotePort}`));
|
|
234
|
-
for (const [key, conn] of this.connections) {
|
|
235
|
-
if (!currentKeys.has(key)) {
|
|
236
|
-
this.emit('closed_connection', conn);
|
|
237
|
-
this.connections.delete(key);
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
processDaemons(daemons, timestamp) {
|
|
242
|
-
for (const daemon of daemons) {
|
|
243
|
-
const prev = this.daemons.get(daemon.daemon);
|
|
244
|
-
if (prev) {
|
|
245
|
-
// Check for anomalies
|
|
246
|
-
if (daemon.cpu > prev.cpu * 3 && daemon.cpu > 5) {
|
|
247
|
-
this.emit('daemon_anomaly', {
|
|
248
|
-
daemon: daemon.daemon,
|
|
249
|
-
type: 'cpu_spike',
|
|
250
|
-
previous: prev.cpu,
|
|
251
|
-
current: daemon.cpu,
|
|
252
|
-
});
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
this.daemons.set(daemon.daemon, daemon);
|
|
256
|
-
}
|
|
257
|
-
this.logEvent('daemons', { timestamp, daemons });
|
|
258
|
-
}
|
|
259
|
-
logEvent(type, data) {
|
|
260
|
-
const logFile = path.join(this.logDir, `${type}-${new Date().toISOString().split('T')[0]}.jsonl`);
|
|
261
|
-
const entry = JSON.stringify({ timestamp: new Date().toISOString(), type, data }) + '\n';
|
|
262
|
-
fs.appendFileSync(logFile, entry);
|
|
263
|
-
}
|
|
264
|
-
getActiveConnections() {
|
|
265
|
-
return Array.from(this.connections.values());
|
|
266
|
-
}
|
|
267
|
-
getActiveDaemons() {
|
|
268
|
-
return Array.from(this.daemons.values());
|
|
269
|
-
}
|
|
270
|
-
exec(cmd) {
|
|
271
|
-
try {
|
|
272
|
-
return execSync(cmd, { encoding: 'utf-8', maxBuffer: 10 * 1024 * 1024 });
|
|
273
|
-
}
|
|
274
|
-
catch (e) {
|
|
275
|
-
const error = e;
|
|
276
|
-
return error.stdout || '';
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
// ═══════════════════════════════════════════════════════════════════════════════
|
|
281
|
-
// TRANSPARENCY AUDITOR
|
|
282
|
-
// ═══════════════════════════════════════════════════════════════════════════════
|
|
283
|
-
export class TransparencyAuditor extends EventEmitter {
|
|
284
|
-
target;
|
|
285
|
-
evidenceDir;
|
|
286
|
-
tests = [];
|
|
287
|
-
// Claims to verify per target
|
|
288
|
-
targetClaims = {
|
|
289
|
-
apple: [
|
|
290
|
-
{
|
|
291
|
-
claim: 'Key Transparency provides public audit capability',
|
|
292
|
-
testFn: async () => this.testDNSResolution('kt.ess.apple.com', 'Key Transparency should be publicly accessible'),
|
|
293
|
-
},
|
|
294
|
-
{
|
|
295
|
-
claim: 'Identity Services are verifiable',
|
|
296
|
-
testFn: async () => this.testHTTPEndpoint('https://identity.ess.apple.com/', 'IDS should allow public key verification'),
|
|
297
|
-
},
|
|
298
|
-
{
|
|
299
|
-
claim: 'Users can verify their encryption keys',
|
|
300
|
-
testFn: async () => this.testKeyVerification(),
|
|
301
|
-
},
|
|
302
|
-
],
|
|
303
|
-
google: [
|
|
304
|
-
{
|
|
305
|
-
claim: 'Gmail end-to-end encryption is verifiable',
|
|
306
|
-
testFn: async () => this.testHTTPEndpoint('https://mail.google.com/', 'E2E verification endpoint'),
|
|
307
|
-
},
|
|
308
|
-
],
|
|
309
|
-
meta: [
|
|
310
|
-
{
|
|
311
|
-
claim: 'WhatsApp key verification is public',
|
|
312
|
-
testFn: async () => this.testDNSResolution('key-transparency.whatsapp.com', 'Key transparency'),
|
|
313
|
-
},
|
|
314
|
-
],
|
|
315
|
-
microsoft: [],
|
|
316
|
-
amazon: [],
|
|
317
|
-
};
|
|
318
|
-
constructor(target, evidenceDir) {
|
|
319
|
-
super();
|
|
320
|
-
this.target = target;
|
|
321
|
-
this.evidenceDir = evidenceDir;
|
|
322
|
-
}
|
|
323
|
-
async runAllTests() {
|
|
324
|
-
this.tests = [];
|
|
325
|
-
const claims = this.targetClaims[this.target] || [];
|
|
326
|
-
for (const { claim, testFn } of claims) {
|
|
327
|
-
try {
|
|
328
|
-
const test = await testFn();
|
|
329
|
-
this.tests.push(test);
|
|
330
|
-
this.emit('test_complete', test);
|
|
331
|
-
}
|
|
332
|
-
catch (error) {
|
|
333
|
-
this.emit('test_error', { claim, error });
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
this.saveResults();
|
|
337
|
-
return this.tests;
|
|
338
|
-
}
|
|
339
|
-
async testDNSResolution(hostname, description) {
|
|
340
|
-
const id = crypto.randomUUID();
|
|
341
|
-
const timestamp = new Date().toISOString();
|
|
342
|
-
try {
|
|
343
|
-
const ips = await dnsResolve4(hostname);
|
|
344
|
-
return {
|
|
345
|
-
id,
|
|
346
|
-
timestamp,
|
|
347
|
-
claim: description,
|
|
348
|
-
testMethod: `DNS resolution of ${hostname}`,
|
|
349
|
-
result: 'verified',
|
|
350
|
-
evidence: `Resolves to: ${ips.join(', ')}`,
|
|
351
|
-
hash: this.hashTest(id, timestamp, 'verified'),
|
|
352
|
-
};
|
|
353
|
-
}
|
|
354
|
-
catch {
|
|
355
|
-
return {
|
|
356
|
-
id,
|
|
357
|
-
timestamp,
|
|
358
|
-
claim: description,
|
|
359
|
-
testMethod: `DNS resolution of ${hostname}`,
|
|
360
|
-
result: 'falsified',
|
|
361
|
-
evidence: `DNS resolution FAILED - ${hostname} does not resolve publicly`,
|
|
362
|
-
hash: this.hashTest(id, timestamp, 'falsified'),
|
|
363
|
-
};
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
async testHTTPEndpoint(url, description) {
|
|
367
|
-
const id = crypto.randomUUID();
|
|
368
|
-
const timestamp = new Date().toISOString();
|
|
369
|
-
return new Promise((resolve) => {
|
|
370
|
-
try {
|
|
371
|
-
const urlObj = new URL(url);
|
|
372
|
-
const req = https.request({
|
|
373
|
-
hostname: urlObj.hostname,
|
|
374
|
-
path: urlObj.pathname || '/',
|
|
375
|
-
method: 'GET',
|
|
376
|
-
timeout: 10000,
|
|
377
|
-
}, (res) => {
|
|
378
|
-
const result = res.statusCode === 200 ? 'verified' : 'falsified';
|
|
379
|
-
resolve({
|
|
380
|
-
id,
|
|
381
|
-
timestamp,
|
|
382
|
-
claim: description,
|
|
383
|
-
testMethod: `HTTP request to ${url}`,
|
|
384
|
-
result,
|
|
385
|
-
evidence: `HTTP ${res.statusCode} - ${result === 'verified' ? 'Public access confirmed' : 'Public access denied'}`,
|
|
386
|
-
hash: this.hashTest(id, timestamp, result),
|
|
387
|
-
});
|
|
388
|
-
});
|
|
389
|
-
req.on('error', () => {
|
|
390
|
-
resolve({
|
|
391
|
-
id,
|
|
392
|
-
timestamp,
|
|
393
|
-
claim: description,
|
|
394
|
-
testMethod: `HTTP request to ${url}`,
|
|
395
|
-
result: 'falsified',
|
|
396
|
-
evidence: 'Connection failed - endpoint not publicly accessible',
|
|
397
|
-
hash: this.hashTest(id, timestamp, 'falsified'),
|
|
398
|
-
});
|
|
399
|
-
});
|
|
400
|
-
req.on('timeout', () => {
|
|
401
|
-
req.destroy();
|
|
402
|
-
resolve({
|
|
403
|
-
id,
|
|
404
|
-
timestamp,
|
|
405
|
-
claim: description,
|
|
406
|
-
testMethod: `HTTP request to ${url}`,
|
|
407
|
-
result: 'falsified',
|
|
408
|
-
evidence: 'Connection timeout - endpoint not responding',
|
|
409
|
-
hash: this.hashTest(id, timestamp, 'falsified'),
|
|
410
|
-
});
|
|
411
|
-
});
|
|
412
|
-
req.end();
|
|
413
|
-
}
|
|
414
|
-
catch {
|
|
415
|
-
resolve({
|
|
416
|
-
id,
|
|
417
|
-
timestamp,
|
|
418
|
-
claim: description,
|
|
419
|
-
testMethod: `HTTP request to ${url}`,
|
|
420
|
-
result: 'falsified',
|
|
421
|
-
evidence: 'Request failed',
|
|
422
|
-
hash: this.hashTest(id, timestamp, 'falsified'),
|
|
423
|
-
});
|
|
424
|
-
}
|
|
425
|
-
});
|
|
426
|
-
}
|
|
427
|
-
async testKeyVerification() {
|
|
428
|
-
const id = crypto.randomUUID();
|
|
429
|
-
const timestamp = new Date().toISOString();
|
|
430
|
-
// Check if user has any way to verify keys
|
|
431
|
-
const entitlements = this.exec('codesign -d --entitlements :- /System/Library/PrivateFrameworks/IDS.framework/identityservicesd.app 2>/dev/null');
|
|
432
|
-
const hasKTEntitlement = entitlements.includes('com.apple.transparency.kt');
|
|
433
|
-
return {
|
|
434
|
-
id,
|
|
435
|
-
timestamp,
|
|
436
|
-
claim: 'Users can independently verify their encryption keys',
|
|
437
|
-
testMethod: 'Check for public key verification API and user-accessible tools',
|
|
438
|
-
result: 'falsified',
|
|
439
|
-
evidence: hasKTEntitlement
|
|
440
|
-
? 'Only Apple system daemons have Key Transparency access (com.apple.transparency.kt). No public API exists for users.'
|
|
441
|
-
: 'No Key Transparency entitlement found. System does not support user verification.',
|
|
442
|
-
hash: this.hashTest(id, timestamp, 'falsified'),
|
|
443
|
-
};
|
|
444
|
-
}
|
|
445
|
-
hashTest(id, timestamp, result) {
|
|
446
|
-
return crypto.createHash('sha256').update(`${id}:${timestamp}:${result}`).digest('hex');
|
|
447
|
-
}
|
|
448
|
-
saveResults() {
|
|
449
|
-
const reportPath = path.join(this.evidenceDir, `transparency-audit-${this.target}.json`);
|
|
450
|
-
fs.writeFileSync(reportPath, JSON.stringify({
|
|
451
|
-
target: this.target,
|
|
452
|
-
timestamp: new Date().toISOString(),
|
|
453
|
-
tests: this.tests,
|
|
454
|
-
summary: {
|
|
455
|
-
total: this.tests.length,
|
|
456
|
-
verified: this.tests.filter(t => t.result === 'verified').length,
|
|
457
|
-
falsified: this.tests.filter(t => t.result === 'falsified').length,
|
|
458
|
-
inconclusive: this.tests.filter(t => t.result === 'inconclusive').length,
|
|
459
|
-
},
|
|
460
|
-
}, null, 2));
|
|
461
|
-
}
|
|
462
|
-
exec(cmd) {
|
|
463
|
-
try {
|
|
464
|
-
return execSync(cmd, { encoding: 'utf-8', maxBuffer: 10 * 1024 * 1024 });
|
|
465
|
-
}
|
|
466
|
-
catch (e) {
|
|
467
|
-
const error = e;
|
|
468
|
-
return error.stdout || '';
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
}
|
|
472
|
-
// ═══════════════════════════════════════════════════════════════════════════════
|
|
473
|
-
// EVIDENCE PERMANENCE SYSTEM
|
|
474
|
-
// ═══════════════════════════════════════════════════════════════════════════════
|
|
475
|
-
export class EvidencePermanenceSystem {
|
|
476
|
-
evidenceDir;
|
|
477
|
-
hashes = new Map();
|
|
478
|
-
constructor(evidenceDir) {
|
|
479
|
-
this.evidenceDir = evidenceDir;
|
|
480
|
-
}
|
|
481
|
-
async hashAllEvidence() {
|
|
482
|
-
const files = fs.readdirSync(this.evidenceDir).filter(f => f.endsWith('.txt') || f.endsWith('.json'));
|
|
483
|
-
for (const file of files) {
|
|
484
|
-
const filePath = path.join(this.evidenceDir, file);
|
|
485
|
-
const content = fs.readFileSync(filePath);
|
|
486
|
-
const hash = crypto.createHash('sha256').update(content).digest('hex');
|
|
487
|
-
this.hashes.set(file, hash);
|
|
488
|
-
}
|
|
489
|
-
return this.hashes;
|
|
490
|
-
}
|
|
491
|
-
generateMasterHash() {
|
|
492
|
-
const sortedHashes = Array.from(this.hashes.entries())
|
|
493
|
-
.sort(([a], [b]) => a.localeCompare(b))
|
|
494
|
-
.map(([file, hash]) => `${hash} ${file}`)
|
|
495
|
-
.join('\n');
|
|
496
|
-
return crypto.createHash('sha256').update(sortedHashes).digest('hex');
|
|
497
|
-
}
|
|
498
|
-
generateBlockchainCommitScript() {
|
|
499
|
-
const masterHash = this.generateMasterHash();
|
|
500
|
-
return `#!/bin/bash
|
|
501
|
-
# Blockchain Evidence Commitment Script
|
|
502
|
-
# Commits evidence hash to Bitcoin using OP_RETURN
|
|
503
|
-
|
|
504
|
-
MASTER_HASH="${masterHash}"
|
|
505
|
-
TIMESTAMP="${new Date().toISOString()}"
|
|
506
|
-
|
|
507
|
-
echo "Evidence Master Hash: $MASTER_HASH"
|
|
508
|
-
echo "Timestamp: $TIMESTAMP"
|
|
509
|
-
|
|
510
|
-
# Option 1: OpenTimestamps (recommended - free)
|
|
511
|
-
# Install: pip install opentimestamps-client
|
|
512
|
-
# ots stamp evidence-hashes.txt
|
|
513
|
-
|
|
514
|
-
# Option 2: OriginStamp API
|
|
515
|
-
# curl -X POST "https://api.originstamp.com/v4/timestamp/create" \\
|
|
516
|
-
# -H "Authorization: YOUR_API_KEY" \\
|
|
517
|
-
# -H "Content-Type: application/json" \\
|
|
518
|
-
# -d '{"hash": "'$MASTER_HASH'"}'
|
|
519
|
-
|
|
520
|
-
# Option 3: Manual Bitcoin OP_RETURN (requires bitcoin-cli)
|
|
521
|
-
# bitcoin-cli createrawtransaction '[]' '{"data":"'$MASTER_HASH'"}'
|
|
522
|
-
|
|
523
|
-
echo "Use one of the above methods to commit hash to blockchain"
|
|
524
|
-
`;
|
|
525
|
-
}
|
|
526
|
-
generateIPFSPublishScript() {
|
|
527
|
-
return `#!/bin/bash
|
|
528
|
-
# IPFS Evidence Publication Script
|
|
529
|
-
# Publishes evidence to IPFS for permanent, distributed storage
|
|
530
|
-
|
|
531
|
-
EVIDENCE_DIR="${this.evidenceDir}"
|
|
532
|
-
|
|
533
|
-
# Check if IPFS is installed
|
|
534
|
-
if ! command -v ipfs &> /dev/null; then
|
|
535
|
-
echo "IPFS not installed. Install with: brew install ipfs"
|
|
536
|
-
exit 1
|
|
537
|
-
fi
|
|
538
|
-
|
|
539
|
-
# Initialize IPFS if needed
|
|
540
|
-
ipfs init 2>/dev/null || true
|
|
541
|
-
|
|
542
|
-
# Start IPFS daemon in background
|
|
543
|
-
ipfs daemon &
|
|
544
|
-
sleep 5
|
|
545
|
-
|
|
546
|
-
# Add evidence directory to IPFS
|
|
547
|
-
CID=$(ipfs add -r -Q "$EVIDENCE_DIR")
|
|
548
|
-
|
|
549
|
-
echo "Evidence published to IPFS"
|
|
550
|
-
echo "CID: $CID"
|
|
551
|
-
echo "Access via: https://ipfs.io/ipfs/$CID"
|
|
552
|
-
echo "Pin on Pinata: https://pinata.cloud"
|
|
553
|
-
echo "Pin on Infura: https://infura.io/product/ipfs"
|
|
554
|
-
|
|
555
|
-
# Save CID for reference
|
|
556
|
-
echo "$CID" > "$EVIDENCE_DIR/ipfs-cid.txt"
|
|
557
|
-
`;
|
|
558
|
-
}
|
|
559
|
-
async saveHashChain() {
|
|
560
|
-
await this.hashAllEvidence();
|
|
561
|
-
const masterHash = this.generateMasterHash();
|
|
562
|
-
const hashChainPath = path.join(this.evidenceDir, 'evidence-hash-chain.txt');
|
|
563
|
-
const content = `Evidence Hash Chain
|
|
564
|
-
Generated: ${new Date().toISOString()}
|
|
565
|
-
Master Hash: ${masterHash}
|
|
566
|
-
|
|
567
|
-
Individual File Hashes:
|
|
568
|
-
${Array.from(this.hashes.entries()).map(([f, h]) => `${h} ${f}`).join('\n')}
|
|
569
|
-
|
|
570
|
-
Verification Command:
|
|
571
|
-
shasum -a 256 -c evidence-hash-chain.txt
|
|
572
|
-
`;
|
|
573
|
-
fs.writeFileSync(hashChainPath, content);
|
|
574
|
-
// Save scripts
|
|
575
|
-
fs.writeFileSync(path.join(this.evidenceDir, 'commit-to-blockchain.sh'), this.generateBlockchainCommitScript());
|
|
576
|
-
fs.writeFileSync(path.join(this.evidenceDir, 'publish-to-ipfs.sh'), this.generateIPFSPublishScript());
|
|
577
|
-
return masterHash;
|
|
578
|
-
}
|
|
579
|
-
}
|
|
580
|
-
// ═══════════════════════════════════════════════════════════════════════════════
|
|
581
|
-
// REGULATORY FILING GENERATOR
|
|
582
|
-
// ═══════════════════════════════════════════════════════════════════════════════
|
|
583
|
-
export class RegulatoryFilingGenerator {
|
|
584
|
-
target;
|
|
585
|
-
evidenceDir;
|
|
586
|
-
filings = [];
|
|
587
|
-
agencies = [
|
|
588
|
-
{
|
|
589
|
-
id: 'ftc',
|
|
590
|
-
name: 'Federal Trade Commission',
|
|
591
|
-
jurisdiction: 'US Federal',
|
|
592
|
-
type: 'Consumer Protection',
|
|
593
|
-
url: 'https://ftc.gov/complaint',
|
|
594
|
-
templateFn: (hash) => this.generateFTCComplaint(hash),
|
|
595
|
-
},
|
|
596
|
-
{
|
|
597
|
-
id: 'ca_ag',
|
|
598
|
-
name: 'California Attorney General',
|
|
599
|
-
jurisdiction: 'California',
|
|
600
|
-
type: 'Consumer Protection',
|
|
601
|
-
url: 'https://oag.ca.gov/contact/consumer-complaint-against-business-or-company',
|
|
602
|
-
templateFn: (hash) => this.generateStateAGComplaint('California', hash),
|
|
603
|
-
},
|
|
604
|
-
{
|
|
605
|
-
id: 'ireland_dpc',
|
|
606
|
-
name: 'Ireland Data Protection Commission',
|
|
607
|
-
jurisdiction: 'EU (Ireland)',
|
|
608
|
-
type: 'GDPR',
|
|
609
|
-
url: 'https://dataprotection.ie/en/individuals/raising-concern',
|
|
610
|
-
templateFn: (hash) => this.generateGDPRComplaint('Ireland', hash),
|
|
611
|
-
},
|
|
612
|
-
];
|
|
613
|
-
constructor(target, evidenceDir) {
|
|
614
|
-
this.target = target;
|
|
615
|
-
this.evidenceDir = evidenceDir;
|
|
616
|
-
}
|
|
617
|
-
async generateAllFilings(evidenceHash) {
|
|
618
|
-
this.filings = [];
|
|
619
|
-
for (const agency of this.agencies) {
|
|
620
|
-
const content = agency.templateFn(evidenceHash);
|
|
621
|
-
const filing = {
|
|
622
|
-
id: crypto.randomUUID(),
|
|
623
|
-
agency: agency.name,
|
|
624
|
-
jurisdiction: agency.jurisdiction,
|
|
625
|
-
type: agency.type,
|
|
626
|
-
status: 'ready',
|
|
627
|
-
content,
|
|
628
|
-
evidenceHashes: [evidenceHash],
|
|
629
|
-
hash: crypto.createHash('sha256').update(content).digest('hex'),
|
|
630
|
-
};
|
|
631
|
-
this.filings.push(filing);
|
|
632
|
-
// Save filing
|
|
633
|
-
const filename = `regulatory-filing-${agency.id}.txt`;
|
|
634
|
-
fs.writeFileSync(path.join(this.evidenceDir, filename), content);
|
|
635
|
-
}
|
|
636
|
-
return this.filings;
|
|
637
|
-
}
|
|
638
|
-
generateFTCComplaint(evidenceHash) {
|
|
639
|
-
return `FEDERAL TRADE COMMISSION COMPLAINT
|
|
640
|
-
|
|
641
|
-
Date: ${new Date().toISOString().split('T')[0]}
|
|
642
|
-
Evidence Hash: ${evidenceHash}
|
|
643
|
-
|
|
644
|
-
RESPONDENT:
|
|
645
|
-
${this.getTargetInfo()}
|
|
646
|
-
|
|
647
|
-
NATURE OF COMPLAINT:
|
|
648
|
-
Deceptive Trade Practices - False Privacy and Encryption Claims
|
|
649
|
-
|
|
650
|
-
FACTUAL ALLEGATIONS:
|
|
651
|
-
|
|
652
|
-
1. Respondent markets its messaging service as providing "end-to-end encryption"
|
|
653
|
-
that prevents anyone, including the company, from accessing message content.
|
|
654
|
-
|
|
655
|
-
2. Technical investigation reveals:
|
|
656
|
-
a) Key distribution is controlled by Respondent's servers
|
|
657
|
-
b) Key Transparency system has no public audit mechanism
|
|
658
|
-
c) System processes have entitlements to access message content
|
|
659
|
-
d) Users cannot independently verify encryption keys
|
|
660
|
-
|
|
661
|
-
3. These facts contradict Respondent's marketing claims.
|
|
662
|
-
|
|
663
|
-
EVIDENCE:
|
|
664
|
-
See attached technical audit package (Hash: ${evidenceHash})
|
|
665
|
-
|
|
666
|
-
APPLICABLE LAW:
|
|
667
|
-
- FTC Act Section 5 (15 U.S.C. § 45) - Unfair or Deceptive Practices
|
|
668
|
-
- FTC Privacy Framework
|
|
669
|
-
|
|
670
|
-
REQUESTED ACTION:
|
|
671
|
-
1. Investigation of Respondent's encryption marketing claims
|
|
672
|
-
2. Enforcement action for deceptive practices
|
|
673
|
-
3. Requirement for accurate disclosure
|
|
674
|
-
|
|
675
|
-
CONSUMER HARM:
|
|
676
|
-
Consumers rely on privacy claims when choosing communication platforms.
|
|
677
|
-
False encryption claims cause consumers to share sensitive information
|
|
678
|
-
under false pretenses of security.
|
|
679
|
-
|
|
680
|
-
[ATTACH EVIDENCE PACKAGE]
|
|
681
|
-
`;
|
|
682
|
-
}
|
|
683
|
-
generateStateAGComplaint(state, evidenceHash) {
|
|
684
|
-
return `${state.toUpperCase()} ATTORNEY GENERAL - CONSUMER COMPLAINT
|
|
685
|
-
|
|
686
|
-
Date: ${new Date().toISOString().split('T')[0]}
|
|
687
|
-
Evidence Hash: ${evidenceHash}
|
|
688
|
-
|
|
689
|
-
COMPANY:
|
|
690
|
-
${this.getTargetInfo()}
|
|
691
|
-
|
|
692
|
-
COMPLAINT TYPE: Deceptive Business Practices / False Advertising
|
|
693
|
-
|
|
694
|
-
DESCRIPTION:
|
|
695
|
-
The company markets its services as providing "end-to-end encryption"
|
|
696
|
-
that prevents anyone from accessing user communications. Technical
|
|
697
|
-
investigation reveals this claim is materially false or misleading:
|
|
698
|
-
|
|
699
|
-
- Company controls encryption key distribution
|
|
700
|
-
- No public audit mechanism for key transparency
|
|
701
|
-
- System processes have documented access to content
|
|
702
|
-
- Users cannot verify encryption independently
|
|
703
|
-
|
|
704
|
-
APPLICABLE LAW:
|
|
705
|
-
- ${state} Consumer Protection Act
|
|
706
|
-
- ${state} False Advertising Law
|
|
707
|
-
- ${state} Unfair Competition Law
|
|
708
|
-
|
|
709
|
-
RELIEF REQUESTED:
|
|
710
|
-
- Investigation
|
|
711
|
-
- Civil penalties
|
|
712
|
-
- Injunctive relief requiring accurate disclosure
|
|
713
|
-
- Consumer restitution
|
|
714
|
-
|
|
715
|
-
EVIDENCE:
|
|
716
|
-
Technical audit package attached (Hash: ${evidenceHash})
|
|
717
|
-
`;
|
|
718
|
-
}
|
|
719
|
-
generateGDPRComplaint(country, evidenceHash) {
|
|
720
|
-
return `GDPR COMPLAINT - ${country.toUpperCase()} DATA PROTECTION AUTHORITY
|
|
721
|
-
|
|
722
|
-
Date: ${new Date().toISOString().split('T')[0]}
|
|
723
|
-
Evidence Hash: ${evidenceHash}
|
|
724
|
-
|
|
725
|
-
DATA CONTROLLER:
|
|
726
|
-
${this.getTargetInfo()}
|
|
727
|
-
|
|
728
|
-
COMPLAINT UNDER GDPR ARTICLE 77
|
|
729
|
-
|
|
730
|
-
ALLEGED VIOLATIONS:
|
|
731
|
-
|
|
732
|
-
1. Article 5(1)(a) - Lawfulness, Fairness, Transparency
|
|
733
|
-
Company represents "end-to-end encryption" while controlling
|
|
734
|
-
key distribution and lacking public audit mechanisms.
|
|
735
|
-
|
|
736
|
-
2. Article 13 - Information to be Provided
|
|
737
|
-
Failure to adequately inform users about actual encryption
|
|
738
|
-
architecture and company access capabilities.
|
|
739
|
-
|
|
740
|
-
3. Article 25 - Data Protection by Design
|
|
741
|
-
System architecture does not implement true end-to-end encryption
|
|
742
|
-
as marketed to users.
|
|
743
|
-
|
|
744
|
-
EVIDENCE:
|
|
745
|
-
Technical audit documenting encryption architecture.
|
|
746
|
-
Evidence Hash: ${evidenceHash}
|
|
747
|
-
|
|
748
|
-
REQUESTED ACTION:
|
|
749
|
-
- Investigation of data processing practices
|
|
750
|
-
- Order for accurate disclosure
|
|
751
|
-
- Administrative fine per GDPR Article 83
|
|
752
|
-
|
|
753
|
-
Maximum potential fine: 4% of global annual turnover
|
|
754
|
-
`;
|
|
755
|
-
}
|
|
756
|
-
getTargetInfo() {
|
|
757
|
-
const targetInfo = {
|
|
758
|
-
apple: 'Apple Inc.\nOne Apple Park Way\nCupertino, CA 95014',
|
|
759
|
-
google: 'Google LLC\n1600 Amphitheatre Parkway\nMountain View, CA 94043',
|
|
760
|
-
meta: 'Meta Platforms, Inc.\n1 Hacker Way\nMenlo Park, CA 94025',
|
|
761
|
-
microsoft: 'Microsoft Corporation\nOne Microsoft Way\nRedmond, WA 98052',
|
|
762
|
-
amazon: 'Amazon.com, Inc.\n410 Terry Avenue North\nSeattle, WA 98109',
|
|
763
|
-
};
|
|
764
|
-
return targetInfo[this.target];
|
|
765
|
-
}
|
|
766
|
-
}
|
|
767
|
-
// ═══════════════════════════════════════════════════════════════════════════════
|
|
768
|
-
// UNIFIED USER DEFENSE ORCHESTRATOR
|
|
769
|
-
// ═══════════════════════════════════════════════════════════════════════════════
|
|
770
|
-
export class UserDefenseOrchestrator extends EventEmitter {
|
|
771
|
-
session;
|
|
772
|
-
counterSurveillance = null;
|
|
773
|
-
transparencyAuditor = null;
|
|
774
|
-
evidencePermanence = null;
|
|
775
|
-
regulatoryGenerator = null;
|
|
776
|
-
constructor(target, evidenceDir) {
|
|
777
|
-
super();
|
|
778
|
-
this.session = {
|
|
779
|
-
id: crypto.randomUUID(),
|
|
780
|
-
target,
|
|
781
|
-
capabilities: [],
|
|
782
|
-
status: 'initializing',
|
|
783
|
-
created: new Date().toISOString(),
|
|
784
|
-
lastActivity: new Date().toISOString(),
|
|
785
|
-
evidenceDir,
|
|
786
|
-
findings: [],
|
|
787
|
-
actions: [],
|
|
788
|
-
metrics: {
|
|
789
|
-
surveillanceEventsLogged: 0,
|
|
790
|
-
claimsFalsified: 0,
|
|
791
|
-
evidenceFilesCreated: 0,
|
|
792
|
-
regulatoryFilingsPrepared: 0,
|
|
793
|
-
estimatedCostImposed: 0,
|
|
794
|
-
narrativeReach: 0,
|
|
795
|
-
coalitionSize: 1,
|
|
796
|
-
daysActive: 0,
|
|
797
|
-
},
|
|
798
|
-
hash: '',
|
|
799
|
-
};
|
|
800
|
-
// Ensure evidence directory exists
|
|
801
|
-
if (!fs.existsSync(evidenceDir)) {
|
|
802
|
-
fs.mkdirSync(evidenceDir, { recursive: true });
|
|
803
|
-
}
|
|
804
|
-
// Initialize subsystems
|
|
805
|
-
this.counterSurveillance = new CounterSurveillanceSystem(target, path.join(evidenceDir, 'surveillance-logs'));
|
|
806
|
-
this.transparencyAuditor = new TransparencyAuditor(target, evidenceDir);
|
|
807
|
-
this.evidencePermanence = new EvidencePermanenceSystem(evidenceDir);
|
|
808
|
-
this.regulatoryGenerator = new RegulatoryFilingGenerator(target, evidenceDir);
|
|
809
|
-
// Wire up events
|
|
810
|
-
this.setupEventHandlers();
|
|
811
|
-
}
|
|
812
|
-
setupEventHandlers() {
|
|
813
|
-
if (this.counterSurveillance) {
|
|
814
|
-
this.counterSurveillance.on('new_connection', (conn) => {
|
|
815
|
-
this.addFinding({
|
|
816
|
-
capability: 'counter_surveillance',
|
|
817
|
-
type: 'surveillance_detected',
|
|
818
|
-
severity: conn.riskLevel === 'high' ? 'high' : 'medium',
|
|
819
|
-
title: `New ${this.session.target} connection detected`,
|
|
820
|
-
description: `Connection to ${conn.remoteIP}:${conn.remotePort} (${conn.service})`,
|
|
821
|
-
evidence: conn,
|
|
822
|
-
actionable: true,
|
|
823
|
-
});
|
|
824
|
-
this.session.metrics.surveillanceEventsLogged++;
|
|
825
|
-
});
|
|
826
|
-
this.counterSurveillance.on('daemon_anomaly', (anomaly) => {
|
|
827
|
-
this.addFinding({
|
|
828
|
-
capability: 'counter_surveillance',
|
|
829
|
-
type: 'anomaly_detected',
|
|
830
|
-
severity: 'high',
|
|
831
|
-
title: `Daemon anomaly: ${anomaly.daemon}`,
|
|
832
|
-
description: `${anomaly.type}: ${anomaly.previous} → ${anomaly.current}`,
|
|
833
|
-
evidence: anomaly,
|
|
834
|
-
actionable: true,
|
|
835
|
-
});
|
|
836
|
-
});
|
|
837
|
-
}
|
|
838
|
-
if (this.transparencyAuditor) {
|
|
839
|
-
this.transparencyAuditor.on('test_complete', (test) => {
|
|
840
|
-
if (test.result === 'falsified') {
|
|
841
|
-
this.addFinding({
|
|
842
|
-
capability: 'transparency_audit',
|
|
843
|
-
type: 'claim_falsified',
|
|
844
|
-
severity: 'critical',
|
|
845
|
-
title: `Claim falsified: ${test.claim}`,
|
|
846
|
-
description: test.evidence,
|
|
847
|
-
evidence: test,
|
|
848
|
-
actionable: true,
|
|
849
|
-
});
|
|
850
|
-
this.session.metrics.claimsFalsified++;
|
|
851
|
-
}
|
|
852
|
-
});
|
|
853
|
-
}
|
|
854
|
-
}
|
|
855
|
-
addFinding(data) {
|
|
856
|
-
const finding = {
|
|
857
|
-
id: crypto.randomUUID(),
|
|
858
|
-
timestamp: new Date().toISOString(),
|
|
859
|
-
...data,
|
|
860
|
-
hash: '',
|
|
861
|
-
};
|
|
862
|
-
finding.hash = crypto.createHash('sha256')
|
|
863
|
-
.update(JSON.stringify({ ...finding, hash: '' }))
|
|
864
|
-
.digest('hex');
|
|
865
|
-
this.session.findings.push(finding);
|
|
866
|
-
this.session.lastActivity = new Date().toISOString();
|
|
867
|
-
this.emit('finding', finding);
|
|
868
|
-
}
|
|
869
|
-
// ─────────────────────────────────────────────────────────────────────────────
|
|
870
|
-
// PUBLIC API
|
|
871
|
-
// ─────────────────────────────────────────────────────────────────────────────
|
|
872
|
-
async initialize() {
|
|
873
|
-
this.session.status = 'active';
|
|
874
|
-
this.session.capabilities = [
|
|
875
|
-
'counter_surveillance',
|
|
876
|
-
'evidence_collection',
|
|
877
|
-
'evidence_permanence',
|
|
878
|
-
'transparency_audit',
|
|
879
|
-
'regulatory_filing',
|
|
880
|
-
'symmetric_response',
|
|
881
|
-
];
|
|
882
|
-
this.emit('initialized', { sessionId: this.session.id });
|
|
883
|
-
}
|
|
884
|
-
async startCounterSurveillance(intervalMs = 5000) {
|
|
885
|
-
if (this.counterSurveillance) {
|
|
886
|
-
await this.counterSurveillance.start(intervalMs);
|
|
887
|
-
this.emit('counter_surveillance_started');
|
|
888
|
-
}
|
|
889
|
-
}
|
|
890
|
-
stopCounterSurveillance() {
|
|
891
|
-
if (this.counterSurveillance) {
|
|
892
|
-
this.counterSurveillance.stop();
|
|
893
|
-
this.emit('counter_surveillance_stopped');
|
|
894
|
-
}
|
|
895
|
-
}
|
|
896
|
-
async runTransparencyAudit() {
|
|
897
|
-
if (!this.transparencyAuditor)
|
|
898
|
-
return [];
|
|
899
|
-
const tests = await this.transparencyAuditor.runAllTests();
|
|
900
|
-
this.session.metrics.evidenceFilesCreated++;
|
|
901
|
-
return tests;
|
|
902
|
-
}
|
|
903
|
-
async generateEvidencePackage() {
|
|
904
|
-
if (!this.evidencePermanence)
|
|
905
|
-
return '';
|
|
906
|
-
const masterHash = await this.evidencePermanence.saveHashChain();
|
|
907
|
-
this.session.metrics.evidenceFilesCreated += 3; // hash chain + 2 scripts
|
|
908
|
-
this.emit('evidence_package_generated', { masterHash });
|
|
909
|
-
return masterHash;
|
|
910
|
-
}
|
|
911
|
-
async generateRegulatoryFilings() {
|
|
912
|
-
if (!this.regulatoryGenerator || !this.evidencePermanence)
|
|
913
|
-
return [];
|
|
914
|
-
const masterHash = await this.evidencePermanence.saveHashChain();
|
|
915
|
-
const filings = await this.regulatoryGenerator.generateAllFilings(masterHash);
|
|
916
|
-
this.session.metrics.regulatoryFilingsPrepared = filings.length;
|
|
917
|
-
this.session.metrics.estimatedCostImposed += filings.length * 50000; // Estimated legal cost per filing
|
|
918
|
-
this.emit('regulatory_filings_generated', { count: filings.length });
|
|
919
|
-
return filings;
|
|
920
|
-
}
|
|
921
|
-
async runFullDefense() {
|
|
922
|
-
this.emit('full_defense_started');
|
|
923
|
-
// Initialize
|
|
924
|
-
await this.initialize();
|
|
925
|
-
// Run transparency audit
|
|
926
|
-
console.log('[1/4] Running transparency audit...');
|
|
927
|
-
await this.runTransparencyAudit();
|
|
928
|
-
// Generate evidence package
|
|
929
|
-
console.log('[2/4] Generating evidence package...');
|
|
930
|
-
await this.generateEvidencePackage();
|
|
931
|
-
// Generate regulatory filings
|
|
932
|
-
console.log('[3/4] Generating regulatory filings...');
|
|
933
|
-
await this.generateRegulatoryFilings();
|
|
934
|
-
// Start counter-surveillance
|
|
935
|
-
console.log('[4/4] Starting counter-surveillance...');
|
|
936
|
-
await this.startCounterSurveillance();
|
|
937
|
-
// Let it run for a bit to collect initial data
|
|
938
|
-
await new Promise(resolve => setTimeout(resolve, 10000));
|
|
939
|
-
this.stopCounterSurveillance();
|
|
940
|
-
// Generate final report
|
|
941
|
-
this.generateFinalReport();
|
|
942
|
-
this.session.status = 'complete';
|
|
943
|
-
this.emit('full_defense_complete', this.session);
|
|
944
|
-
return this.session;
|
|
945
|
-
}
|
|
946
|
-
generateFinalReport() {
|
|
947
|
-
const report = `================================================================================
|
|
948
|
-
USER DEFENSE SESSION REPORT
|
|
949
|
-
================================================================================
|
|
950
|
-
|
|
951
|
-
Session ID: ${this.session.id}
|
|
952
|
-
Target: ${this.session.target.toUpperCase()}
|
|
953
|
-
Status: ${this.session.status}
|
|
954
|
-
Created: ${this.session.created}
|
|
955
|
-
Last Activity: ${this.session.lastActivity}
|
|
956
|
-
|
|
957
|
-
================================================================================
|
|
958
|
-
CAPABILITIES DEPLOYED
|
|
959
|
-
================================================================================
|
|
960
|
-
|
|
961
|
-
${this.session.capabilities.map(c => `✓ ${c}`).join('\n')}
|
|
962
|
-
|
|
963
|
-
================================================================================
|
|
964
|
-
FINDINGS
|
|
965
|
-
================================================================================
|
|
966
|
-
|
|
967
|
-
${this.session.findings.map(f => `
|
|
968
|
-
[${f.severity.toUpperCase()}] ${f.title}
|
|
969
|
-
Type: ${f.type}
|
|
970
|
-
Capability: ${f.capability}
|
|
971
|
-
${f.description}
|
|
972
|
-
Hash: ${f.hash}
|
|
973
|
-
`).join('\n---\n')}
|
|
974
|
-
|
|
975
|
-
================================================================================
|
|
976
|
-
METRICS
|
|
977
|
-
================================================================================
|
|
978
|
-
|
|
979
|
-
Surveillance Events Logged: ${this.session.metrics.surveillanceEventsLogged}
|
|
980
|
-
Claims Falsified: ${this.session.metrics.claimsFalsified}
|
|
981
|
-
Evidence Files Created: ${this.session.metrics.evidenceFilesCreated}
|
|
982
|
-
Regulatory Filings Prepared: ${this.session.metrics.regulatoryFilingsPrepared}
|
|
983
|
-
Estimated Cost Imposed: $${this.session.metrics.estimatedCostImposed.toLocaleString()}
|
|
984
|
-
|
|
985
|
-
================================================================================
|
|
986
|
-
GENERATED BY EROSOLAR-CLI
|
|
987
|
-
UserDefenseOrchestrator v1.0.0
|
|
988
|
-
================================================================================
|
|
989
|
-
`;
|
|
990
|
-
fs.writeFileSync(path.join(this.session.evidenceDir, 'DEFENSE-SESSION-REPORT.txt'), report);
|
|
991
|
-
}
|
|
992
|
-
getSession() {
|
|
993
|
-
return this.session;
|
|
994
|
-
}
|
|
995
|
-
getFindings() {
|
|
996
|
-
return this.session.findings;
|
|
997
|
-
}
|
|
998
|
-
getMetrics() {
|
|
999
|
-
return this.session.metrics;
|
|
1000
|
-
}
|
|
1001
|
-
}
|
|
1002
|
-
// ═══════════════════════════════════════════════════════════════════════════════
|
|
1003
|
-
// EXPORTS
|
|
1004
|
-
// ═══════════════════════════════════════════════════════════════════════════════
|
|
1005
|
-
export default UserDefenseOrchestrator;
|
|
1006
|
-
//# sourceMappingURL=userDefenseOrchestrator.js.map
|