watchyourlan/internal/web/templates/host.html
2023-10-06 22:17:06 +07:00

143 lines
No EOL
4.7 KiB
HTML

{{ define "host" }}
<body>
<div class="container mt-5">
<div class="row">
<div class="col">
<table class="table">
{{ range .Hosts }}
<tr>
<td>ID</td>
<td>{{ .ID }}</td>
</tr>
<tr>
<td>Name</td>
<td>{{ .Name }}</td>
</tr>
<tr>
<td>IP</td>
<td><a href="http://{{ .IP }}" target="_blank">{{ .IP }}</a></td>
</tr>
<tr>
<td>Mac</td>
<td>{{ .Mac }}</td>
</tr>
<tr>
<td>Hw</td>
<td>{{ .Hw }}</td>
</tr>
<tr>
<td>Date</td>
<td>{{ .Date }}</td>
</tr>
<tr>
<td>Known</td>
<td>
{{ if eq .Known 1 }}
Yes
{{ else }}
No
{{ end }}
</td>
</tr>
<tr>
<td>Now</td>
<td>
{{ if eq .Now 1 }}
Online
{{ else }}
Offline
{{ end }}
</td>
</tr>
<tr>
<td>
<form action="/del_host/" method="post">
<input name="id" type="hidden" class="form-control" value="{{ .ID }}"><button type="submit" class="btn btn-danger">Delete host</button>
</form>
</td>
<td></td>
</tr>
{{ end }}
</table>
</div>
<div class="col">
<table class="table">
<tr>
<td>Domain name</td>
<td>
{{ range .Themes }}
<a href="http://{{ . }}" target="_blank">{{ . }}</a>
{{ end }}
</td>
</tr>
</table>
<br>
<br>
{{ range .Hosts }}
{{ if eq .Now 1 }}
<p>Scan for open TCP ports (may take some time)</p>
<table class="table">
<form action="/port_scan/" method="post">
<input name="ip" type="hidden" class="form-control" value="{{ .IP }}">
<tr>
<td>Start port</td>
<td><input name="begin" type="text" class="form-control" placeholder="1"></td>
</tr>
<tr>
<td>End port</td>
<td><input name="end" type="text" class="form-control" placeholder="65535"></td>
</tr>
<tr>
<td><button type="submit" class="btn btn-success">Scan host</button></td>
<td></td>
</tr>
</form>
</table>
{{ end }}
{{ end }}
</div>
</div>
<div class="row">
<table class="table table-striped">
<tr>
<th>Host ID</th>
<th>Name</th>
<th>IP</th>
<th>Mac</th>
<th>Hardware</th>
<th>Last seen</th>
<th>Known</th>
<th>State</th>
</tr>
{{ range .Hist }}
<tr>
<td><a href="/host?id={{ .Host }}">{{ .Host }}</a></td>
<td>{{ .Name }}</td>
<td><a href="http://{{ .IP }}" target="_blank">{{ .IP }}</a></td>
<td><a href="/host?id={{ .Host }}">{{ .Mac }}</a></td>
<td>{{ .Hw }}</td>
<td>{{ .Date }}</td>
<td>
{{ if eq .Known 1 }}
Yes
{{ else }}
No
{{ end }}
</td>
<td>
{{ if eq .State 1 }}
<i class="bi bi-circle-fill text-success"></i>
{{ else }}
<i class="bi bi-circle-fill text-danger"></i>
{{ end }}
</td>
</tr>
{{ end }}
</table>
</div>
</div>
{{ template "footer" }}
{{ end }}