This repository has been archived by the owner on Apr 21, 2018. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
index.php
150 lines (132 loc) · 4.52 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
139
140
141
142
143
144
145
146
147
148
149
150
<?php
include('../../../../wp-load.php' );
if ( !class_exists('SiteInspector') )
include('class-site-inspector.php');
$inspector = new SiteInspector;
if ( isset( $_GET['follow'] ) )
$inspector->follow = $_GET['follow'];
if ( isset ( $_GET['domain'] ) )
$data = $inspector->inspect ( str_replace( 'http:', '', str_replace( '/', '', $_GET['domain'] ) ) );
if ( isset ( $_GET['format'] ) && $_GET['format'] == 'json' ) {
header('Content-type: application/json');
echo json_encode( $data );
exit();
}
function format_records($records) { ?>
<table>
<tr>
<th>Host</th>
<th>Class</th>
<th>Type</th>
<th>TTL</th>
<th>Additional Info</th>
</tr>
<?php
foreach ($records as $record) { ?>
<tr>
<td><?php echo $record['host']; ?></td>
<td><?php echo $record['class']; ?></td>
<td><?php echo $record['type']; ?></td>
<td><?php echo $record['ttl']; ?></td>
<td>
<?php
unset($record['host'], $record['class'], $record['type'], $record['ttl']);
foreach ($record as $field=>$value) {
echo "<strong>$field:</strong> $value<br />";
}
?>
</td>
</tr>
<?php } ?>
</table>
<?php }
?>
<!doctype html>
<html lang="en" class="no-js">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Site Inspector<?php if ( !empty($_GET['domain'] ) ) { ?> | Details for <?php echo $inspector->domain; ?><?php } ?></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="css/style.css?v=2">
</head>
<body>
<div id="container">
<header>
<form id="domain">
<label for="domain">Domain:</label>
http://<input type="text" name="domain" />
<input type="submit" value="Lookup" />
</form>
<?php if ( !empty($_GET['domain'] ) ) { ?>
<h1>Details for <?php echo $inspector->domain; ?> </h1>
Other Formats: <a href="<?php echo add_query_arg('format', 'json'); ?>">json</a>, <a href="https://github.com/benbalter/Site-Inspector">source</a>
</header>
<div id="main" role="main">
<h2>Basic Information</h2>
<ul>
<li><div class="label">Status:</div> <?php echo $inspector->status; ?></li>
<li><div class="label">IPv6 Support:</div> <?php echo ( $inspector->ipv6 ) ? 'Yes' : 'No'; ?></li>
<li><div class="label">Non-WWW Support:</div> <?php echo ( $inspector->nonwww ) ? 'Yes' : 'No'; ?></li>
<li><div class="label">CDN:</div> <?php echo $inspector->cdn; ?></li>
<li><div class="label">Cloud:</div> <?php echo $inspector->cloud; ?></li>
<li><div class="label">Https:</div> <?php echo ( $inspector->https ) ? 'Yes' : 'No'; ?></li>
</ul>
<h2>Software</h2>
<ul>
<li><div class="label">Google Apps:</div> <?php echo $inspector->gapps; ?></li>
<li><div class="label">Server Software:</div> <?php echo $data['server_software']; ?></li>
<li><div class="label">CMS:</div> <?php echo implode(', ', $inspector->cms); ?></li>
<li><div class="label">Analytics:</div> <?php echo implode(', ', $inspector->analytics); ?> </li>
<li><div class="label">JavaScript Libraries:</div> <?php echo implode(', ', $inspector->scripts); ?></li>
</ul>
<h2>Headers</h2>
<ul>
<?php foreach ( $inspector->headers as $k=>$v) { ?>
<li><div class="label"><?php echo $k; ?>:</div> <?php if ( is_array( $v ) ) print_r( $v ); else echo $v; ?></li>
<?php } ?>
</ul>
<?php if ( isset ( $data['redirect'] ) ) { ?>
<h2>Redirects</h2>
<ul>
<?php foreach ( $data['redirect'] as $r) { ?>
<li><div class="label"><?php echo $r['code']; ?>:</div> <?php echo $r['destination']; ?></li>
<?php } ?>
</ul>
<?php } ?>
<h2>DNS Record</h2>
<?php foreach ( $inspector->dns as $domain => $records ) { ?>
<h3><?php echo $domain; ?></h3>
<?php format_records( $records ); ?>
<?php } ?>
<h2>Reverse Lookup</h2>
<table>
<tr>
<th>IP</th>
<th>Hostname</th>
</tr>
<?php
foreach ($inspector->hosts as $ip=>$host) { ?>
<tr>
<td><a href="http://www.bing.com/search?q=ip%3A<?php echo trim( $ip ); ?>"><?php echo $ip; ?></a></td>
<td><?php echo $host; ?></td>
</tr>
<?php } ?>
</table>
<?php } else { ?>
<h1>Site Inspector</h1>
</header>
<div id="main" role="main">
<em>Enter a domain to begin.</em>
<?php } ?>
</div>
</div>
<footer>
</footer>
</div>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
<script>!window.jQuery && document.write(unescape('%3Cscript src="js/libs/jquery-1.5.1.min.js"%3E%3C/script%3E'))</script>
<script src="js/plugins.js"></script>
<script src="js/script.js"></script>
</body>
</html>