PHP code example of yorcreative / laravel-scanator

1. Go to this page and download the library: Download yorcreative/laravel-scanator library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

yorcreative / laravel-scanator example snippets


return [
    'sql' => [
        'ignore_tables' => [
            'failed_jobs',
            'migrations'
        ],
        'ignore_columns' => [
            'id',
            'created_at',
            'updated_at'
        ],
        'ignore_types' => [
            'timestamp'
        ],
        'select' => [
            'low_limit' => 3,
            'high_limit' => 10
        ],
    ]
];

return [
    ...
    'regex_loader' => ['*'], // Opt-in to specific regex classes OR 

$detectionManager = Scanator::init();

$detections = $detectionManager->getDetections();

$detectionManager = new DetectionManager();

Scanator::analyze($detectionManager, 'table_name', ['columns', 'to', 'scan']);

$detections = $detectionManager->getDetections();

 'ignore_tables' => [
    'failed_jobs',
    'migrations'
],

'ignore_columns' => [
    'id',
    'created_at',
    'updated_at'
],

 'ignore_types' => [
    'timestamp'
],

'select' => [
    'low_limit' => 3,
    'high_limit' => 10
],

 'regex_loader' => [
        RegexCollection::$GOOGLE_API,
        RegexCollection::$AUTHORIZATION_BEARER,
        RegexCollection::$CREDIT_CARD_AMERICAN_EXPRESS,
        RegexCollection::$CREDIT_CARD_DISCOVER,
        RegexCollection::$CREDIT_CARD_VISA,
        RegexCollection::$JSON_WEB_TOKEN
    ],



namespace App\Scrubber\RegexCollection;

use YorCreative\Scrubber\Interfaces\RegexCollectionInterface;

class TestRegex implements RegexCollectionInterface
{
    public function getPattern(): string
    {
        /**
         * @todo
         * @note return a regex pattern to detect a specific piece of sensitive data.
         */
        return '(?<=basic) [a-zA-Z0-9=:\\+\/-]{5,100}';
    }

    public function getTestableString(): string
    {
        /**
         * @todo
         * @note return a string that can be used to verify the regex pattern provided.
         */
        return 'basic f9Iu+YwMiJEsQu/vBHlbUNZRkN/ihdB1sNTU';
    }

    public function isSecret(): bool
    {
        return false;
    }
}

 'regex_loader' => [
        RegexCollection::$GOOGLE_API,
        RegexCollection::$AUTHORIZATION_BEARER,
        RegexCollection::$CREDIT_CARD_AMERICAN_EXPRESS,
        RegexCollection::$CREDIT_CARD_DISCOVER,
        RegexCollection::$CREDIT_CARD_VISA,
        RegexCollection::$JSON_WEB_TOKEN,
        'TestRegex'
    ],
bash
php artisan vendor:publish --provider="YorCreative\Scanator\ScanatorServiceProvider"
php artisan vendor:publish --provider="YorCreative\Scanator\ScrubberServiceProvider"