-
Notifications
You must be signed in to change notification settings - Fork 1
/
viewdb.php
205 lines (154 loc) · 5.18 KB
/
viewdb.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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="NessusParser">
<meta name="author" content="svelizd">
<title>Nessus Consolidator</title>
<!-- Bootstrap core CSS -->
<link href="vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link href="css/dataTables.bootstrap4.min.css" rel="stylesheet">
<!-- Bootstrap core JavaScript -->
<script src="vendor/jquery-3.4.1.js"></script>
<script src="vendor/jquery.dataTables.min.js"></script>
<script src="vendor/dataTables.bootstrap4.min.js"></script>
<script src="vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
<script>
$(document).ready(function() {
var table = $('#example').DataTable( {
"lengthMenu": [[5,10, 25, 50, 100, -1], [5,10, 25, 50, 100, "All"]],
scrollX: true,
scrollCollapse: true,
autoWidth: false,
paging: true,
columnDefs: [{
orderable: false
}],
order: [[9, 'desc']]
} );
} );
</script>
</head>
<body>
<!-- Navigation -->
<nav class="navbar navbar-expand-lg navbar-dark bg-dark static-top">
<div class="container">
<a class="navbar-brand" href="#">Nessus Consolidator</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarResponsive">
<ul class="navbar-nav ml-auto">
<li class="nav-item active">
<a class="nav-link" href="index.php">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#" data-toggle="modal" data-target=".bd-example-modal-lg">About</a>
</li>
</ul>
</div>
</div>
</nav>
<div class="container-fluid">
<div class="col-md-12">
<?php
if ((isset($_GET['code']) && !empty($_GET['code'])) ){
$code = htmlentities($_GET['code']);
$table = "vuln";
$filename ="db/".$code.".db";
class MyDB extends SQLite3
{
function __construct($filename)
{
$this->open($filename);
}
}
$db = new MyDB($filename);
if(!$db){
echo "The database could not be opened!<BR />";
exit();
}
$tablesquery = $db->query("PRAGMA table_info(" . $table . ");");
$numCol = 0;
while($column = $tablesquery->fetchArray(SQLITE3_ASSOC)){
$numCol = $numCol+1;
};
echo "<div class='container table-responsive '>";
echo "<br><br>";
echo '<table id="example" class="table table-striped table-bordered nowrap" cellspacing="0" width="100%">' . PHP_EOL;
echo '<thead><tr>' . PHP_EOL;
while ($nomCol = $tablesquery->fetchArray(SQLITE3_ASSOC)) {
echo '<th>' . $nomCol['name'] . '</th>';
}
echo '</tr></thead>' . PHP_EOL;
echo "<tbody style='color:#FFFFFF;'>";
$querycon ="SELECT * FROM vuln ORDER BY cvss_base_score desc;";
$ret = $db->query($querycon);
while($row = $ret->fetchArray(SQLITE3_ASSOC)){
echo "<TR>";
while ($nmeCol = $tablesquery->fetchArray(SQLITE3_ASSOC)){
$risk = $row['risk'];
$riesgo = "";
if($risk=="Critical"){
$riesgo = "#D43F3A";
}
if($risk =="High"){
$riesgo = "#EE9336";
}
if($risk =="Medium"){
$riesgo = "#FDC431";
}
if($risk =="Low"){
$riesgo = "#3FAE49";
}
if($risk =="None"){
$riesgo = "#0071B9";
}
echo '<TD bgcolor="'.$riesgo .'">' . $row[$nmeCol['name']] . '</TD>';
}
echo "</TR>";
}
echo '</tbody>';
echo '<tfoot><tr>' . PHP_EOL;
while ($nomCol = $tablesquery->fetchArray(SQLITE3_ASSOC)) {
echo '<th>' . $nomCol['name'] . '</th>';
}
echo '</tr></tfoot>' . PHP_EOL;
echo '</table>' . PHP_EOL;
echo "</div>";
echo "<br><br>";
$db->close();
}
?>
</div>
</div>
<br><br><br><br><br><br><br><br><br><br>
<footer class="page-footer font-small mdb-color darken-3 pt-4">
<!-- Copyright -->
<div class="footer-copyright text-center py-3">© 2019 Copyright:
<a href="https://github.com/SVelizDonoso"> Developer svelizdonoso</a>
</div>
<!-- Copyright -->
</footer>
<!-- Footer -->
<div class="modal fade bd-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">About</h5>
</div>
<div class="modal-body">
<table class='table table-bordered ' >
<tr><td>Version:</td><td>Nessus Consolidator 1.0</td></tr>
<tr><td>Year:</td><td>2019</td></tr>
<tr><td>Developer:</td><td><a href="https://github.com/SVelizDonoso">svelizdonodo</a></td></tr>
<tr><td>LICENSE</td><td>GNU General Public License v3.0</td></tr>
</table>
</div>
<br><br>
</div>
</div>
</div>
</body>
</html>