- // ==UserScript==
- // @name Bypass FileCrypt (Improved)
- // @namespace IA
- // @version 1.0.4b
- // @description Bypass FileCrypt with improved link extraction
- // @author IA (with improvements)
- // @license MIT
- // @match http://filecrypt.cc/*
- // @match http://www.filecrypt.cc/*
- // @match http://filecrypt.co/*
- // @match http://www.filecrypt.co/*
- // @match https://filecrypt.cc/*
- // @match https://www.filecrypt.cc/*
- // @match https://filecrypt.co/*
- // @match https://www.filecrypt.co/*
- // @run-at document-end
- // @connect dcrypt.it
- // @connect self
- // @grant GM.xmlHttpRequest
- // ==/UserScript==
-
- (function() {
- 'use strict';
-
- // Determine if dark theme is used
- const isDarkTheme = document.head.querySelector('meta[name="theme-color"]') !== null ||
- document.body.classList.contains('dark') ||
- window.getComputedStyle(document.body).backgroundColor.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)/)?.[1] < 100;
-
- // Add basic stylesheet
- addStylesheet(isDarkTheme);
-
- // Remove ads
- removeAds();
-
- // Apply main functionality based on URL
- if (document.location.href.includes("/Link/")) {
- getSingleLink();
- } else if (document.location.href.includes("/Container/")) {
- waitForCaptchaSolved();
- }
- })();
-
- // Add basic stylesheet
- function addStylesheet(isDarkTheme) {
- const style = document.createElement('style');
- const colors = isDarkTheme ? {
- background: '#1e1e2e',
- text: '#cdd6f4',
- accent: '#cba6f7',
- border: '#313244',
- error: '#f38ba8'
- } : {
- background: '#ffffff',
- text: '#333333',
- accent: '#4f46e5',
- border: '#e5e7eb',
- error: '#ef4444'
- };
-
- style.textContent = `
- .fc-container {
- background-color: ${colors.background};
- color: ${colors.text};
- border: 1px solid ${colors.border};
- border-radius: 10px;
- padding: 1em;
- margin: 1em auto;
- max-width: 600px;
- position: relative;
- z-index: 10;
- font-size: 14px;
- }
- .fc-container span {
- cursor: pointer;
- color: ${colors.accent};
- }
- .fc-container span:hover {
- text-decoration: underline;
- }
- .fc-error {
- color: ${colors.error};
- }
- .fc-loading {
- text-align: center;
- padding: 1em;
- }
- `;
- document.head.appendChild(style);
- }
-
- // Remove ads
- function removeAds() {
- const usenetAds = document.querySelectorAll('a[href*="/pink/"]');
- for (const ad of usenetAds) {
- if (ad.parentNode) ad.parentNode.remove();
- }
- }
-
- // Check if captcha is solved
- function waitForCaptchaSolved() {
- function isCaptchaSolved() {
- return document.querySelectorAll('.dlcdownload, .download, [href*="/DLC/"]').length > 0;
- }
-
- if (isCaptchaSolved()) {
- processContainerPage();
- return;
- }
-
- const captchaObserver = new MutationObserver((mutations, observer) => {
- if (isCaptchaSolved()) {
- observer.disconnect();
- processContainerPage();
- }
- });
-
- captchaObserver.observe(document.body, {
- childList: true,
- subtree: true
- });
- }
-
- // Process container page
- function processContainerPage() {
- const containerSection = findBestContainer();
- const container = createLinkBox();
- containerSection.insertBefore(container, containerSection.firstChild);
-
- const dlcButtons = document.querySelectorAll('.dlcdownload, [href*="/DLC/"]');
- if (dlcButtons.length > 0) {
- const dlcId = dlcButtons[0].getAttribute('onclick')?.split("'")[1] ||
- dlcButtons[0].getAttribute('href')?.match(/\/DLC\/(.+)\.dlc/)?.[1];
- if (dlcId) {
- fetchDlcAndDecrypt(dlcId, container);
- return;
- }
- }
-
- xhrLinkExtract(container);
- }
-
- // Find the best container
- function findBestContainer() {
- const selectors = [
- '.content .window',
- '.download',
- '.content',
- 'main',
- 'article',
- '.container',
- '#container'
- ];
-
- for (const selector of selectors) {
- const element = document.querySelector(selector);
- if (element) return element;
- }
- return document.body;
- }
-
- // Create link box
- function createLinkBox() {
- const container = document.createElement('div');
- container.className = 'fc-container';
- container.id = 'fc-container';
-
- const loading = document.createElement('div');
- loading.className = 'fc-loading';
- loading.textContent = 'Decrypting links...';
- container.appendChild(loading);
-
- return container;
- }
-
- // Fetch and decrypt DLC
- function fetchDlcAndDecrypt(dlcId, container) {
- container.querySelector('.fc-loading').textContent = 'Fetching DLC file...';
- GM.xmlHttpRequest({
- method: 'GET',
- url: `https://${document.location.hostname}/DLC/${dlcId}.dlc`,
- headers: {
- 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36'
- },
- onload: function(response) {
- container.querySelector('.fc-loading').textContent = 'Decrypting via dcrypt.it...';
- GM.xmlHttpRequest({
- method: 'POST',
- url: 'http://dcrypt.it/decrypt/paste',
- headers: {
- 'Content-Type': 'application/x-www-form-urlencoded',
- 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36'
- },
- data: 'content=' + encodeURIComponent(response.responseText),
- onload: function(res) {
- try {
- const result = JSON.parse(res.responseText);
- if (result.success && result.success.links && result.success.links.length > 0) {
- displayLinks(result.success.links, container);
- } else {
- console.error('No links from dcrypt.it:', result);
- xhrLinkExtract(container);
- }
- } catch (e) {
- console.error('Error parsing dcrypt.it response:', e);
- xhrLinkExtract(container);
- }
- },
- onerror: function() {
- console.error('Error connecting to dcrypt.it');
- xhrLinkExtract(container);
- }
- });
- },
- onerror: function() {
- console.error('Error fetching DLC file');
- xhrLinkExtract(container);
- }
- });
- }
-
- // Process single link page
- function getSingleLink() {
- if (document.body.getElementsByTagName('SCRIPT').length === 0) {
- window.stop();
- let htmlContent = document.body.innerHTML;
- if (document.body.children.length === 0) {
- GM.xmlHttpRequest({
- method: 'GET',
- url: document.location.href,
- headers: {
- 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36'
- },
- onload: function(response) {
- extractAndResolveLink(response.responseText);
- },
- onerror: function() {
- console.error('Failed to fetch page content');
- }
- });
- } else {
- extractAndResolveLink(htmlContent);
- }
- }
- }
-
- function extractAndResolveLink(htmlContent) {
- const urlMatch = htmlContent.match(/https?:\/\/[^\s'"]+/);
- if (urlMatch) {
- let intermediateLink = urlMatch[0].replace(/&/g, '&');
- resolveFinalLink(intermediateLink);
- } else {
- console.error('No valid URL found in HTML');
- }
- }
-
- function resolveFinalLink(intermediateLink) {
- GM.xmlHttpRequest({
- method: 'GET',
- url: intermediateLink,
- headers: {
- 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36'
- },
- timeout: 5000,
- onload: function(response) {
- let finalUrl = response.finalUrl || intermediateLink;
- console.log('Resolved final URL:', finalUrl);
- top.location.href = finalUrl;
- },
- onerror: function() {
- console.error('Error resolving link:', intermediateLink);
- top.location.href = intermediateLink;
- }
- });
- }
-
- // Extract links directly
- function xhrLinkExtract(container) {
- const loading = container.querySelector('.fc-loading');
- loading.textContent = 'Extracting links directly...';
- console.log('Starting xhrLinkExtract');
-
- const encLinks = document.querySelectorAll('[onclick^=openLink], a[href*="/Link/"], [data-link], .download-link');
- console.log('Found links:', encLinks.length);
- if (encLinks.length === 0) {
- showError('No links found on this page.', container);
- return;
- }
-
- const finalLinksDiv = document.createElement('div');
- finalLinksDiv.style.backgroundColor = isDarkTheme ? '#1e1e2e' : '#ffffff';
- finalLinksDiv.style.color = isDarkTheme ? '#cdd6f4' : '#333333';
- finalLinksDiv.style.padding = '1em';
- finalLinksDiv.innerHTML = '<span>Decrypted links:</span><br><br>';
-
- container.replaceChild(finalLinksDiv, loading);
-
- function processLinks(index = 0) {
- if (index >= encLinks.length) {
- if (!finalLinksDiv.querySelector('a')) {
- showError('Failed to extract any valid links.', container);
- }
- return;
- }
-
- const link = encLinks[index];
- let linkUrl;
- if (link.getAttribute('href')?.includes('/Link/')) {
- linkUrl = link.getAttribute('href');
- } else if (link.getAttribute('onclick')?.startsWith('openLink')) {
- const passA = link.getAttribute('onclick');
- const passB = passA.split("'")[1];
- const passC = link.getAttribute(passB);
- linkUrl = `http://${document.location.hostname}/Link/${passC}.html`;
- } else {
- linkUrl = link.getAttribute('data-link') || link.getAttribute('href');
- }
-
- if (!linkUrl) {
- console.error('No valid URL for link:', link);
- setTimeout(() => processLinks(index + 1), 100);
- return;
- }
-
- console.log('Processing URL:', linkUrl);
- GM.xmlHttpRequest({
- method: 'GET',
- url: linkUrl,
- headers: {
- 'Content-Type': 'application/x-www-form-urlencoded',
- 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36'
- },
- timeout: 5000,
- onload: function(response) {
- let parser = new DOMParser();
- let doc = parser.parseFromString(response.responseText, 'text/html');
- let scripts = doc.getElementsByTagName('SCRIPT');
- console.log('Scripts found for', linkUrl, ':', scripts.length);
-
- for (let s of scripts) {
- if (s.innerHTML.includes('top.location.href=')) {
- getFinalLink(s.innerHTML.split("'")[1], finalLinksDiv);
- setTimeout(() => processLinks(index + 1), 100);
- return;
- }
- }
-
- let metaRefresh = doc.querySelector('meta[http-equiv="refresh"]');
- if (metaRefresh) {
- let content = metaRefresh.getAttribute('content');
- let urlMatch = content.match(/url=(.+)$/i);
- if (urlMatch) {
- getFinalLink(urlMatch[1], finalLinksDiv);
- setTimeout(() => processLinks(index + 1), 100);
- return;
- }
- }
-
- console.error('No redirect found for:', linkUrl);
- setTimeout(() => processLinks(index + 1), 100);
- },
- onerror: function() {
- console.error('Error fetching:', linkUrl);
- setTimeout(() => processLinks(index + 1), 100);
- }
- });
- }
-
- processLinks();
- }
-
- // Display final link
- function getFinalLink(encLink, finalLinksDiv) {
- GM.xmlHttpRequest({
- method: 'GET',
- url: encLink,
- headers: {
- 'Content-Type': 'application/x-www-form-urlencoded',
- 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36'
- },
- timeout: 5000,
- onload: function(response) {
- let finalUrl = response.finalUrl || encLink;
- // Rimuovi la parte "login?redirect=" se presente
- finalUrl = finalUrl.replace(/login\?redirect=/, '');
- console.log('Decrypted locally:', finalUrl);
-
- let linkElement = document.createElement('a');
- linkElement.href = finalUrl;
- linkElement.textContent = finalUrl;
- linkElement.style.color = isDarkTheme() ? '#cba6f7' : '#4f46e5';
- linkElement.addEventListener('click', function(e) {
- e.preventDefault();
- window.open(finalUrl, '_blank');
- });
- linkElement.addEventListener('contextmenu', function(e) {
- e.preventDefault();
- navigator.clipboard.writeText(finalUrl).then(() => {
- linkElement.textContent = '✓ Copied: ' + finalUrl;
- setTimeout(() => {
- linkElement.textContent = finalUrl;
- }, 2000);
- });
- });
-
- finalLinksDiv.appendChild(linkElement);
- finalLinksDiv.appendChild(document.createElement('br'));
- },
- onerror: function() {
- console.error('Error resolving link:', encLink);
- let errorElement = document.createElement('span');
- errorElement.textContent = `${encLink} (Failed to resolve)`;
- errorElement.className = 'fc-error';
- finalLinksDiv.appendChild(errorElement);
- finalLinksDiv.appendChild(document.createElement('br'));
- }
- });
- }
-
- // Display links
- function displayLinks(links, container) {
- const finalLinksDiv = document.createElement('div');
- finalLinksDiv.style.backgroundColor = isDarkTheme ? '#1e1e2e' : '#ffffff';
- finalLinksDiv.style.color = isDarkTheme ? '#cdd6f4' : '#333333';
- finalLinksDiv.style.padding = '1em';
- finalLinksDiv.innerHTML = '<span>Decrypted links:</span><br><br>';
-
- links.forEach(link => {
- // Rimuovi la parte "login?redirect=" se presente
- let cleanedLink = link.replace(/login\?redirect=/, '');
- let linkElement = document.createElement('a');
- linkElement.href = cleanedLink;
- linkElement.textContent = cleanedLink;
- linkElement.style.color = isDarkTheme ? '#cba6f7' : '#4f46e5';
- linkElement.addEventListener('click', function(e) {
- e.preventDefault();
- window.open(cleanedLink, '_blank');
- });
- linkElement.addEventListener('contextmenu', function(e) {
- e.preventDefault();
- navigator.clipboard.writeText(cleanedLink).then(() => {
- linkElement.textContent = '✓ Copied: ' + cleanedLink;
- setTimeout(() => {
- linkElement.textContent = cleanedLink;
- }, 2000);
- });
- });
-
- finalLinksDiv.appendChild(linkElement);
- finalLinksDiv.appendChild(document.createElement('br'));
- });
-
- container.replaceChild(finalLinksDiv, container.querySelector('.fc-loading'));
- }
-
- // Show error message
- function showError(message, container) {
- const errorDiv = document.createElement('div');
- errorDiv.className = 'fc-error';
- errorDiv.textContent = message;
- container.replaceChild(errorDiv, container.querySelector('.fc-loading'));
- }
-
- // Helper to detect dark theme
- function isDarkTheme() {
- return document.head.querySelector('meta[name="theme-color"]') !== null ||
- document.body.classList.contains('dark') ||
- window.getComputedStyle(document.body).backgroundColor.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)/)?.[1] < 100;
- }