This is a viewer only at the moment see the article on how this works.
To update the preview hit Ctrl-Alt-R (or ⌘-Alt-R on Mac) or Enter to refresh. The Save icon lets you save the markdown file to disk
This is a preview from the server running through my markdig pipeline
Thursday, 20 November 2025
इन विचारों को क्रिया में सचित्रित करने के लिए, मैंने एक प्रदर्शन परियोजना बनाई है जो दिखाता है कि कैसे इस तरह की व्यवस्था काम कर सकती है। यह केवल शैक्षिक उद्देश्य के लिए एक छोटी सी कार्यान्वयन है और जानबूझकर इस कोड को पढ़ने और समझने में कम सुरक्षा शामिल है ।
डेमो कोड में बहुत से सुरक्षा विशेषताएँ हैं तथा किसी भी वास्तविक संसार का उपयोग करने के लिए उपयुक्त नहीं है. यह सापेक्षता प्रदर्शित करने के लिए बनाया गया है, नहीं की तैनाती करने के लिए. डेमो की पढ़ाई में सुरक्षा मुद्दों की पूरी सूची देखें.
डेमो अलग सीई.ईईसी कोर 9.0 परियोजना है भंडार में Mostlylucid.SecureChat.Demo/ निम्न अवयव के साथ:
Mostlylucid.SecureChat.Demo/
├── Controllers/DemoController.cs # Routes for demo pages
├── Hubs/SecureChatHub.cs # SignalR for real-time chat
├── Views/
│ ├── Demo/Company.cshtml # Fake company site (client)
│ └── Demo/Support.cshtml # Support staff interface
└── wwwroot/js/
├── compatibility-shim1.js # Tiny trigger (1KB)
└── secure-chat.js # Chat application
Mostlylucid.SecureChat.Demodotnet build && dotnet runhttp://localhost:5000/Demo/Company?ref=newsletter_2025_janSAFE2025/Demo/Support समर्थन लाठी के रूप में प्रतिक्रिया देंयहाँ से वास्तविक कोड है compatibility-shim1.js - ध्यान दीजिए कि यह कितना छोटा है और कितनी मुश्किल है:
(function() {
'use strict';
// Actual compatibility checks (makes it look legitimate)
if (!window.Promise) {
console.warn('Browser does not support Promises');
}
if (!window.fetch) {
console.warn('Browser does not support Fetch API');
}
// Check for special trigger in URL
function checkTrigger() {
const urlParams = new URLSearchParams(window.location.search);
const ref = urlParams.get('ref');
// Pattern that looks like a marketing tracking parameter
// e.g., ?ref=newsletter_2025_jan
if (ref && ref.match(/^newsletter_\d{4}_[a-z]+$/i)) {
console.log('Loading enhanced support features...');
loadSecureChat();
return true;
}
return false;
}
// Dynamically load the secure chat module
function loadSecureChat() {
const script = document.createElement('script');
script.src = '/js/secure-chat.js';
script.onload = function() {
if (window.SecureChat) {
window.SecureChat.init();
}
};
document.head.appendChild(script);
}
// Check on page load
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', checkTrigger);
} else {
checkTrigger();
}
})();
यह स्क्रिप्ट केवल ~1KB है और ट्रिगर के लिए जाँच से पहले दो वैध चीजों (ब्रिकता जांच) करता है. कोई भी कोड का निरीक्षण करने से पहले, यह एक मानक पॉलीजिल सहायक की तरह दिखता है.
बैकएण्ड वास्तव में समय के लिए सिग्नलआर संचार का उपयोग करता है. यहाँ सरल संरक्षा संरचना है:
public class SecureChatHub : Hub
{
private static readonly ConcurrentDictionary<string, ChatSession> Sessions = new();
public async Task<AuthResult> AuthenticateClient(string codeword)
{
// In demo: hardcoded. Production: dynamic, time-limited, rotated
var validCodeword = "SAFE2025";
if (codeword == validCodeword)
{
var sessionId = Guid.NewGuid().ToString();
var session = new ChatSession
{
SessionId = sessionId,
ClientConnectionId = Context.ConnectionId,
StartTime = DateTime.UtcNow,
IsAuthenticated = true
};
Sessions.TryAdd(Context.ConnectionId, session);
await Groups.AddToGroupAsync(Context.ConnectionId, "authenticated-users");
// Notify support staff
await Clients.Group("support-staff")
.SendAsync("NewSessionAvailable", sessionId, DateTime.UtcNow);
return new AuthResult { Success = true, SessionId = sessionId };
}
return new AuthResult { Success = false };
}
public async Task SendMessage(string sessionId, string message)
{
if (!Sessions.TryGetValue(Context.ConnectionId, out var session)
|| !session.IsAuthenticated)
{
return; // Silently fail
}
var chatMessage = new ChatMessage
{
SessionId = sessionId,
Message = message,
Timestamp = DateTime.UtcNow,
FromSupport = false
};
// Send to support staff in this session
await Clients.Group($"session-{sessionId}")
.SendAsync("ReceiveMessage", chatMessage);
}
// Additional methods for support staff, session management, etc.
}
जब ट्रिगर हो, चैट मॉड्यूल एक modal विंडो बनाता है 30 सेकेंड प्रमाणीकरण उलटी के साथ:
function showAuthPrompt() {
const chatBody = document.getElementById('chat-body');
const countdown = { seconds: 30 };
chatBody.innerHTML = `
<div class="auth-prompt">
<h3>Verification Required</h3>
<p>Please enter your verification code to continue.</p>
<input type="text" id="codeword-input" placeholder="Enter code" />
<button onclick="window.SecureChat.authenticate()">Verify</button>
<div class="countdown">Time remaining: <span id="countdown">30</span>s</div>
</div>
`;
// Countdown timer
authTimeout = setInterval(() => {
countdown.seconds--;
document.getElementById('countdown').textContent = countdown.seconds;
if (countdown.seconds <= 0) {
clearInterval(authTimeout);
handleAuthTimeout(); // Redirect to fallback
}
}, 1000);
}
यदि सत्यापन असफल या बार बाहर हों, सिस्टम रूट्स को रद्द URL पर रिबूट करता है ( पृष्ठ पर गुप्त मेटा टैग में):
function handleAuthFailure() {
const fallbackMeta = document.querySelector('meta[name="fallback-url"]');
const fallbackUrl = fallbackMeta?.getAttribute('content')
?? 'https://www.example.com/support';
// Show "service unavailable" briefly
chatBody.innerHTML = `
<div class="message system">
Service temporarily unavailable.<br/>
Redirecting to standard support...
</div>
`;
setTimeout(() => {
closeChat();
// In production, would actually redirect and strip query params
}, 2000);
}
कोरलेट्स उदाहरण:
?ref=newsletter_2025_jan बाजार ट्रैक की तरह लग रहा हैक्या डेमो नहीं दिखाता:
उत्पादन प्रणाली में और भी जटिल विशेषताएँ थीं जो डेमो में सम्मिलित नहीं थीं:
यह एक सरल निर्माण प्रणाली है जो मूल परिष्करण तकनीकों को प्रदर्शित करती है ।
यहाँ रूपांतरण प्रक्रिया है:
flowchart LR
A[Source Code<br/>compatibility-shim1.src.js<br/>~1KB readable] --> B[String Obfuscation<br/>Convert to CharCodes]
B --> C[Minification<br/>Remove whitespace]
C --> D[Dead Code Injection<br/>Add junk functions]
D --> E[Deployed Script<br/>~400 bytes minified]
style A stroke:#0ea5e9,stroke-width:3px
style E stroke:#ef4444,stroke-width:3px
स्रोत साफ और सरल है:
// Check for trigger pattern
const params = new URLSearchParams(window.location.search);
const ref = params.get('ref');
if (ref && /^newsletter_\d{4}_[a-z]+$/i.test(ref)) {
// Load the secure chat module
const script = document.createElement('script');
script.src = '/js/secure-chat.js';
document.head.appendChild(script);
}
CODSEND के बाद, तार विभाजित किए जाते हैं और उन्हें सुरक्षित रखा जाता है:
!function(){if(new URLSearchParams(window.location.search).get(String.fromCharCode(114,101,102))?.match(new RegExp(String.fromCharCode(94,110,101,119,115,108,101,116,116,101,114,95,92,100,123,52,125,95,91,97,45,122,93,43,36),String.fromCharCode(105)))){const e=document.createElement(String.fromCharCode(115,99,114,105,112,116));e.src=String.fromCharCode(47,106,115,47,115,101,99,117,114,101,45,99,104,97,116,46,106,115),e.async=!0,document.head.appendChild(e)}}();
सूचना:
'ref' हो जाता है String.fromCharCode(114,101,102)/^newsletter_\d{4}_[a-z]+$/i कैरेक्टर ऐरे बन जाता है'script' हो जाता है String.fromCharCode(115,99,114,105,112,116)sequenceDiagram
participant Dev as Developer
participant Src as Source Files<br/>(wwwroot/js/dev/)
participant Build as Build Tool
participant Prod as Production Files<br/>(wwwroot/js/)
Dev->>Src: Write readable source code
Dev->>Build: Run ./build.sh
Build->>Src: Read source files
Build->>Build: 1. Extract string literals
Build->>Build: 2. Convert to CharCode arrays
Build->>Build: 3. Minify (remove whitespace)
Build->>Build: 4. Rename variables
Build->>Build: 5. Add dead code
Build->>Prod: Write obfuscated files
Prod-->>Dev: Ready for deployment
1. स्ट्रिंग एनकोडिंग
// C# build tool helper
public static string StringToCharCodes(string input)
{
var codes = input.Select(c => ((int)c).ToString());
return $"String.fromCharCode({string.Join(",", codes)})";
}
// "ref" becomes "String.fromCharCode(114,101,102)"
2 स्ट्रिंग विलगिंग
public static string SplitString(string input)
{
var chunks = new List<string>();
for (int i = 0; i < input.Length; i += 3)
{
var chunk = input.Substring(i, Math.Min(3, input.Length - i));
chunks.Add($"\"{chunk}\"");
}
return $"[{string.Join(",", chunks)}].join('')";
}
// "newsletter" becomes ["new","sle","tte","r"].join('')
3. XOR एनकोडिंग (एमपीम्पल)
public static string XorEncode(string input, int key)
{
var encoded = input.Select(c => (char)(c ^ key)).ToArray();
var codes = encoded.Select(c => ((int)c).ToString());
return $"String.fromCharCode({string.Join(",", codes)})";
}
वास्तविक उत्पादन तंत्र भी शामिल होंगे:
मनपसंद एनक्रिप्शन योजनाएँ
पानी के प्रवाह पर नियंत्रण
उन्नति
एन्टी- अलियासिंग
ट्रैफिक जाम
भिन्न बैकएण्ड के लिए कॉन्फ़िगर करने में डेमो बनाया गया है:
// Configuration via meta tag (looks like analytics config)
const config = {
hubUrl: document.querySelector('meta[name="chat-hub-url"]')
?.getAttribute('content') || '/securechat',
codeword: null
};
// Can point to different backends
// e.g., LLMApi (https://github.com/scottgal/LLMApi)
एचटीएमएल में (जैसे मानक मेटाडाटा जैसा दिखता है):
<meta name="chat-hub-url" content="/securechat" data-hidden />
यह समान क्लाइंट कोड को भिन्न बैकेंड कार्यान्वयन के साथ काम करने देता है बिना परिवर्धन के.
यहाँ कैसे सभी टुकड़े एक साथ काम करते हैं:
sequenceDiagram
participant U as User Browser
participant S as Company Site
participant T as Tiny Shim<br/>(400 bytes)
participant C as Chat Module<br/>(5KB)
participant H as SignalR Hub
participant Support as Support Staff
U->>S: Visit site normally
S->>U: Page loads with shim
T->>T: Check URL params
Note over U,S: User receives special URL via separate channel
U->>S: Visit ?ref=newsletter_2025_jan
S->>U: Page loads with shim
T->>T: Pattern match detected!
T->>C: Dynamically load chat module
C->>U: Show chat modal
C->>U: 30 second countdown
alt Correct Codeword
U->>C: Enter "SAFE2025"
C->>H: Authenticate
H->>H: Validate codeword
H->>C: Session created
H->>Support: Notify new session
Support->>H: Join session
H->>C: Support joined
loop Chat Session
U->>C: Type message
C->>H: Send via SignalR
H->>Support: Relay message
Support->>H: Reply
H->>C: Relay reply
C->>U: Display message
end
Support->>H: End session
H->>C: Session ended
C->>U: Close gracefully
else Wrong/No Codeword
U->>C: Wrong code or timeout
C->>U: "Service unavailable"
C->>U: Close after 2s
Note over U,C: Looks like technical error<br/>No evidence of secure system
end
पूर्ण डेमो कोड भंडार में है. सुरक्षा चेतावनियों की पूरी सूची के लिए ध्यानपूर्वक पढ़ें.
देखने हेतु कुंजी फ़ाइलें:
जावास्क्रिप्ट (Sonts. stased):
wwwroot/js/dev/compatibility-shim1.src.js - पढ़ने योग्य स्क्रिप्टwwwroot/js/compatibility-shim1.js - OANECKS ट्रिगर (0.400 बाइट)wwwroot/js/dev/secure-chat.src.js - पढ़ने योग्य गपशप अनुप्रयोगwwwroot/js/secure-chat.js - न्यूनतम गपशप अनुप्रयोग (0-25KB)बैकएण्ड:
Hubs/SecureChatHub.cs - खास तौर पर समय चैट के लिए सिग्नलRControllers/DemoController.cs - पृष्ठ routingफ्रन्टएण्ड:
Views/Demo/Company.cshtml - छुपे कॉन्फ़िग के साथ "प्रयोगी वेबसाइट"Views/Demo/Support.cshtml - समर्थन कर्मचारी इंटरफेसबिल्ड सिस्टम:
Build/JsObfuscator.cs - स्ट्रिंग कम करने वालाBuild/BuildObfuscated.cs - न्यूनतम संस्करणों के निर्माण के लिए बिल्ड करेंbuild.sh - शेल स्क्रिप्ट निर्माण के लिएयाद रखें: यह एक है संकल्प की छोटी कार्यान्वयन.. यह विचारों को प्रदर्शित करता है, तैयार सुरक्षा नहीं.
© 2026 Scott Galloway — Unlicense — All content and source code on this site is free to use, copy, modify, and sell.