Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lanscape/core/net_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ def get_metadata(self):
if self.alive:
self.hostname = self._get_hostname()
self._get_mac_addresses()
if not self.manufacturer:
self.manufacturer = self._get_manufacturer(
self.get_mac()
)

# Fallback for pydantic v1: use dict() and enrich output
if not _PYD_V2:
Expand Down
31 changes: 23 additions & 8 deletions lanscape/ui/static/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,16 @@ body:has(.submodule) footer {

#header {
background-color: var(--primary-bg);
padding: 8px 20px;
padding: 8px 2%;
margin: 0;
display: block;
position: relative;
box-shadow: 0 0 10px var(--box-shadow);
width: 100vw;
}
#header .title {
font-size: 36px;
}

footer {
position: sticky;
Expand Down Expand Up @@ -163,7 +166,12 @@ details {


#scan-form {
width: 500px;
width: 60vw;
margin: 0;
min-width: 300px;
max-width: 700px;
}
#scan-form .form-group {
margin: 0;
}
#scan-form label {
Expand Down Expand Up @@ -304,6 +312,9 @@ details {
}
#advanced-modal label {
font-size: 12px;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
#advanced-modal .form-check {
width: fit-content;
Expand Down Expand Up @@ -447,8 +458,10 @@ button {

#scan-form #scan-submit {
border: none;
padding: 10px 20px;
margin-top: 15px;
padding: 10px 3%;
margin: 0 15px;
min-width: 55px;
height: 42px;
}

/* Button Styling */
Expand Down Expand Up @@ -657,10 +670,6 @@ input[type="range"] {
.table thead tr th.detail-col
{
width: 30px;
/*
background-color: var(--body-bg);
border: 1px solid var(--text-almost-hidden);
*/
}
.table td:has(.info-icon-container) {
width: 30px;
Expand Down Expand Up @@ -709,6 +718,12 @@ input[type="range"] {
span.alt {
color: var(--text-accent-color);
}
span.no-wrap {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
display: block;
}
.colorful-buttons a{
margin:2px;
color: var(--text-color);
Expand Down
14 changes: 14 additions & 0 deletions lanscape/ui/static/js/core.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
$(document).ready(function() {
rightSizeDocLayout(0,showFooter);
initTooltips();
adjustNoWrap();
})

$(window).on('resize', function() {
rightSizeDocLayout();
adjustNoWrap();
});


Expand Down Expand Up @@ -36,4 +38,16 @@ function initTooltips() {
tooltipTriggerList.map(function (tooltipTriggerEl) {
return new bootstrap.Tooltip(tooltipTriggerEl)
})
}

/*
An imperfect approach to adjusting
text field width within a table
*/
function adjustNoWrap() {
$('.no-wrap').width(0);
$('.no-wrap').each(function() {
var parentWidth = $(this).parent().width();
$(this).width(parseInt(parentWidth));
});
}
3 changes: 3 additions & 0 deletions lanscape/ui/static/js/quietReload.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ function quietReload() {
var newDoc = new DOMParser().parseFromString(data, 'text/html');
// replace current body with the new body content
$('body').html($(newDoc.body).html());
if (typeof adjustNoWrap === 'function') {
adjustNoWrap();
}
});
}
setTimeout(function() {
Expand Down
62 changes: 30 additions & 32 deletions lanscape/ui/templates/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,45 +3,43 @@
{% block content %}
<div id="header">
<!-- Header and Scan Submission Inline -->
<div class="d-flex justify-content-between align-items-center flex-nowrap">
<div class="d-flex justify-content-between align-items-center flex-wrap">
<a href="/" class="text-decoration-none" aria-label="Go to homepage">
<h1 class="title">
<span>LAN</span>scape
</h1>
</a>
<!-- Right side: settings + form -->
<div class="d-flex align-items-center justify-content-end ms-auto">
<form id="scan-form" class="d-flex align-items-center">
<div class="form-group me-2">
<!-- Above subnet input -->
<div class="label-container">
<label for="subnet">Subnet:</label>
<div id="subnet-info"></div>
</div>
<!-- Subnet input with dropdown -->
<div class="input-group">
<button
type="button"
id="settings-btn"
class="btn btn-secondary start"
data-bs-toggle="tooltip"
data-bs-placement="bottom"
title="Advanced scan settings"
>
<i class="fa-solid fa-gear"></i>
</button>
<input type="text" id="subnet" name="subnet" class="form-control" value="{{ subnet }}" placeholder="Enter subnet">
<button class="btn btn-secondary dropdown-toggle end" type="button" id="subnet-dropdown" data-bs-toggle="dropdown" aria-expanded="false"></button>
<ul class="dropdown-menu" aria-labelledby="subnet-dropdown" id="dropdown-list">
{% for subnet_option in alternate_subnets %}
<li><a class="dropdown-item" href="#">{{ subnet_option['subnet'] }}</a></li>
{% endfor %}
</ul>
</div>
<form id="scan-form" class="d-flex align-items-end">
<div class="form-group me-2">
<!-- Above subnet input -->
<div class="label-container">
<label for="subnet">Subnet:</label>
<div id="subnet-info"></div>
</div>
<button type="submit" id="scan-submit" class="btn btn-primary">Scan</button>
</form>
</div>
<!-- Subnet input with dropdown -->
<div class="input-group">
<button
type="button"
id="settings-btn"
class="btn btn-secondary start"
data-bs-toggle="tooltip"
data-bs-placement="bottom"
title="Advanced scan settings"
>
<i class="fa-solid fa-gear"></i>
</button>
<input type="text" id="subnet" name="subnet" class="form-control" value="{{ subnet }}" placeholder="Enter subnet">
<button class="btn btn-secondary dropdown-toggle end" type="button" id="subnet-dropdown" data-bs-toggle="dropdown" aria-expanded="false"></button>
<ul class="dropdown-menu" aria-labelledby="subnet-dropdown" id="dropdown-list">
{% for subnet_option in alternate_subnets %}
<li><a class="dropdown-item" href="#">{{ subnet_option['subnet'] }}</a></li>
{% endfor %}
</ul>
</div>
</div>
<button type="submit" id="scan-submit" class="btn btn-primary">Scan</button>
</form>
</div>

<div id="scan-progress-bar"></div>
Expand Down
2 changes: 1 addition & 1 deletion lanscape/ui/templates/scan/config.html
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ <h6>Device Detection <span class=text-color>/</span> Ping Settings</h6>
</div>
<div class="col-1 descriptor">=</div>
<div class="col-3">
<label for="total-ping-attempts">Max pings per device</label>
<label for="total-ping-attempts" id="tpa-label">Max pings per device</label>
<input type="number" id="total-ping-attempts" class="form-control" readonly>
</div>
</div>
Expand Down
12 changes: 6 additions & 6 deletions lanscape/ui/templates/scan/ip-table-row.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@
></i>
</div>
</td>
<td>
<td class="ip">
<div>{{ device.ip }}</div>
{% if device.hostname %}
<div><span class=alt>{{device.hostname}}</span></div>
<span class="alt no-wrap">{{device.hostname}}</span>
{% endif %}
</td>
<td>
<td class="mac">
<div>{{ device.mac_addr or 'Unknown' }}</div>
{% if device.manufacturer %}
<div><span class="alt">{{device.manufacturer}}</span></div>
<span class="alt no-wrap">{{device.manufacturer}}</span>
{% endif %}
</td>
<td>{{ device.ports | join(", ") }}</td>
<td>
<td class="ports">{{ device.ports | join(", ") }}</td>
<td class="stage">
{% if device.stage == 'complete' %}
<span class="badge badge-success">complete</span>
{% elif device.stage == 'found' %}
Expand Down
8 changes: 4 additions & 4 deletions lanscape/ui/templates/scan/ip-table.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
<thead>
<tr>
<th class="detail-col" scope="col"></th>
<th scope="col">IP / <span class="alt">Host</span></th>
<th scope="col">MAC / <span class="alt">Manufacturer</span></th>
<th scope="col">Open Ports</th>
<th scope="col">Stage</th>
<th class="ip" scope="col">IP / <span class="alt">Host</span></th>
<th class="mac" scope="col">MAC / <span class="alt">Manufacturer</span></th>
<th class="ports" scope="col">Open Ports</th>
<th class="stage" scope="col">Stage</th>
</tr>
</thead>
<tbody>
Expand Down
Loading