Created
February 23, 2019 03:03
-
-
Save technicalogical/2ccc4d252b383109f4400b002b460aa6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$runtop = ""; | |
$cpanelUser = ""; | |
$cpanelPhp = ""; | |
$cpanelSsh = ""; | |
$cpanelFtp = ""; | |
if (isset($_GET['runtop'])) { | |
$path = $_SERVER['SCRIPT_FILENAME']; | |
$runtop = shell_exec('ps -A'); | |
} | |
?> | |
<style> | |
/*.card-deck{ | |
position: fixed; | |
left: 50%; | |
-webkit-transform: translate(-50%, -50%); | |
transform: translate(-50%, -50%); | |
}*/ | |
#topCommand{ | |
} | |
} | |
</style> | |
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet" | |
integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"> | |
<div class="jumbotron jumbotron-fluid text-white bg-secondary mb-3"> | |
<div class="container"> | |
<h1 class="display-4">SWAT cPanel Tool</h1> | |
<p class="lead">This tool was designed to help monitor running processes and kill any processes that are using too much of the servers resources.</p> | |
<div class="row"> | |
<div class="col-lg"> | |
<div class="card bg-light text-dark mb-3"> | |
<div class="card-header text-dark">Output:</div> | |
<div class="card-body scroll"> | |
<?php echo "<pre>$runtop</pre>"; | |
?> | |
</div> | |
</div> | |
</div> | |
</div> | |
<div class="container-fluid bg-3 text-center"> | |
<div class="row"> | |
<div class="col-md-4"> | |
</div> | |
<div class="col-md-4"> | |
<form id="frm" method="post" action="?runtop" ><br> | |
<button type="submit" class="btn btn-info">Check Processes</button> | |
</form> | |
</div> | |
</div> | |
</div> | |
</div> | |
</div> | |
<div class="col-md-4"> | |
</div> | |
</div> | |
</div> | |
</div> | |
</div> | |
<div class="container-fluid bg-3 text-center"> | |
<div class="row"> | |
<div class="col-lg-3"> | |
<div class="card-deck"> | |
<div class="card"> | |
<div class="card-header text-dark">Kill All Processes</div> | |
<div class="card-body"> | |
<form method="post" action="?cpanelkillprocs"> | |
**Test User: rjiflbm6ra38 ** <br></br> | |
Pasting in the cPanel username and clicking "Kill All Processes" will kill everything that is running. This will result in a 503 error as the PHP processes are killed. Reload the page by taking off the ?killprocs from the end of the URL. | |
<p> | |
<br> | |
cPanel Username: <input type="text" name="cpanelUserName"><br></br> | |
<button type="submit" class="btn btn-outline-secondary">Kill All Processes</button> | |
</form> | |
</div> | |
</div> | |
</div> | |
</div> | |
<div class="col-lg-3"> | |
<div class="card-deck"> | |
<div class="card"> | |
<div class="card-header text-dark">Kill PHP</div> | |
<div class="card-body"> | |
This buttons kills PHP processes. This will return you to a 503 page as PHP processes were just killed. Refresh the page removing ?killphp and hit enter. <br></br> | |
<form id="frm" method="post" action="?killphp"> | |
<button type="submit" class="btn btn-outline-secondary">Kill PHP Processes</button> | |
</form> | |
</div> | |
</div> | |
</div> | |
</div> | |
<div class="col-lg-3"> | |
<div class="card-deck"> | |
<div class="card"> | |
<div class="card-header text-dark">Kill SSH</div> | |
<div class="card-body"> This button kills any running SSH processes. <br> </br> | |
<form method="post" action="?killssh"> | |
<button type="submit" class="btn btn-outline-secondary">Kill SSH Processes</button> | |
</form> | |
</div> | |
</div> | |
</div> | |
</div> | |
<div class="col-lg-3"> | |
<div class="card-deck"> | |
<div class="card"> | |
<div class="card-header text-dark">Kill FTP and sFTP Processes</div> | |
<div class="card-body"> This button kills any running FTP or sFTP connections. <br> </br> | |
<form method="post" action="?killftp"> | |
<button type="submit" class="btn btn-outline-secondary">Kill FTP and sFTP Processes</button> | |
</form> | |
</div> | |
</div> | |
</div> | |
</div> | |
</div> | |
</div> | |
<?php | |
if (isset($_GET['cpanelkillprocs'])) | |
$cpanelUser = $_POST[cpanelUserName]; | |
echo `pkill -U $cpanelUser`; | |
if (isset($_GET['killphp'])) | |
$cpanelPhp = shell_exec ('pkill lsphp'); | |
if (isset($_GET['killssh'])) | |
$cpanelSsh = shell_exec('pkill sshd'); | |
if (isset($_GET['killftp'])) | |
$cpanelFtp = shell_exec('pkill pure-ftpd | pkill sftp-server'); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment