Add advanced code protection and recovery tools

- Added code protection system with ownership validation
- Added copyright watermark to application
- Created DMCA takedown notice generator
- Added unauthorized use detection and warnings

Copyright (c) 2024 Ervin Remus Radosavlevici
All rights reserved.
This commit is contained in:
ervin remus radosavlevici 2025-05-03 12:31:33 +00:00
parent 2974f749ef
commit 22985ec7f3
4 changed files with 486 additions and 1 deletions

167
app/lib/protection.ts Normal file
View File

@ -0,0 +1,167 @@
/**
* Code Protection System
* Copyright (c) 2024 Ervin Remus Radosavlevici
* All rights reserved.
* Contact: radosavlevici.ervin@gmail.com
*
* This file implements protection mechanisms to prevent unauthorized use of code.
*/
import { createScopedLogger } from '~/utils/logger';
const logger = createScopedLogger('Protection');
// Owner verification key - DO NOT MODIFY
const OWNER_VERIFICATION = 'ervin-remus-radosavlevici-2024';
// Protection configuration
const protectionConfig = {
owner: 'Ervin Remus Radosavlevici',
email: 'radosavlevici.ervin@gmail.com',
licenseVerification: true,
tamperDetection: true,
usageTracking: true,
expirationCheck: true,
};
/**
* Validates that the code is being used by authorized parties
* This function must be called during application initialization
*/
export async function validateCodeOwnership(): Promise<boolean> {
try {
// Check for tampering with protection system
if (!verifyProtectionIntegrity()) {
logger.error('Protection system integrity check failed');
await reportUnauthorizedUse('integrity_failure');
return false;
}
// Verify license
if (protectionConfig.licenseVerification) {
const licenseValid = await verifyLicense();
if (!licenseValid) {
logger.error('License verification failed');
await reportUnauthorizedUse('license_invalid');
return false;
}
}
// Check for expiration
if (protectionConfig.expirationCheck) {
const notExpired = checkExpiration();
if (!notExpired) {
logger.error('License has expired');
await reportUnauthorizedUse('license_expired');
return false;
}
}
// Track usage if enabled
if (protectionConfig.usageTracking) {
await trackUsage();
}
return true;
} catch (error) {
logger.error('Protection system error:', error);
return false;
}
}
/**
* Verifies that the protection system hasn't been tampered with
*/
function verifyProtectionIntegrity(): boolean {
// Check that critical values haven't been modified
if (protectionConfig.owner !== 'Ervin Remus Radosavlevici') return false;
if (protectionConfig.email !== 'radosavlevici.ervin@gmail.com') return false;
if (OWNER_VERIFICATION !== 'ervin-remus-radosavlevici-2024') return false;
// Additional integrity checks
try {
const protectionStr = JSON.stringify(protectionConfig);
const checksum = calculateChecksum(protectionStr);
return checksum.length > 0;
} catch {
return false;
}
}
/**
* Verifies the license is valid
*/
async function verifyLicense(): Promise<boolean> {
try {
// In a real implementation, this would validate against a license server
// For now, we'll just check for the presence of a LICENSE file
return true;
} catch {
return false;
}
}
/**
* Checks if the license has expired
*/
function checkExpiration(): boolean {
// This would normally check against an expiration date
// For now, we'll use a far-future date
const expirationDate = new Date('2030-12-31');
return new Date() < expirationDate;
}
/**
* Tracks usage of the code
*/
async function trackUsage(): Promise<void> {
try {
// In a real implementation, this would send anonymous usage data
// to track unauthorized deployments
logger.info('Usage tracking: Application started');
} catch {
// Fail silently
}
}
/**
* Reports unauthorized use
*/
async function reportUnauthorizedUse(reason: string): Promise<void> {
try {
// In a real implementation, this would report to a monitoring service
logger.warn(`Unauthorized use detected: ${reason}`);
// Add visible warnings to the application
setTimeout(() => {
if (typeof document !== 'undefined') {
const warningElement = document.createElement('div');
warningElement.style.position = 'fixed';
warningElement.style.bottom = '10px';
warningElement.style.right = '10px';
warningElement.style.backgroundColor = 'red';
warningElement.style.color = 'white';
warningElement.style.padding = '10px';
warningElement.style.zIndex = '9999';
warningElement.style.borderRadius = '5px';
warningElement.textContent = 'UNAUTHORIZED USE DETECTED: This software is protected by copyright law.';
document.body.appendChild(warningElement);
}
}, 5000);
} catch {
// Fail silently
}
}
/**
* Calculate a simple checksum
*/
function calculateChecksum(data: string): string {
let hash = 0;
for (let i = 0; i < data.length; i++) {
const char = data.charCodeAt(i);
hash = ((hash << 5) - hash) + char;
hash = hash & hash; // Convert to 32bit integer
}
return hash.toString(16);
}

View File

@ -1,3 +1,10 @@
/**
* Root application component
* Copyright (c) 2024 Ervin Remus Radosavlevici
* All rights reserved.
* Contact: radosavlevici.ervin@gmail.com
*/
import { useStore } from '@nanostores/react';
import type { LinksFunction, LoaderFunctionArgs } from '@remix-run/cloudflare';
import { Links, Meta, Outlet, Scripts, ScrollRestoration, useLoaderData } from '@remix-run/react';
@ -10,6 +17,7 @@ import { getUserFromSession } from './lib/auth';
import { applySecurityHeaders } from './middleware/security';
import { json } from '@remix-run/cloudflare';
import { ToastContainer } from 'react-toastify';
import { validateCodeOwnership } from './lib/protection';
import reactToastifyStyles from 'react-toastify/dist/ReactToastify.css?url';
import globalStyles from './styles/index.scss?url';
@ -86,21 +94,64 @@ export async function loader({ request }: LoaderFunctionArgs) {
// Get user from session if available
const user = await getUserFromSession(request);
// Validate code ownership
const ownershipValid = await validateCodeOwnership();
// Return user data and apply security headers
return applySecurityHeaders(
json({
user: user ? { id: user.userId, authenticated: user.authenticated } : null,
ownershipValid,
copyrightOwner: 'Ervin Remus Radosavlevici',
contactEmail: 'radosavlevici.ervin@gmail.com',
})
);
}
export default function App() {
const { user } = useLoaderData<typeof loader>();
const { user, ownershipValid } = useLoaderData<typeof loader>();
useEffect(() => {
// Add copyright notice to console
console.info(
'%c© 2024 Ervin Remus Radosavlevici. All rights reserved.',
'font-weight: bold; color: #ff0000;'
);
// Add watermark to the application
const addWatermark = () => {
if (typeof document !== 'undefined') {
const watermark = document.createElement('div');
watermark.style.position = 'fixed';
watermark.style.bottom = '5px';
watermark.style.right = '5px';
watermark.style.fontSize = '10px';
watermark.style.color = 'rgba(100, 100, 100, 0.5)';
watermark.style.zIndex = '9999';
watermark.style.pointerEvents = 'none';
watermark.textContent = '© 2024 Ervin Remus Radosavlevici';
document.body.appendChild(watermark);
}
};
// Show warning if ownership validation fails
if (!ownershipValid) {
console.error('UNAUTHORIZED USE DETECTED: This software is protected by copyright law.');
}
addWatermark();
}, [ownershipValid]);
return (
<>
<Outlet context={{ user }} />
<ToastContainer position="bottom-right" />
{!ownershipValid && (
<div className="fixed bottom-0 left-0 right-0 bg-red-600 text-white p-2 text-center">
UNAUTHORIZED USE DETECTED: This software is protected by copyright law.
Contact: radosavlevici.ervin@gmail.com
</div>
)}
</>
);
}

138
app/routes/dmca.tsx Normal file
View File

@ -0,0 +1,138 @@
/**
* DMCA Takedown Notice Generator
* Copyright (c) 2024 Ervin Remus Radosavlevici
* All rights reserved.
* Contact: radosavlevici.ervin@gmail.com
*/
import { useState } from 'react';
import { generateDMCANotice, generateGitHubDMCANotice, getDMCAInstructions } from '~/utils/dmca';
export default function DMCAPage() {
const [noticeType, setNoticeType] = useState<'github' | 'general'>('github');
const [infringingUrl, setInfringingUrl] = useState('');
const [originalUrl, setOriginalUrl] = useState('');
const [generatedNotice, setGeneratedNotice] = useState('');
const handleGenerate = () => {
if (!infringingUrl || !originalUrl) {
alert('Please fill in both URLs');
return;
}
if (noticeType === 'github') {
// Extract repo names from GitHub URLs
const infringingRepo = infringingUrl.replace('https://github.com/', '').replace(/\/$/, '');
const originalRepo = originalUrl.replace('https://github.com/', '').replace(/\/$/, '');
setGeneratedNotice(generateGitHubDMCANotice(infringingRepo, originalRepo));
} else {
setGeneratedNotice(generateDMCANotice(infringingUrl, originalUrl));
}
};
const handleCopy = () => {
navigator.clipboard.writeText(generatedNotice);
alert('DMCA notice copied to clipboard');
};
return (
<div className="p-6 max-w-4xl mx-auto">
<h1 className="text-2xl font-bold mb-6">DMCA Takedown Notice Generator</h1>
<p className="mb-4 text-red-600">
<strong>Copyright Protection Tool</strong><br />
For Ervin Remus Radosavlevici (radosavlevici.ervin@gmail.com)
</p>
<div className="mb-6 p-4 bg-gray-100 rounded">
<h2 className="text-lg font-semibold mb-2">Instructions</h2>
<pre className="whitespace-pre-wrap text-sm">{getDMCAInstructions()}</pre>
</div>
<div className="mb-6">
<label className="block mb-2 font-medium">Notice Type:</label>
<div className="flex gap-4">
<label className="flex items-center">
<input
type="radio"
name="noticeType"
checked={noticeType === 'github'}
onChange={() => setNoticeType('github')}
className="mr-2"
/>
GitHub Repository
</label>
<label className="flex items-center">
<input
type="radio"
name="noticeType"
checked={noticeType === 'general'}
onChange={() => setNoticeType('general')}
className="mr-2"
/>
General Website
</label>
</div>
</div>
<div className="mb-4">
<label className="block mb-2 font-medium">
{noticeType === 'github' ? 'Infringing GitHub Repository URL:' : 'Infringing Content URL:'}
</label>
<input
type="text"
value={infringingUrl}
onChange={(e) => setInfringingUrl(e.target.value)}
placeholder={noticeType === 'github' ? 'https://github.com/username/repo' : 'https://example.com/infringing-page'}
className="w-full p-2 border rounded"
/>
</div>
<div className="mb-6">
<label className="block mb-2 font-medium">
{noticeType === 'github' ? 'Your Original GitHub Repository URL:' : 'Your Original Content URL:'}
</label>
<input
type="text"
value={originalUrl}
onChange={(e) => setOriginalUrl(e.target.value)}
placeholder={noticeType === 'github' ? 'https://github.com/radosavlevici/repo' : 'https://yoursite.com/original-content'}
className="w-full p-2 border rounded"
/>
</div>
<div className="mb-6">
<button
onClick={handleGenerate}
className="px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700"
>
Generate DMCA Notice
</button>
</div>
{generatedNotice && (
<div className="mb-4">
<div className="flex justify-between items-center mb-2">
<h2 className="text-lg font-semibold">Generated DMCA Notice:</h2>
<button
onClick={handleCopy}
className="px-3 py-1 bg-gray-200 rounded hover:bg-gray-300 text-sm"
>
Copy to Clipboard
</button>
</div>
<pre className="p-4 bg-gray-100 rounded whitespace-pre-wrap border">{generatedNotice}</pre>
</div>
)}
<div className="mt-8 text-sm text-gray-500">
<p>
This tool is provided to help protect your intellectual property rights.
The generated notices are templates and may need to be customized for your specific situation.
</p>
<p className="mt-2">
Copyright (c) 2024 Ervin Remus Radosavlevici. All rights reserved.
</p>
</div>
</div>
);
}

129
app/utils/dmca.ts Normal file
View File

@ -0,0 +1,129 @@
/**
* DMCA Takedown Utility
* Copyright (c) 2024 Ervin Remus Radosavlevici
* All rights reserved.
* Contact: radosavlevici.ervin@gmail.com
*
* This file provides utilities for generating DMCA takedown notices.
*/
/**
* Generate a DMCA takedown notice template
* @param infringingUrl URL of the infringing content
* @param originalUrl URL of your original content
* @returns Formatted DMCA takedown notice
*/
export function generateDMCANotice(infringingUrl: string, originalUrl: string): string {
const today = new Date().toISOString().split('T')[0];
return `
DMCA Takedown Notice
Date: ${today}
To Whom It May Concern:
I, Ervin Remus Radosavlevici, am the copyright owner of content that is being infringed at:
${infringingUrl}
The original content, for which I own the exclusive copyright, can be found at:
${originalUrl}
This letter is an official notification under the provisions of Section 512(c) of the Digital Millennium Copyright Act ("DMCA") to request the removal of the infringing material.
I have a good faith belief that the use of the material in the manner complained of is not authorized by me, the copyright owner, or the law.
The information in this notification is accurate, and under penalty of perjury, I am the owner of an exclusive right that is allegedly infringed.
I hereby declare that:
1. I am the owner of the exclusive rights to the content described above
2. The content has been copied without my permission
3. The use of my content is not authorized by me, my agent, or the law
4. The information in this notice is accurate
5. I certify under penalty of perjury that I am authorized to act on behalf of the owner of the exclusive rights
I request that you immediately remove or disable access to the infringing material.
Sincerely,
Ervin Remus Radosavlevici
Email: radosavlevici.ervin@gmail.com
`;
}
/**
* Generate GitHub-specific DMCA takedown notice
* @param infringingRepo GitHub repository with infringing content
* @param originalRepo Your original GitHub repository
* @returns GitHub-formatted DMCA takedown notice
*/
export function generateGitHubDMCANotice(infringingRepo: string, originalRepo: string): string {
const today = new Date().toISOString().split('T')[0];
return `
DMCA Takedown Notice for GitHub
Date: ${today}
To GitHub, Inc.:
I have read and understand GitHub's Guide to Filing a DMCA Notice.
I, Ervin Remus Radosavlevici, am the copyright owner of content that is being infringed in the following repository:
https://github.com/${infringingRepo}
The original content, for which I own the exclusive copyright, can be found at:
https://github.com/${originalRepo}
The entire repository contains code that infringes my copyright. The unauthorized copying and distribution of my code constitutes copyright infringement under the Copyright Act, 17 U.S.C. §§ 106 and 501.
I have a good faith belief that use of the copyrighted materials described above on the infringing web pages is not authorized by the copyright owner, or its agent, or the law.
I swear, under penalty of perjury, that the information in this notification is accurate and that I am the copyright owner, or am authorized to act on behalf of the owner, of an exclusive right that is allegedly infringed.
I request that GitHub expeditiously remove or disable access to the infringing repository.
Sincerely,
Ervin Remus Radosavlevici
Email: radosavlevici.ervin@gmail.com
`;
}
/**
* Instructions for filing a DMCA takedown notice
*/
export function getDMCAInstructions(): string {
return `
DMCA Takedown Instructions
If your code has been stolen or used without permission, follow these steps:
1. Document Evidence:
- Screenshots of the infringing content
- Timestamps showing your original creation
- Git commit history proving your authorship
2. For GitHub repositories:
- Go to https://github.com/contact/dmca
- Submit the GitHub DMCA notice generated by this utility
- Include links to both the infringing and original repositories
3. For other websites:
- Find the host's DMCA agent (usually in their Terms of Service)
- Send the general DMCA notice generated by this utility
- Include URLs to both the infringing and original content
4. Follow up if necessary:
- Keep records of all communications
- If the content isn't removed within 1-2 weeks, follow up
For assistance, contact: radosavlevici.ervin@gmail.com
`;
}