Skip to content
This repository was archived by the owner on Sep 23, 2022. It is now read-only.

Commit 3297c66

Browse files
author
nerdofcode
committed
Spring cleaning
1 parent 1a0e4af commit 3297c66

4 files changed

Lines changed: 113 additions & 37 deletions

File tree

mysql_exec.php

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<!Doctype Html>
2+
<?php
3+
session_start();
4+
$status = $_SESSION['status'];
5+
if($status == "1"){
6+
if($_SESSION['logged_in']=="1"){
7+
echo "<p style=\"color:red;\"><b>You are already logged in!!!</b></p>";
8+
$_SESSION['logged_in']="0";
9+
}}else if($status != "1"){
10+
header("Location: /404.php");}
11+
?>
12+
<html>
13+
<head>
14+
<title>Admin Panel</title>
15+
<link rel="stylesheet" type="text/css" href="style.css">
16+
</head>
17+
<body>
18+
<h1 style="text-align: center;">Admin Panel</h1>
19+
<a href="logout.php">Logout</a><hr>
20+
<p>Below is version v.000001 of admin panel by NerdOfCode</p>
21+
<p>You can execute shell commands seperately from Mysql commands</p>
22+
<form action="" name="query" id="query" method="post">
23+
DBNAM: &nbsp;&nbsp;&nbsp;<input type="text" id="mysql_get" name="mysql_get" placeholder="ex: custom" value="<?php echo $_SESSION[udb];?>"></input><br><br>
24+
HOST : &ensp;&ensp;&ensp;<input type="text" id="host" name="host" placeholder="localhost" value="<?php echo $_SESSION['host'];?>"></input><br><br>
25+
USER : &nbsp;&ensp;&ensp;&nbsp;<input type="text" id="username" name="username" value="<?php echo $_SESSION['mysql_user'];?>"></input><br><br>
26+
PASS : &ensp;&nbsp;&ensp;&ensp;<input type="password" id="password" name="password" value="<?php echo $_SESSION['mysql_pass'];?>"></input></br><br>
27+
QUERY: &ensp;&nbsp;&nbsp;<input type="text" id="myquery" name="myquery" placeholder="SELECT * FROM test;" value="<?php echo $_SESSION['query'];?>"></input><br><br>
28+
<button type="Submit" value="Submit">Submit</button>
29+
30+
</form>
31+
32+
</body>
33+
34+
<?php
35+
$udb=$_POST['mysql_get'];//Database
36+
$user=$_POST['username'];
37+
$pass=$_POST['password'];
38+
$query=$_POST['myquery'];//Commands
39+
$host=$_POST['host'];
40+
//Set all current values as session variables below
41+
$_SESSION['saved_info']="1";$_SESSION['udb']="$udb";$_SESSION['mysql_user']="$user";$_SESSION['mysql_pass']="$pass";$_SESSION['query']="$query";$_SESSION['host']="$host";
42+
$db = mysqli_connect($host,$user,$pass,$udb) or die("<p style=\"color:red;\"><b>Error: </b> connection to MySQL failed. Please re-enter information and try again.</p>");
43+
mysqli_query($db, $query) or die("Unable to access MYSQL");
44+
$result = mysqli_query($db, $query);
45+
$row = mysqli_fetch_array($result);
46+
$column=$row['password'];
47+
echo "<b>Query Result: $column</b><br>";
48+
$mysqli_close($db);
49+
?>
50+
</html>

options.php

Lines changed: 5 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
$_SESSION['logged_in']="0";
99
}}else if($status != "1"){
1010
header("Location: /404.php");}
11+
include "user.php";
1112
?>
1213
<html>
1314
<head>
@@ -17,45 +18,12 @@
1718
<body>
1819
<h1 style="text-align: center;">Admin Panel</h1>
1920
<a href="logout.php">Logout</a><hr>
20-
<p>Below is version v.000001 of admin panel by NerdOfCode</p>
21-
<p>You can execute shell commands seperately from Mysql commands</p>
22-
<form action="" name="query" id="query" method="post">
23-
SHELL: &nbsp;&nbsp;&ensp;&nbsp;&nbsp;<input type="text" id="query_box" name="query_box" placeholder="Ex: whoami"></input><br><br>
24-
DBNAM: &nbsp;&nbsp;&nbsp;<input type="text" id="mysql_get" name="mysql_get" placeholder="ex: custom" value="<?php echo $_SESSION[udb];?>"></input><br><br>
25-
HOST : &ensp;&ensp;&ensp;<input type="text" id="host" name="host" placeholder="localhost" value="<?php echo $_SESSION['host'];?>"></input><br><br>
26-
USER : &nbsp;&ensp;&ensp;&nbsp;<input type="text" id="username" name="username" value="<?php echo $_SESSION['mysql_user'];?>"></input><br><br>
27-
PASS : &ensp;&nbsp;&ensp;&ensp;<input type="password" id="password" name="password" value="<?php echo $_SESSION['mysql_pass'];?>"></input></br><br>
28-
QUERY: &ensp;&nbsp;&nbsp;<input type="text" id="myquery" name="myquery" placeholder="SELECT * FROM test;" value="<?php echo $_SESSION['query'];?>"></input><br><br>
29-
<button type="Submit" value="Submit">Submit</button>
30-
31-
</form>
21+
<p>You are currently running version <?php echo $version; ?></p>
22+
<p>Below you will find shortcuts to a number of settings meant to replace SSH</p>
3223

24+
<a href="shell.php"><p class="server">EXECUTE SHELL</p></a>
25+
<a href="mysql_exec.php"><p class="server">EXECUTE MYSQL</p></a>
3326
</body>
3427

35-
<?php
36-
$udb=$_POST['mysql_get'];//Database
37-
$user=$_POST['user'];
38-
$pass=$_POST['pass'];
39-
$query=$_POST['myquery'];//Commands
40-
$host=$_POST['host'];
41-
//Set all current values as session variables below
42-
$_SESSION['saved_info']="1";$_SESSION['udb']="$udb";$_SESSION['mysql_user']="$user";$_SESSION['mysql_pass']="$pass";$_SESSION['query']="$query";$_SESSION['host']="$host";
43-
44-
45-
$db = mysqli_connect($host,$user,$pass,$udb) or die("<p style=\"color:red;\"><b>Error: </b> connection to MySQL failed. Please re-enter information and try again.</p>");
46-
mysqli_query($db, $query) or die("Unable to access MYSQL");
47-
$result = mysqli_query($db, $query);
48-
$row = mysqli_fetch_array($result);
49-
$column=$row['password'];
50-
echo "<b>Query Result: $column</b><br>";
51-
$mysqli_close($db);
52-
53-
$cwd=getcwd();
54-
echo "<br>Current directory: $cwd<br>";
55-
$shell = $_POST['query_box'];
56-
$run = exec("$shell");
57-
echo "<br><b>Output: $run</b><br>";
58-
?>
59-
6028

6129
</html>

shell.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
session_start();
3+
if($_SESSION['status']!="1"){
4+
header("Location: /404.php");
5+
}
6+
?>
7+
<html>
8+
<head>
9+
<title>Admin Panel</title>
10+
<link rel="stylesheet" type="text/css" href="style.css">
11+
</head>
12+
<body>
13+
<h1 style="text-align:center;">Admin Panel</h1>
14+
<a href="logout.php">Logout</a>&ensp;
15+
<a href="options.php">Home</a><hr>
16+
17+
<form action="" name="query" id="query" method="post">
18+
SHELL: &nbsp;&nbsp;&ensp;&nbsp;&nbsp;<input type="text" id="query_box" name="query_box" placeholder="Ex: whoami"></input><br><br>
19+
<button type="Submit" value="Submit">Submit</button>
20+
</form>
21+
<?php
22+
$cwd=getcwd();
23+
echo "<br>Current directory: $cwd<br>";
24+
$shell = $_POST['query_box'];
25+
$run = exec("$shell");
26+
echo "<br><b>Output: $run</b><br>";
27+
?>
28+
</body>
29+
</html>

style.css

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
body {
2+
background-color: #a89aff;;
3+
}
4+
5+
#UID{
6+
text-align: center;;
7+
}
8+
#passwd{
9+
text-align: center;
10+
}
11+
.server{
12+
font-weight: bold;
13+
display: inline-block;
14+
background-color: #ffffff;
15+
width: 100px;
16+
height: 100px;
17+
padding: 20px;
18+
vertical-align: top;
19+
}
20+
.server:hover{
21+
border-style: inset;
22+
margin-top:10px;
23+
cursor: pointer;
24+
width: 150px;
25+
background-color: #9f9595;
26+
27+
28+
}
29+

0 commit comments

Comments
 (0)