-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
138 lines (127 loc) · 4.14 KB
/
index.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
<?php
require_once 'functions/functions.php';
require_once 'classes/SigmxScanner.php';
$path_empty = false;
$path_valid = true;
$scan_result = false;
const SIGMX_ROOT_PATH = __DIR__;
define('WP_ROOT_PATH', dirname(SIGMX_ROOT_PATH));
/**
* Stage: 1
* Get file/directory path
*/
if (empty($_POST['path']) && isset($_POST['submit'])) {
$path_empty = true;
}
/**
* Stage: 2
* Checking path
*/
if (!empty($_POST['path'])) {
$path_valid = sigmx__path_validation($_POST['path']);
}
/**
* Stage: 3
* Start signature scanner
*/
if ($path_valid && isset($_POST['submit'])) {
$sigmx_scanner = new SigmxScanner($_POST['path']);
$scan_result = $sigmx_scanner->getResult();
}
$signatures_result = SigmxScanner::getAllSignatureResult();
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="css/bootstrap.min.css">
<title>Sugnature Metrix</title>
</head>
<body>
<div class="container">
<h1 class="mb-5">Signature Metrix</h1>
<form class="row g-3 mb-5" action="/signature-metrix/" method="post">
<div class="col-md-6">
<label for="path" class="form-label">File/Directory Path</label>
<input type="text" class="form-control" id="path" name="path" placeholder="/dir/file.php">
</div>
<div class="col-12">
<button type="submit" class="btn btn-primary" name="submit" value="1">Start</button>
</div>
</form>
<?php
if ($path_empty) {
?>
<div class="alert alert-primary" role="alert">
Path empty, fill the path
</div>
<?php
}
if (!$path_valid) {
?>
<div class="alert alert-primary" role="alert">
File or Directory not exists
</div>
<?php
}
if ($scan_result) {
?>
<table class="table">
<thead>
<tr>
<th scope="col">Path</th>
<th scope="col">Size (kb)</th>
<th scope="col">Status</th>
<th scope="col">Signatures Found</th>
<th scope="col">Processing Time (ms)</th>
</tr>
</thead>
<tbody>
<?php
foreach ($scan_result as $row) {
?>
<tr>
<td scope="row"><?= $row['path']; ?></td>
<td><?= $row['size']; ?></td>
<td><?= $row['status']; ?></td>
<td><?= $row['signatures_found']; ?></td>
<td><?= $row['signatures_check_time']; ?></td>
</tr>
<?php
}
?>
</tbody>
</table>
<?php
}
if ($signatures_result) {
?>
<table class="table">
<thead>
<tr>
<th scope="col">Name</th>
<th scope="col">Working Time</th>
</tr>
</thead>
<tbody>
<?php
foreach ($signatures_result as $name => $time) {
?>
<tr>
<td><?= $name; ?></td>
<td><?= $time['working_time']; ?></td>
</tr>
<?php
}
?>
</tbody>
</table>
<?php
}
?>
</div>
</body>
</html>