-
Notifications
You must be signed in to change notification settings - Fork 1
/
view_page.php
193 lines (166 loc) · 8.31 KB
/
view_page.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
<?php
// Project SyPUM - Systems Package Update Management
//
//
// Author: Peter Malaty - 12/20/2016 All Rights Reserved
//
// Copyright 2016 Peter G.F Malaty - [email protected]
// This file is part of MAN Spider is distributed under the terms of the GNU General Public License
/*
SyPUM - Systems Package Update Management is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
SyPUM - Systems Package Update Management is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Foobar. If not, see <http://www.gnu.org/licenses/>.
*/
require_once 'inc/stdhead.php';
require_once('inc/db.php');
$dblink=db_connect();
$servername=mysqli_real_escape_string($dblink,$_GET['servername']);
$Action=mysqli_real_escape_string($dblink,$_GET['action']);
$Ubureleasever=mysqli_real_escape_string($dblink,$_GET['ubureleasever']);
$Packagename=mysqli_real_escape_string($dblink,$_GET['packagename']);
$pktype=mysqli_real_escape_string($dblink,$_GET['pktype']);
//echo "<h1>Host $servername</h1>";
if($Action == 'viewallpkgs'){
echo "<div class='contentbox'>\n";
echo "<h2>List of Pkgs to be updated on $servername</h2>";
echo "<div class='content'>\n";
$dbquery = "SELECT packagename,oldpackageversion,newpackageversion,shortdesc FROM packages where hostname='$servername' AND packtype='bug';";
$dbresult = mysqli_query($dblink, $dbquery);
$dbquery2 = "select packagename,oldpackageversion,newpackageversion,shortdesc from packages where hostname='$servername' AND packtype='sec';";
$dbresult2 = mysqli_query($dblink, $dbquery2);
$tmparr1=array();
while ($row2 = mysqli_fetch_object($dbresult)) {
$entry=$row2->packagename . "@@@" . $row2->oldpackageversion . "@@@" . $row2->newpackageversion . "@@@" . $row2->shortdesc;
if(!in_array($entry,$tmparr1)) $tmparr1[]=$entry; else continue;
}
while ($row2 = mysqli_fetch_object($dbresult2)) {
$entry=$row2->packagename . "@@@" . $row2->oldpackageversion . "@@@" . $row2->newpackageversion . "@@@" . $row2->shortdesc;
if(!in_array($entry,$tmparr1)) $tmparr1[]=$entry; else continue;
}
sort($tmparr1);
echo "<table>\n";
echo "<tr><td>Package</td><td>Curr Ver</td><td>Latest Ver</td><td>Is Sec pkg?</td><td>Short Desc</td></tr><br/>\n";
if (($dbresult && mysqli_num_rows($dbresult)) || ($dbresult2 && mysqli_num_rows($dbresult2))) {
foreach($tmparr1 as $apackage){
$tmp999=explode('@@@',$apackage);
$Packname=$tmp999[0];
$Packvername=$tmp999[1];
$NewPackvername=$tmp999[2];
$Shortdesc=$tmp999[3];
$dbquery9 = "select packagename from packages where hostname='$servername' and packagename='$Packname' and packtype='sec'";
$dbresult9 = mysqli_query($dblink, $dbquery9);
$tmp9=mysqli_fetch_row($dbresult9);
if (count($tmp9) > 0) $security='yes'; else $security='no';
if($security == 'yes'){
echo "<tr><td>$Packname</td><td>$Packvername</td><td>$NewPackvername</td><td>Yes</td><td>$Shortdesc</td></tr>\n";
}else{
echo "<tr><td>$Packname</td><td>$Packvername</td><td>$NewPackvername</td><td>No</td><td>$Shortdesc</td></tr>\n";
}
}
}
else {
echo "No Packages here to display\n";
}
echo"</table>";
echo "</div>\n";
echo "</div>\n";
}
if($Action == 'viewsecerrata'){
echo "<div class='contentbox'>\n";
echo "<h2>List of Errata for host $servername</h2>";
echo "<div class='content'>\n";
$uburel_tmp=explode('.',$Ubureleasever);
$uburel=$uburel_tmp[0];
$dbquery = "select ss.newpackageversion,ss.oldpackageversion,ubp.details,ubp.swdesc,ubp.packagename,ubp.packagever from ubparser as ubp LEFT JOIN packages as ss ON ss.packagename=ubp.packagename where ss.hostname='$servername' and ubp.releasever like 'Ubuntu $Ubureleasever%' and ubp.packagever = ss.newpackageversion order by ubp.packagename ASC;";
$dbresult = mysqli_query($dblink, $dbquery);
echo "<table>\n";
echo "<tr><td>Package</td><td>Curr Ver</td><td>latest Ver</td><td>Short Desc</td><td>Details</td></tr><br/>\n";
if ($dbresult && mysqli_num_rows($dbresult)) {
while ($row = mysqli_fetch_object($dbresult)) {
echo "<tr><td>$row->packagename</td><td>$row->oldpackageversion</td><td>$row->packagever</td><td>$row->swdesc</td><td>$row->details</td></tr>\n";
// echo "<tr><td>$row->packagename</td><td>$row->oldpackageversion</td><td>$row->newpackageversion</td><td>$row->swdesc</td><td>$row->details</td></tr>\n";
}
}
else {
echo "Either No security packages available for this host, or No security errata found...\n";
}
echo"</table>";
echo "</div>\n";
echo "</div>\n";
}
if($Action == 'transactionlog'){
echo "<div class='contentbox'>\n";
echo "<h2>Transaction Logs for host $servername</h2>";
echo "<div class='content'>\n";
$dbquery = "SELECT datelog FROM systemstransactionlogs where hostname='$servername' order by datelog DESC";
$dbresult = mysqli_query($dblink, $dbquery);
echo "<table>\n";
echo "<tr><td>Transaction Date/time</td><td>View</td></tr><br/>\n";
if ($dbresult && mysqli_num_rows($dbresult)) {
while ($row = mysqli_fetch_object($dbresult)) {
echo "<tr><td>$row->datelog</td>";
echo "<td><a class='red button' href='view_page.php?action=viewtranslogdate&servername=$servername&transdate=$row->datelog'>View Trans Log</a></td></tr>\n";
}
}
else {
echo "No Transactions found ... Make some \n";
}
echo"</table>";
echo "</div>\n";
echo "</div>\n";
}
if($Action == 'viewtranslogdate'){
if(isset($_GET['transdate'])) $transDate=$_GET['transdate'];
echo "<div class='contentboxpeter'>\n";
echo "<h2>Logs for $transDate on host $servername</h2>";
echo "<div class='content'>\n";
$dbquery = "SELECT transactionlog FROM systemstransactionlogs where hostname='$servername' and datelog='$transDate'";
$dbresult = mysqli_query($dblink, $dbquery);
if(!$dbresult) echo "Error ..." . mysqli_error($dblink) . "\n";
echo "<table>\n";
echo "<tr><td>Log $transDate</td></tr><br/>\n";
if ($dbresult && mysqli_num_rows($dbresult)) {
while ($row = mysqli_fetch_object($dbresult)) {
// echo "<tr><td>$row->transactionlog</td></tr>\n";
echo $row->transactionlog . "\n";
}
}
else {
echo "No Transactions found yet...\n";
}
echo"</table>";
echo "</div>\n";
echo "</div>\n";
}
if($Action == 'viewsrvspkg'){
echo "<div class='contentbox'>\n";
echo "<h2>List of Servers affected by $Packagename</h2>";
echo "<div class='content'>\n";
$uburel_tmp=explode('.',$Ubureleasever);
$uburel=$uburel_tmp[0];
$dbquery = "select hostname,oldpackageversion from packages where packagename='$Packagename' and packtype='$pktype' group by hostname ASC;";
$dbresult = mysqli_query($dblink, $dbquery);
echo "<table>\n";
echo "<tr><td>Server</td><td>Curr Ver</td></tr><br/>\n";
if ($dbresult && mysqli_num_rows($dbresult)) {
while ($row = mysqli_fetch_object($dbresult)) {
echo "<tr><td>$row->hostname</td><td>$row->oldpackageversion</td></tr>\n";
// echo "<tr><td>$row->packagename</td><td>$row->oldpackageversion</td><td>$row->newpackageversion</td><td>$row->swdesc</td><td>$row->details</td></tr>\n";
}
}
else {
echo "Either No security packages available for this host, or No security errata found...\n";
}
echo"</table>";
echo "</div>\n";
echo "</div>\n";
}
require_once 'inc/stdfoot.php';
?>