-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctions.php
155 lines (116 loc) · 4.54 KB
/
functions.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
<?php
session_start();
function includephp() {
foreach (glob('/var/www/html/fessllabs/*.php') as $filename)
{
include $filename;
}
}
function ReadUrl() {
$Url = $_GET['site'];
$file2check = file_get_contents("http://$IP/fessllabs/$Url");
// change $IP with the ip adress or FQDN of your webserver
$attr2check = json_decode($file2check, true);
}
function replace_key($find, $replace, $array) {
$arr = array();
foreach ($array as $key => $value) {
if ($key == $find) {
$arr[$replace] = $value;
} else {
$arr[$key] = $value;
}
}
return $arr;
}
function SessionGet() {
$site = $_SESSION['site'];
$dirP = ('/data/sslscan/scans');
$file2check = file_get_contents("$dirP/$site/latest.json");
$attr2check = json_decode($file2check, true);
$attr2check = $attr2check[0];
}
function Tmenu() {
echo "<div class='title'><center><H2>FE SSL LABS TOOL</H2></center></div>";
echo "<div class='icon-bar'>";
echo "<a class='active' href='index.php'><i class='fa fa-home'></i></a>";
echo "<a href='summary.php'><i class='fa fa-address-card'></i></a>";
echo "<a href='certs.php'><i class='fa fa-chain'></i></a>";
echo "<a href='details.php'><i class='fa fa-cog'></i></a>";
echo "<a href='prots.php'><i class='fa fa-user-secret'></i></a>";
echo "<a href='sims.php'><i class='fa fa-handshake-o'></i></a>";
echo "<a href='raw.php'><i class='fa fa-book'></i></a>";
echo "</div>";
}
function Hgrade() {
$site = $_SESSION['site'];
$dirP = ('/data/sslscan/scans');
$file2check = file_get_contents("$dirP/$site/latest.json");
$attr2checkf = json_decode($file2check, true);
$attr2checkf = $attr2checkf[0];
//print host in header of page
foreach ($attr2checkf as $field => $value) {
if ( $field == 'host' ) {
echo "<div class='host'><p>$value</p></div>";
}
}
foreach ($attr2checkf['endpoints'][0] as $field => $value) {
if ( $field == 'grade') {
if ( $value == 'A-' || $value == 'A' || $value == 'A+' ) {
echo "<div class='rating_g'><p>$value</p></div>";
}
if ( $value == 'B-' || $value == 'B' || $value == 'B+' || $value == 'C-' || $value == 'C' || $value == 'C+') {
echo "<div class='rating_a'><p>$value</p></div>";
}
if ( $value == 'F' || $value == 'T' ) {
echo "<div class='rating_r'><p>$value</p></div>";
}
}
}
foreach ($attr2checkf['endpoints'][0] as $field => $value) {
if ( $field == 'hasWarnings') {
if ( $value =='1' ) {
echo "<div class='warningBox'>";
echo "The SSL configuration contains errors / best practice mismatches";
echo "</div>";
}
}
if ( $field == 'isExceptional') {
if ( $value =='1' ) {
echo "<div class='highlightBox'>";
echo "HTTP Strict Transport Security (HSTS) with long duration deployed on this server.";
echo "</div>";
}
}
}
echo "<div class='infoBox'>";
echo "Visit the <a href='https://www.ssllabs.com/projects/documentation/index.html' rel='noreferrer'>documentation page</a> for more information, configuration guides, and books. Known issues are documented<a href='https://community.qualys.com/docs/DOC-4865'> here</a>";
echo "</div>";
}
//function showWrap1() {
// document.getElementByClassName('wrap1').style.display = 'block';
//}
//function closeWrap1() {
// document.getElementByClassName('wrap1').style.display = 'none';
//}
function TreeView($array, $index = 0)
{
global $tree, $arr_log;
$space = '';
for ($i = 0; $i < $index; $i++) {
$space .= '-';
}
foreach ($array as $folder)
{
$tree .= $space .' '. $folder['dirName'] .'<br />';
if (is_array($folder['children'])) {
$index++;
$arr_log[$folder['dirName']] = $index;
TreeView($folder['children'], $index);
}
if ($arr_log[$folder['dirName']] > 0) {
$index--;
}
}
}
?>