forked from interference-security/empire-web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
search-module.php
115 lines (114 loc) · 5.33 KB
/
search-module.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<?php
// include files
require_once("includes/check-authorize.php");
require_once("includes/functions.php");
$count = 0;
$empire_module = "";
if(isset($_GET['search_module']))
{
$search_module = urldecode($_GET['search_module']);
$arr_result = search_module($sess_ip, $sess_port, $sess_token, $search_module);
if(!empty($arr_result))
{
if(array_key_exists("modules", $arr_result))
{
if(sizeof($arr_result["modules"])>0)
{
for($i=0; $i<sizeof($arr_result["modules"]); $i++)
{
$empire_module .= "<div class='panel-group'><div class='panel panel-success'>
<div class='panel-heading'><h4 class='panel-title'><a data-toggle='collapse' href='#collapse$i'>Module Name: ".htmlentities($arr_result["modules"][$i]["Name"])."</a> <a href='execute-module.php?module_name=".htmlentities($arr_result["modules"][$i]["Name"])."' role='button' class='btn btn-xs btn-primary' style='color:white;'>Use Module</a></h4></div>
<div id='collapse$i' class='panel-collapse collapse'>
<div class='panel-body'>";
$empire_module .= "<table class='table table-hover table-striped table-bordered'>";
foreach($arr_result["modules"][$i] as $key => $value)
{
if($key != "options")
{
$key = htmlentities($key);
$value = (is_array($value) ? htmlentities(implode(', ', $value)) : $value);
if(is_bool($value))
{
if($value == True)
$value = "Yes";
else
$value = "No";
}
elseif(is_null($value))
{
$value = "Null";
}
else
{
$value = htmlentities($value);
}
$empire_module .= "<tr><th>$key</th><td>$value</td></tr>";
}
}
$empire_module .= "</table>";
$empire_module .= "<table class='table table-hover table-striped table-bordered'><thead><tr><th colspan='4'>Module Options:</th></tr><th>Name</th><th>Description</th><th>Required</th><th>Value</th></tr></thead><tbody>";
foreach($arr_result["modules"][$i]["options"] as $key => $value)
{
$key = htmlentities($key);
$desc = htmlentities($value["Description"]);
$reqd = (htmlentities($value["Required"]) ? "Yes" : "No");
$val = htmlentities($value["Value"]);
$empire_module .= "<tr>";
$empire_module .= "<td>$key</td><td>$desc</td><td>$reqd</td><td>$val</td>";
$empire_module .= "</tr>";
}
$empire_module .= '</tbody></table>';
$empire_module .= "</div></div></div></div><br>";
$count = $i+1;
}
}
else
{
$empire_module = "<div class='alert alert-danger'><span class='glyphicon glyphicon-remove'></span> No module found.</div>";
}
}
elseif(array_key_exists("error", $arr_result))
{
$empire_module = "<div class='alert alert-danger'><span class='glyphicon glyphicon-remove'></span> ".ucfirst(htmlentities($arr_result["error"]))."</div>";
}
else
{
$empire_module = "<div class='alert alert-danger'><span class='glyphicon glyphicon-remove'></span> Unexpected response.</div>";
}
}
else
{
$empire_module = "<div class='alert alert-danger'><span class='glyphicon glyphicon-remove'></span> Unexpected response.</div>";
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Empire: Search Module</title>
<?php @require_once("includes/head-section.php"); ?>
</head>
<body>
<div class="container">
<?php @require_once("includes/navbar.php"); ?>
<br>
<div class="panel-group">
<div class="panel panel-primary">
<div class="panel-heading"><span class='glyphicon glyphicon-search'></span> Search for Module (<?php echo $count; ?>)</div>
<div class="panel-body">
<form role="form" method="get" action="search-module.php" class="form-inline">
Searches all module fields for the given term.<br><br>
<div class="form-group">
<input type="text" class="form-control" id="search-module" placeholder="Enter search term" name="search_module">
</div>
<button type="submit" class="btn btn-success">Search</button>
</form>
<br>
<?php echo $empire_module; ?>
</div>
</div>
</div><br>
</div>
<?php @require_once("includes/footer.php"); ?>
</body>
</html>