unicode-puzzles-mcp
Version:
MCP server for quantum steganography puzzles using Unicode
124 lines (106 loc) โข 4.67 kB
JavaScript
import { StegoPuzzleManager } from './src/steganography/manager.js';
import { TemplateEngine } from './src/templates/engine.js';
const puzzleManager = new StegoPuzzleManager();
const templates = new TemplateEngine();
// Test different templates and encoding methods
async function testAllTechniques() {
const message = "Just a normal LinkedIn post about innovation and synergy!";
const secret = "ACTUALLY I HATE CORPORATE BUZZWORDS";
console.log("=== ๐งช TESTING ALL STEGANOGRAPHY TECHNIQUES ===\n");
// Test 1: Quantum Template (Binary Encoding)
console.log("1๏ธโฃ QUANTUM TEMPLATE (Binary Encoding):");
const quantumTemplate = templates.getTemplate('quantum');
const quantumPuzzle = await puzzleManager.createPuzzle({
template: quantumTemplate,
message: message,
secret: secret,
difficulty: 'medium'
});
console.log(quantumPuzzle);
console.log(`Hidden chars: ${countZeroWidth(quantumPuzzle)}\n`);
// Test 2: Orbital Template (Trinary Encoding)
console.log("2๏ธโฃ ORBITAL TEMPLATE (Trinary Encoding):");
const orbitalTemplate = templates.getTemplate('orbital');
const orbitalPuzzle = await puzzleManager.createPuzzle({
template: orbitalTemplate,
message: message,
secret: secret,
difficulty: 'hard'
});
console.log(orbitalPuzzle);
console.log(`Hidden chars: ${countZeroWidth(orbitalPuzzle)}\n`);
// Test 3: Void Template
console.log("3๏ธโฃ VOID TEMPLATE (Space Theme):");
const voidTemplate = templates.getTemplate('void');
const voidPuzzle = await puzzleManager.createPuzzle({
template: voidTemplate,
message: message,
secret: secret,
difficulty: 'easy'
});
console.log(voidPuzzle);
console.log(`Hidden chars: ${countZeroWidth(voidPuzzle)}\n`);
// Test 4: Custom Unicode Art
console.log("4๏ธโฃ CUSTOM UNICODE ART:");
const customMessage = createUnicodeArt(message, secret);
console.log(customMessage);
console.log(`Hidden chars: ${countZeroWidth(customMessage)}\n`);
// Test 5: Homoglyph Attack
console.log("5๏ธโฃ HOMOGLYPH CONFUSION:");
const homoglyphMessage = createHomoglyphMessage(message);
console.log(homoglyphMessage);
console.log("(Uses lookalike characters from different Unicode blocks)\n");
}
// Count zero-width characters
function countZeroWidth(text) {
const zeroWidthRegex = /[\u200B-\u200F\u2060-\u206F]/g;
const matches = text.match(zeroWidthRegex);
return matches ? matches.length : 0;
}
// Create Unicode art with hidden message
function createUnicodeArt(visible, hidden) {
const frames = ['โฆ', 'โง'];
const decorations = ['โฆ', 'โง', 'โถ', 'โท', 'โธ', 'โน'];
let result = frames[0] + ' ';
// Add decorations with hidden zero-width chars
for (let i = 0; i < 5; i++) {
result += decorations[Math.floor(Math.random() * decorations.length)];
if (i < hidden.length) {
result += hidden.charCodeAt(i) % 2 ? '\u200B' : '\u200C';
}
}
result += ' ' + visible + ' ';
// More decorations
for (let i = 0; i < 5; i++) {
result += decorations[Math.floor(Math.random() * decorations.length)];
if (i + 5 < hidden.length) {
result += hidden.charCodeAt(i + 5) % 2 ? '\u200D' : '\u200E';
}
}
result += ' ' + frames[1];
return result;
}
// Create message with homoglyphs
function createHomoglyphMessage(text) {
const homoglyphs = {
'a': ['ะฐ', '๏ฝ', '๐', '๐', '๐', '๐ถ', '๐ช', '๐', '๐', '๐', '๐บ', '๐ฎ', '๐ข', '๐', '๐'],
'e': ['ะต', '๏ฝ
', 'โฏ', '๐', '๐', '๐', '๐ฎ', '๐ข', '๐', '๐', '๐พ', '๐ฒ', '๐ฆ', '๐', '๐'],
'o': ['ะพ', '๏ฝ', 'โด', '๐จ', '๐', '๐', '๐ธ', '๐ฌ', '๐ ', '๐', '๐', '๐ผ', '๐ฐ', '๐ค', '๐'],
'i': ['ั', '๏ฝ', 'โน', '๐ข', '๐', '๐', '๐ฒ', '๐ฆ', '๐', '๐', '๐', '๐ถ', '๐ช', '๐', '๐'],
'l': ['ำ', '๏ฝ', 'โ', '๐ฅ', '๐', '๐', '๐ต', '๐ฉ', '๐', '๐', '๐
', '๐น', '๐ญ', '๐ก', '๐'],
'n': ['ีธ', '๏ฝ', '๐ง', '๐', '๐', '๐ท', '๐ซ', '๐', '๐', '๐', '๐ป', '๐ฏ', '๐ฃ', '๐'],
's': ['ั', '๏ฝ', '๐ฌ', '๐ ', '๐', '๐ผ', '๐ฐ', '๐ค', '๐', '๐', '๐', '๐ด', '๐จ', '๐'],
' ': [' ', ' ', ' ', ' ', ' ', ' '] // Various space characters
};
return text.split('').map(char => {
const lower = char.toLowerCase();
if (homoglyphs[lower]) {
const alternatives = homoglyphs[lower];
return alternatives[Math.floor(Math.random() * alternatives.length)];
}
return char;
}).join('');
}
// Run tests
testAllTechniques().catch(console.error);