This repository has been archived by the owner on Nov 28, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 187
/
Copy pathajax.php
executable file
·48 lines (48 loc) · 1.46 KB
/
ajax.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
<?php
require dirname(__FILE__).'/config.php';
require dirname(__FILE__).'/includes/functions.php';
$ip = (int) $_GET['ip'];
if ($ip > 0):
$db = getPdo();
$q = "SELECT ip as ipaddress, port_id, service, protocol, banner, title FROM data WHERE ip = :ip ORDER BY scanned_ts DESC";
$stmt = $db->prepare($q);
$stmt->bindParam(':ip', $ip, PDO::PARAM_INT);
$stmt->execute();
$results = $stmt->fetchAll();
else:
$results = array();
endif;
if (!empty($results)): ?>
<table class="table table-bordered table-hover">
<thead>
<tr>
<th class="banner">Banner/Title</th>
<th class="port">Port</th>
<th class="service">Service</th>
<th class="protocol">Protocol</th>
</tr>
</thead>
<tbody>
<?php foreach ($results as $k => $r): ?>
<tr>
<td>
<?php if (!empty($r['banner'])):?>
<strong>Banner:</strong> <?php echo htmlentities($r['banner']);?>
<?php endif; ?>
<?php if (!empty($r['title'])):?>
<strong>Title:</strong> <?php echo htmlentities($r['title']);?>
<?php endif; ?>
</td>
<td><?php echo (int) $r['port_id'];?></td>
<td>
<?php if ($r['service'] !== 'title'): echo htmlentities($r['service']); endif;?>
<?php if ($r['service'] == 'http'): ?>
<a href="http://<?php echo long2ip($r['ipaddress']);?>" target="_blank"><i class="glyphicon glyphicon-new-window"></i></a>
<?php endif; ?>
</td>
<td><?php echo htmlentities($r['protocol']);?></td>
</tr>
<?php endforeach; ?>
</table>
<?php
endif;