-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbladeScan.php
66 lines (62 loc) · 2.07 KB
/
bladeScan.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
<?php
$url = $_GET['ip'];
$hostname = snmpwalk($url, "public", "iso.3.6.1.4.1.232.22.2.4.1.1.1.4");
$serialNo = snmpwalk($url, "public", "iso.3.6.1.4.1.232.22.2.4.1.1.1.16");
$type = snmpwalk($url, "public", "iso.3.6.1.4.1.232.22.2.4.1.1.1.17");
$vc_type = snmpwalk($url, "public", "iso.3.6.1.4.1.232.22.2.6.1.1.1.6");
$vc_sn = snmpwalk($url, "public", "iso.3.6.1.4.1.232.22.2.6.1.1.1.7");
for ($i = 0; $i <= 15; $i++) {
$hostname[$i] = trim(substr($hostname[$i],9),'"');
if ($hostname[$i] == "Unknown") $hostname[$i] = "-----";
}
for ($i = 0; $i <= 15; $i++) {
$serialNo[$i] = trim(substr($serialNo[$i],9),'"');
if ($serialNo[$i] == "Unknown") $serialNo[$i] = "-----";
}
for ($i = 0; $i <= 15; $i++) {
$type[$i] = trim(substr($type[$i],9),'"');
if ($type[$i] == "Unknown") $type[$i] = "-----";
}
for ($i = 0; $i <= 7; $i++) {
$vc_type[$i] = trim(substr($vc_type[$i],9),'"');
if ($vc_type[$i] == "Unknown") $vc_type[$i] = "-----";
}
for ($i = 0; $i <= 7; $i++) {
$vc_sn[$i] = trim(substr($vc_sn[$i],9),'"');
if ($vc_sn[$i] == "Unknown") $vc_sn[$i] = "-----";
}
echo '
<html>
<head><title>SCAN - '.$url.'</title></head>
<body>
<center><h1>SNMP scan of '.$url.'</h1></center>
<table align="center" cellpadding="5" border="2" width="800">
<tr bgcolor="#bbb">
<td width="30">Bay</td><td>Hostname</td><td>Serial no.</td><td>Model</td>
</tr>';
for ($i = 0; $i <= 15; $i++) {
echo '<td>'.($i+1).'</td><td>'.$hostname[$i].'</td><td>'.$serialNo[$i].'</td><td>'.$type[$i].'</td>';
if ($i < 16) {
if ($i % 2 == 0) echo '</tr><tr bgcolor="#ddd">';
else echo '</tr><tr>';
} else {
echo '</tr></table>';
}
}
echo '
<table align="center" cellpadding="5" border="2" width="800">
<tr bgcolor="#bbb">
<td width="30">VC</td><td>Type</td><td>Serial no.</td>
</tr>';
for ($i = 0; $i <= 7; $i++) {
echo '<td>'.($i+1).'</td><td>'.$vc_type[$i].'</td><td>'.$vc_sn[$i].'</td>';
if ($i < 8) {
if ($i % 2 == 0) echo '</tr><tr bgcolor="#ddd">';
else echo '</tr><tr>';
} else {
echo '</tr></table>';
}
}
echo '</br>';
echo '</body></html>';
?>