Files
zira-etc/cxs/cpanelsuspend.example.pl
2021-05-24 22:18:33 +03:00

51 lines
1.7 KiB
Perl
Executable File

#!/usr/local/cpanel/3rdparty/bin/perl
#******************************************************************************
# Copyright 2009-2016, Way to the Web Limited
# URL: http://www.waytotheweb.com
# Email: sales@waytotheweb.com
#******************************************************************************
# Example cPanel Account Suspend Script when using --all
#
# NOTE: If you intend to use this script, copy it to a different filename as
# this file will be overwritten when cxs upgrades
use strict;
# Set to 1 to have more verbose output
my $verbose = 0;
# Check we have all arguments
if (@ARGV < 4) {print "\ncpanelsuspend.pl: Not enough Args to suspend: @ARGV\n"; exit}
# Check we are running as root
if ($< != 0) {print "\ncpanelsuspend.pl: Not root ($<)\n"; exit}
# Assign arguments to variables
my $filename = $ARGV[0];
my $option = $ARGV[1];
my $message = $ARGV[2];
my $account = $ARGV[3];
# If option is a Virus or Known Exploit
if ($option =~ /v|M$/) {
# if this is definitely a cPanel account
if (-e "/var/cpanel/users/$account") {
# If this account is not already suspended
unless (-e "/var/cpanel/suspended/$account") {
print "\n\ncpanelsuspend.pl: Suspending Account $account...\n";
# Suspend the account
system("/scripts/suspendacct","$account");
print "\n";
} else {if ($verbose) {print "\ncpanelsuspend.pl: Already Suspended\n"}}
} else {if ($verbose) {print "\ncpanelsuspend.pl: Not a cPanel account ($account)\n"}}
} else {if ($verbose) {print "\ncpanelsuspend.pl: Not a suspend option ($option)\n"}}
exit;