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

Commit 1dda240

Browse files
author
nerdofcode
committed
Saved last ran command to mysql database for future use
1 parent a8ab2db commit 1dda240

6 files changed

Lines changed: 16 additions & 10 deletions

File tree

index.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
<?php
4141
include('user.php');
4242
$user_name = $_POST['UID'];
43+
$_SESSION['user']="$user_name";
4344
$user_password = $_POST['passwd'];
4445
$db = mysqli_connect('localhost',$user,$pass,$database) or die("Error connecting to MYSQL");
4546
$query = "SELECT password FROM $table WHERE name = '$user_name'";

mysql.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,9 @@
11
<?php
22
include "user.php";
3+
$user_logged=$_SESSION['user'];
34
$query=$_SESSION['run_seperate'];
45
$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>");
5-
mysqli_query($db, $query) or die("Query failed");
6-
$result = mysqli_query($db, $query);
7-
$row = mysqli_fetch_all($result, MYSQLI_ASSOC);
8-
$stringArray = json_encode($row);
9-
$stringArray = str_replace(",", "<br>", $stringArray);
10-
$stringArray = str_replace(array('[', ']', '}', '"'), "", $stringArray);
11-
$stringArray = str_replace("{", "<br>", $stringArray);
12-
$stringArray = str_replace(":", ": ", $stringArray);
13-
echo $stringArray;
6+
$new_query="UPDATE $table SET commands='$query' WHERE name='$user_logged'";
7+
mysqli_query($db, $new_query);
148
$mysqli_close($db);
159
?>

mysql_exec.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
$_SESSION['logged_in']="0";
99
}}else if($status != "1"){
1010
header("Location: /404.php");}
11+
12+
1113
?>
1214
<html>
1315
<head>
@@ -62,6 +64,9 @@
6264
$stringArray = str_replace(":", ": ", $stringArray);
6365
echo $stringArray;
6466
$mysqli_close($db);
67+
//Set session variable for mysql.php
68+
$_SESSION['run_seperate']="$query";
69+
include 'mysql.php';
6570
}
6671
?>
6772
</html>

options.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@
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+
2729
<p class="footer">Version: <?php echo $version; ?></p>
2830
</body>
2931

php_exec.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
//Run the shell command
2929
$run = eval($shell);
3030
echo "<pre>$run</pre>";
31+
$_SESSION['run_seperate']="$shell";
32+
include 'mysql.php';
3133
}else{
3234
echo "<b>Nothing has been run yet.</b>";
3335
}

shell.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
$run = shell_exec("$shell");
3636
echo "<br><b>Output: </b><br>";
3737
echo "<pre>$run</pre>";
38+
$_SESSION['run_seperate']="$shell";
39+
include "mysql.php";
3840
}else{
3941
echo "<b>Nothing has been run yet.</b>";
4042
}

0 commit comments

Comments
 (0)