!C99Shell v. 2.5 [PHP 8 Update] [24.05.2025]!

Software: Apache. PHP/8.3.27 

uname -a: Linux pdx1-shared-a4-04 6.6.104-grsec-jammy+ #3 SMP Tue Sep 16 00:28:11 UTC 2025 x86_64 

uid=6659440(dh_z2jmpm) gid=2086089(pg10499364) groups=2086089(pg10499364)  

Safe-mode: OFF (not secure)

/opt/ndn-cgroups/   drwxr-xr-x
Free 668.19 GB of 879.6 GB (75.97%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     cgroup_cleaner.pl (2.09 KB)      -rwxr-xr-x
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |

use strict;
use warnings;

use feature 'say';

use Getopt::Long;
use Data::Dumper;

my ($dryrun) = (0, 0);
my $cgdel_bin = '/usr/bin/cgdelete';
my $cgget_bin = '/usr/bin/cgget';

GetOptions(
    "d|dryrun"         => \$dryrun,
    "h|help"           => sub{ usage() },
);

sub usage {
    say << "EOS";
  [About]
    Script will remove cgroups from users that don't exist on the server anymore

  [Usage]
    usage: $0 [--dryrun]

  [Flags]
    -d, --dryrun  - dryrun, doesnt execute removal
    -h, --help    - help! my hand is stuck in the toaster

  [Example]
    Standard Usage:
      $0

EOS

    exit 1;
}

# Load users from passwd
sub GetMachineUsers {
    my %users;
    my $users_cmd = q(awk -F ":" '{if ($3>=1000) print $1, $3 }' /etc/passwd);
    my $dh_users = `$users_cmd`;
    foreach (split /\n/, $dh_users) {
        my ($user, $uid) = split / /, $_;
        next if $user =~ /root|mysql|Gdnscache|Gdnslog|ansible|nobody/;
        $users{$uid} = $user;
    }
    return %users;
}

# find created cgroups
sub GetUserCgroups {
    my @users;
    my $users_cmd = q(find /sys/fs/cgroup/customer/cpu_*/limits/* -type d | cut -d / -f8);
    my $dh_user = `$users_cmd`;
    foreach (split /\n/, $dh_user) {
        push @users, $_;
    }
    return @users;
}

my %users = GetMachineUsers();
my @users = GetUserCgroups();

for my $user (@users) {
    next if grep { $users{$_} eq $user } keys %users;
    say "User $user no longer exists on the server, need to remove the cgroup for them.";
    my $find_cgroups = `find /sys/fs/cgroup/customer/cpu_*/limits/ -iname $user`;
    if ($find_cgroups) {
        $find_cgroups =~ s/\/sys\/fs\/cgroup\///;
        chomp($find_cgroups);
        say $find_cgroups if $find_cgroups;
        my $controllers = `$cgget_bin -n -v -r cgroup.controllers $find_cgroups`;
        chomp($controllers);
        my @active_controllers = split / /, $controllers;
        # this may error out on other control groups as the first cgroup delete may
        # delete the rest of the control cgroups in that pass
        foreach (@active_controllers) {
            say "$cgdel_bin -g $_:$find_cgroups";
            `$cgdel_bin -g $_:$find_cgroups` unless $dryrun;
        }
    } else {
        say "couldnt find cgroup for $user";
    }
}

say "done";

exit 0;

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0182 ]--