T.ME/BIBIL_0DAY
CasperSecurity


Server : Apache/2
System : Linux server-15-235-50-60 5.15.0-164-generic #174-Ubuntu SMP Fri Nov 14 20:25:16 UTC 2025 x86_64
User : gositeme ( 1004)
PHP Version : 8.2.29
Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Directory :  /home/gositeme/domains/lavocat.quebec/public_html/scripts/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/gositeme/domains/lavocat.quebec/public_html/scripts/check-all-pages.js
#!/usr/bin/env node

const fs = require('fs');
const path = require('path');
const https = require('https');

// Disable SSL certificate verification for self-signed certs
process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = 0;

const BASE_URL = 'https://lavocat.quebec';
const results = {
  working: [],
  errors: [],
  total: 0
};

// Get all page files
function getAllPages(dir) {
  const pages = [];
  
  function walkDir(currentDir) {
    const files = fs.readdirSync(currentDir);
    
    for (const file of files) {
      const filePath = path.join(currentDir, file);
      const stat = fs.statSync(filePath);
      
      if (stat.isDirectory()) {
        walkDir(filePath);
      } else if (file.endsWith('.tsx') || file.endsWith('.ts')) {
        // Convert file path to URL
        let url = filePath
          .replace(/.*\/src\/pages/, '')
          .replace(/\.tsx?$/, '')
          .replace(/\/index$/, '')
          .replace(/\[([^\]]+)\]/g, 'test-$1'); // Replace dynamic routes with test values
        
        if (url === '') url = '/';
        if (!url.startsWith('/')) url = '/' + url;
        
        pages.push({
          file: filePath,
          url: url,
          name: file
        });
      }
    }
  }
  
  walkDir(path.join(__dirname, '../src/pages'));
  return pages;
}

// Test a single page
function testPage(page) {
  return new Promise((resolve) => {
    const url = BASE_URL + page.url;
    
    const req = https.get(url, (res) => {
      const status = res.statusCode;
      const contentType = res.headers['content-type'] || '';
      
      let body = '';
      res.on('data', (chunk) => {
        body += chunk;
      });
      
      res.on('end', () => {
        const isError = status >= 400;
        const hasErrorContent = body.includes('ModuleBuildError') || 
                               body.includes('Syntax Error') || 
                               body.includes('Expression expected') ||
                               body.includes('Expected \';\'') ||
                               body.includes('Unexpected eof');
        
        const result = {
          url: page.url,
          file: page.file,
          status,
          isError: isError || hasErrorContent,
          errorType: isError ? 'HTTP' : (hasErrorContent ? 'SYNTAX' : 'NONE'),
          size: body.length
        };
        
        if (result.isError) {
          results.errors.push(result);
        } else {
          results.working.push(result);
        }
        
        results.total++;
        resolve(result);
      });
    });
    
    req.on('error', (err) => {
      results.errors.push({
        url: page.url,
        file: page.file,
        status: 0,
        isError: true,
        errorType: 'NETWORK',
        error: err.message,
        size: 0
      });
      results.total++;
      resolve();
    });
    
    req.setTimeout(10000, () => {
      req.destroy();
      results.errors.push({
        url: page.url,
        file: page.file,
        status: 0,
        isError: true,
        errorType: 'TIMEOUT',
        size: 0
      });
      results.total++;
      resolve();
    });
  });
}

// Main function
async function checkAllPages() {
  console.log('🔍 Scanning for all pages...');
  const pages = getAllPages();
  
  console.log(`📄 Found ${pages.length} pages to test`);
  console.log('🚀 Starting comprehensive page audit...\n');
  
  // Test pages in batches to avoid overwhelming the server
  const batchSize = 5;
  for (let i = 0; i < pages.length; i += batchSize) {
    const batch = pages.slice(i, i + batchSize);
    const promises = batch.map(page => testPage(page));
    
    await Promise.all(promises);
    
    // Progress indicator
    const progress = Math.round((i + batch.length) / pages.length * 100);
    process.stdout.write(`\r⏳ Progress: ${progress}% (${i + batch.length}/${pages.length})`);
  }
  
  console.log('\n\n📊 AUDIT RESULTS:');
  console.log('================');
  console.log(`✅ Working pages: ${results.working.length}`);
  console.log(`❌ Error pages: ${results.errors.length}`);
  console.log(`📄 Total pages: ${results.total}`);
  
  if (results.errors.length > 0) {
    console.log('\n🚨 PAGES WITH ERRORS:');
    console.log('====================');
    
    const errorTypes = {};
    results.errors.forEach(error => {
      if (!errorTypes[error.errorType]) {
        errorTypes[error.errorType] = [];
      }
      errorTypes[error.errorType].push(error);
    });
    
    Object.keys(errorTypes).forEach(type => {
      console.log(`\n📋 ${type} ERRORS (${errorTypes[type].length}):`);
      errorTypes[type].forEach(error => {
        console.log(`  ❌ ${error.url} (${error.file}) - Status: ${error.status}`);
        if (error.error) {
          console.log(`     Error: ${error.error}`);
        }
      });
    });
  }
  
  if (results.working.length > 0) {
    console.log('\n✅ WORKING PAGES:');
    console.log('=================');
    results.working.forEach(page => {
      console.log(`  ✅ ${page.url} - Status: ${page.status} (${page.size} bytes)`);
    });
  }
  
  console.log('\n🎯 SUMMARY:');
  console.log(`Success Rate: ${Math.round((results.working.length / results.total) * 100)}%`);
  console.log(`Error Rate: ${Math.round((results.errors.length / results.total) * 100)}%`);
}

// Run the audit
checkAllPages().catch(console.error);

CasperSecurity Mini