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

Commit d6fa61f

Browse files
author
NerdOfLinux
committed
Merge branch 'master' of github.com:NerdOfCode/admin-panel
2 parents 52132af + 39616d7 commit d6fa61f

10 files changed

Lines changed: 108 additions & 44 deletions

File tree

404.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<?php
22
session_start();
33
if($_SESSION['status']=="1"){
4-
header("Location: /options.php");
4+
header("Location: /options/php");
55
$_SESSION['logged_in']="1";
66
}
77
$ip=$_SERVER['REMOTE_ADDR'];
8-
echo "The file you tried to access is protected and you dont have permission to view it... <br>";
9-
echo "Your IP has been reported: <b>$ip<b>";
8+
echo "The file you have tried to access is top secret and unfortuantely you do not have the clearance to access it...";
9+
echo "Your IP has been reported: <b>$ip</b>";
1010

1111
?>

README.md

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,41 @@
11
# admin-panel
2-
This is a very sucky admin panel that is in pre-pre-pre-pre-pre-pre-pre-pre-alpha stages. So far it can run shell commands, and basic MySQL queries. It has a simple UI, and the passwords in the database are now hashed, as opposed to the plaintext they used to be.
2+
This is a brand new admin panel that is currently in alpha stages. As of now, the panel can run shell commands, basic MySQL queries, and simple PHP commands. This panel has a very simple UI, and the passwords in the database are hashed.
33

4-
## Set-Up
4+
## To Set-Up, follow steps below:
55

6-
First create a MySQL database by running:
6+
First clone the repository into your web server's document root directory, then run:
7+
8+
`git clone [email protected]:NerdOfCode/admin-panel.git`
9+
10+
11+
Then to set a user up, create a MySQL database by running:
712

813
```MySQL
914
CREATE DATABASE database_name_goes_here;
1015
```
1116

12-
To set it up, create a MySQL table, with the fields `name` and `password`, to do so run:
17+
Then switch over to it by running:
18+
19+
```MySQL
20+
USE database_name_goes_here;
21+
```
22+
23+
To set the table up, create a MySQL table with the fields `name` and `password`, to do so run:
1324

1425
```MySQL
15-
CREATE TABLE users(name VARCHAR(30) NOT NULL, password VARCHAR(256) NOT NULL);
26+
CREATE TABLE users(name VARCHAR(30) NOT NULL, password VARCHAR(256) NOT NULL, commands VARCHAR(128));
1627
```
17-
Then put your desired username in the `name` field, and the password in the `password` field.
28+
Then put your desired username in the `name` field, and the password in the `password` field, to do so run:
29+
```MySQL
30+
INSERT INTO users VALUES("user_here","password goes here","");
31+
```
32+
33+
<b>NOTICE<b>
1834
The password must be PHP hashed, to do so, run:
1935

2036
```shell
2137
php -r 'echo password_hash("password", PASSWORD_DEFAULT);'; echo ""
2238
```
23-
on a LAMP install, make sure to put this password back in the MySQL table...
39+
MAKE SURE to put this password back in the MySQL table...
2440

2541
Finally, change the values in the <b>user.php</b> file to match your own.

index.php

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,53 +6,54 @@
66
header("Location: /options.php");
77
$_SESSION['logged_in']="1";
88
}
9-
10-
11-
129
?>
1310
<html>
1411
<head>
1512
<title>Admin Panel</title>
1613
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
17-
<link rel="stylesheet" type="text/css" href="style.css">
14+
<link rel="stylesheet" type="text/css" href="newstyle.css">
1815
</head>
1916
<body>
2017
<h1 style="text-align:center;">Admin Panel</h1><hr>
21-
<form name="form" id="form" action="" method="post" >
18+
<form name="index" id="index" action="" method="post">
2219
Username:&ensp;<input type="text" name="UID" id="UID" required><br><br>
2320
Password:&ensp;<input type="password" name="passwd" id="passwd" required><br><br>
24-
<input type="submit" value="Submit" onClick="">
21+
<input type="submit" value="Submit" onClick=""">
2522
</form>
2623

2724
<script>
2825
$(document).ready(function(){
2926
$('#form').submit(function(){
30-
$('#UID').fadeOut();
31-
$('#passwd').fadeOut();
27+
$('#UID').fadeOut(500);
28+
$('#passwd').fadeOut(500);
3229
})
33-
3430
});
31+
32+
var input = document.getElementById('UID');
33+
input.focus();
34+
input.select();
35+
3536
</script>
36-
37+
<p class="footer">By: <a href="https://github.com/NerdOfCode" target="_blank"><b>NerdOf</b>Code</a>, <a href="https://github.com/NerdOfLinux" target="_blank"><b>NerdOf</b>Linux</a> | <a href="https://github.com/NerdOfCode/admin-panel/blob/master/LICENSE">License</a></p>
3738
</body>
3839

3940
<?php
4041
include('user.php');
4142
$user_name = $_POST['UID'];
43+
$_SESSION['user']="$user_name";
4244
$user_password = $_POST['passwd'];
4345
$db = mysqli_connect('localhost',$user,$pass,$database) or die("Error connecting to MYSQL");
4446
$query = "SELECT password FROM $table WHERE name = '$user_name'";
45-
mysqli_query($db, $query) or die("Unable to access MYSQL");
47+
mysqli_query($db, $query) or die("<p class=\"text-align:center;\">Unable to access MYSQL</p>");
4648
$result = mysqli_query($db, $query);
4749
$row = mysqli_fetch_array($result);
4850
$password=$row['password'];
4951
if(password_verify($_POST['passwd'], $password)){
5052
$_SESSION['status'] = "1";
5153
header("Location: /options.php");
5254
die();
53-
}else{
54-
echo "An error has occured... Please try again later";
55-
$_SESSION['status'] = "0";
55+
}else if(!empty($user_name)){
56+
echo "<p class=\"false\" style=\"color:red;text-align:center;\">INVALID</p>";
5657
}
5758
mysqli_close($db);
5859

mysql.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
include "user.php";
3+
$user_logged=$_SESSION['user'];
4+
$query=$_SESSION['run_seperate'];
5+
$db = mysqli_connect('localhost',$user,$pass,$database) or die("<p style=\"color:red;\"><b>Error: </b> connection to MySQL failed. Please re-enter information and try again.</p>");
6+
$new_query="UPDATE $table SET commands='$query' WHERE name='$user_logged'";
7+
mysqli_query($db, $new_query);
8+
$mysqli_close($db);
9+
?>

mysql_exec.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,19 @@
88
$_SESSION['logged_in']="0";
99
}}else if($status != "1"){
1010
header("Location: /404.php");}
11+
12+
1113
?>
1214
<html>
1315
<head>
1416
<title>Admin Panel</title>
15-
<link rel="stylesheet" type="text/css" href="style.css">
17+
<link rel="stylesheet" type="text/css" href="newstyle.css">
18+
<meta HTTP-EQUIV="refresh" CONTENT="300;URL=logout.php">
1619
</head>
1720
<body>
1821
<h1 style="text-align: center;">Admin Panel</h1>
1922
<a href="logout.php">Logout</a>&ensp;
2023
<a href="options.php">Home</a><hr>
21-
<p>Below is version v.000001 of admin panel by NerdOfCode</p>
2224
<p>You can execute shell commands seperately from Mysql commands</p>
2325
<form action="" name="query" id="query" method="post">
2426
DBNAM: &nbsp;&nbsp;&nbsp;<input type="text" id="mysql_get" name="mysql_get" placeholder="ex: custom" value="<?php echo $_SESSION[udb];?>"></input><br><br>
@@ -29,7 +31,11 @@
2931
<button type="Submit" value="Submit">Submit</button>
3032

3133
</form>
32-
34+
<script>
35+
var input = document.getElementById('mysql_get');
36+
input.focus();
37+
input.select();
38+
</script>
3339
</body>
3440

3541
<?php
@@ -57,6 +63,9 @@
5763
$stringArray = str_replace(":", ": ", $stringArray);
5864
echo $stringArray;
5965
$mysqli_close($db);
66+
//Set session variable for mysql.php
67+
$_SESSION['run_seperate']="$query";
68+
include 'mysql.php';
6069
}
6170
?>
6271
</html>
Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
body {
2-
background-color: #a89aff;;
2+
background-color: #c6e2ff;
33
}
44

5-
#UID{
6-
text-align: center;;
7-
}
8-
#passwd{
9-
text-align: center;
5+
6+
#index{
7+
width: 200px;
8+
margin: auto;
9+
1010
}
11+
12+
1113
.server{
1214
font-weight: bold;
1315
display: inline-block;
@@ -23,7 +25,11 @@ body {
2325
cursor: pointer;
2426
width: 150px;
2527
background-color: #9f9595;
26-
27-
2828
}
29-
29+
.footer{
30+
position: absolute;
31+
bottom:0;
32+
left: 0;
33+
right: 0;
34+
text-align:center;
35+
}

options.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,20 @@
1313
<html>
1414
<head>
1515
<title>Admin Panel</title>
16-
<link rel="stylesheet" type="text/css" href="style.css">
16+
<link rel="stylesheet" type="text/css" href="newstyle.css">
17+
<meta HTTP-EQUIV="refresh" CONTENT="300;URL=logout.php">
1718
</head>
1819
<body>
1920
<h1 style="text-align: center;">Admin Panel</h1>
2021
<a href="logout.php">Logout</a><hr>
21-
<p>You are currently running version <?php echo $version; ?></p>
2222
<p>Below you will find shortcuts to a number of settings meant to replace SSH</p>
2323

2424
<a href="shell.php"><p class="server">EXECUTE SHELL</p></a>
2525
<a href="mysql_exec.php"><p class="server">EXECUTE MYSQL</p></a>
26-
<a href="php_exec.php"><p class="server">EXECUTE PHP</p></a>
26+
<a href="php_exec.php"><p class="server">EXECUTE PHP</p></a><br><br>
27+
28+
29+
<p class="footer">Version: <?php echo $version; ?></p>
2730
</body>
2831

2932

php_exec.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
<html>
88
<head>
99
<title>Admin Panel</title>
10-
<link rel="stylesheet" type="text/css" href="style.css">
10+
<link rel="stylesheet" type="text/css" href="newstyle.css">
11+
<meta HTTP-EQUIV="refresh" CONTENT="300;URL=logout.php">
1112
</head>
1213
<body>
1314
<h1 style="text-align:center;">Admin Panel</h1>
@@ -27,9 +28,16 @@
2728
//Run the shell command
2829
$run = eval($shell);
2930
echo "<pre>$run</pre>";
31+
$_SESSION['run_seperate']="$shell";
32+
include 'mysql.php';
3033
}else{
3134
echo "<b>Nothing has been run yet.</b>";
3235
}
33-
?>
36+
?>
37+
<script>
38+
var input = document.getElementById('query_box');
39+
input.focus();
40+
input.select();
41+
</script>
3442
</body>
3543
</html>

shell.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,33 @@
1+
12
<?php
23
session_start();
34
if($_SESSION['status']!="1"){
45
header("Location: /404.php");
56
}
67
?>
8+
<!-- NerdOfCode -->
79
<html>
810
<head>
911
<title>Admin Panel</title>
10-
<link rel="stylesheet" type="text/css" href="style.css">
12+
<link rel="stylesheet" type="text/css" href="newstyle.css">
13+
<meta HTTP-EQUIV="refresh" CONTENT="300;URL=logout.php">
1114
</head>
1215
<body>
1316
<h1 style="text-align:center;">Admin Panel</h1>
1417
<a href="logout.php">Logout</a>&ensp;
1518
<a href="options.php">Home</a><hr>
1619

17-
<form action="" name="query" id="query" method="post">
20+
<form action="" name="query" id="query" method="post" >
1821
SHELL: &nbsp;&nbsp;&ensp;&nbsp;&nbsp;<input type="text" id="query_box" name="query_box" placeholder="Ex: whoami"></input><br><br>
1922
<button type="Submit" value="Submit">Submit</button>
2023
</form>
24+
<script>
25+
var input = document.getElementById('query_box');
26+
input.focus();
27+
input.select();
28+
</script>
29+
30+
2131
<?php
2232
$cwd=getcwd();
2333
echo "<br>Current directory: $cwd<br>";
@@ -27,6 +37,8 @@
2737
$run = shell_exec("$shell");
2838
echo "<br><b>Output: </b><br>";
2939
echo "<pre>$run</pre>";
40+
$_SESSION['run_seperate']="$shell";
41+
include "mysql.php";
3042
}else{
3143
echo "<b>Nothing has been run yet.</b>";
3244
}

user.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
$table="";
77

88
//Dont edit below here
9-
$version=".00001 alpha";
9+
$version="<b>0.00001 alpha<b>";
1010
?>
1111

1212

0 commit comments

Comments
 (0)