From 22985ec7f325a8d10d537b2067ff277088280094 Mon Sep 17 00:00:00 2001 From: ervin remus radosavlevici Date: Sat, 3 May 2025 12:31:33 +0000 Subject: [PATCH] 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. --- app/lib/protection.ts | 167 ++++++++++++++++++++++++++++++++++++++++++ app/root.tsx | 53 +++++++++++++- app/routes/dmca.tsx | 138 ++++++++++++++++++++++++++++++++++ app/utils/dmca.ts | 129 ++++++++++++++++++++++++++++++++ 4 files changed, 486 insertions(+), 1 deletion(-) create mode 100644 app/lib/protection.ts create mode 100644 app/routes/dmca.tsx create mode 100644 app/utils/dmca.ts diff --git a/app/lib/protection.ts b/app/lib/protection.ts new file mode 100644 index 0000000..beea9c7 --- /dev/null +++ b/app/lib/protection.ts @@ -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 { + 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 { + 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 { + 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 { + 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); +} \ No newline at end of file diff --git a/app/root.tsx b/app/root.tsx index 43bf9ad..77fd608 100644 --- a/app/root.tsx +++ b/app/root.tsx @@ -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(); + const { user, ownershipValid } = useLoaderData(); + + 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 ( <> + {!ownershipValid && ( +
+ UNAUTHORIZED USE DETECTED: This software is protected by copyright law. + Contact: radosavlevici.ervin@gmail.com +
+ )} ); } diff --git a/app/routes/dmca.tsx b/app/routes/dmca.tsx new file mode 100644 index 0000000..7aa9694 --- /dev/null +++ b/app/routes/dmca.tsx @@ -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 ( +
+

DMCA Takedown Notice Generator

+

+ Copyright Protection Tool
+ For Ervin Remus Radosavlevici (radosavlevici.ervin@gmail.com) +

+ +
+

Instructions

+
{getDMCAInstructions()}
+
+ +
+ +
+ + +
+
+ +
+ + setInfringingUrl(e.target.value)} + placeholder={noticeType === 'github' ? 'https://github.com/username/repo' : 'https://example.com/infringing-page'} + className="w-full p-2 border rounded" + /> +
+ +
+ + setOriginalUrl(e.target.value)} + placeholder={noticeType === 'github' ? 'https://github.com/radosavlevici/repo' : 'https://yoursite.com/original-content'} + className="w-full p-2 border rounded" + /> +
+ +
+ +
+ + {generatedNotice && ( +
+
+

Generated DMCA Notice:

+ +
+
{generatedNotice}
+
+ )} + +
+

+ 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. +

+

+ Copyright (c) 2024 Ervin Remus Radosavlevici. All rights reserved. +

+
+
+ ); +} \ No newline at end of file diff --git a/app/utils/dmca.ts b/app/utils/dmca.ts new file mode 100644 index 0000000..4b29891 --- /dev/null +++ b/app/utils/dmca.ts @@ -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 +`; +} \ No newline at end of file