Bug fixes in GUI
This commit is contained in:
parent
74c26d08a8
commit
47d5881b56
12 changed files with 99 additions and 47 deletions
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "watchyourlan",
|
||||
"private": true,
|
||||
"version": "2.1.1",
|
||||
"version": "2.1.2",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
|
|
|||
|
|
@ -2,9 +2,17 @@ import { Show } from "solid-js";
|
|||
import { editNames, setEditNames } from "../../functions/exports";
|
||||
import Filter from "../Filter";
|
||||
import Search from "../Search";
|
||||
import { getHosts } from "../../functions/atstart";
|
||||
|
||||
function CardHead() {
|
||||
|
||||
const handleEditNames = (toggle: boolean) => {
|
||||
if (!toggle) {
|
||||
getHosts();
|
||||
}
|
||||
setEditNames(toggle);
|
||||
};
|
||||
|
||||
return (
|
||||
<div class="row">
|
||||
<div class="col-md mt-1 mb-1">
|
||||
|
|
@ -17,9 +25,9 @@ function CardHead() {
|
|||
<Search></Search>
|
||||
<Show
|
||||
when={editNames()}
|
||||
fallback={<button class="btn btn-outline-primary" title="Click to edit names" onClick={[setEditNames, true]}>Edit names</button>}
|
||||
fallback={<button class="btn btn-outline-primary" title="Click to edit names" onClick={[handleEditNames, true]}>Edit names</button>}
|
||||
>
|
||||
<button class="btn btn-primary" onClick={[setEditNames, false]}>Edit names</button>
|
||||
<button class="btn btn-primary" onClick={[handleEditNames, false]}>Edit names</button>
|
||||
</Show>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import { createSignal, Show } from "solid-js";
|
||||
import { editNames } from "../../functions/exports";
|
||||
import { apiEditHost } from "../../functions/api";
|
||||
import { getHosts } from "../../functions/atstart";
|
||||
|
||||
function TableRow(_props: any) {
|
||||
|
||||
|
|
@ -18,11 +17,9 @@ function TableRow(_props: any) {
|
|||
const handleInput = async (n: string) => {
|
||||
setName(n);
|
||||
await apiEditHost(_props.host.ID, name(), '');
|
||||
getHosts();
|
||||
};
|
||||
const handleToggle = async () => {
|
||||
await apiEditHost(_props.host.ID, name(), 'toggle');
|
||||
getHosts();
|
||||
};
|
||||
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { For } from "solid-js";
|
||||
import { Host, ifaces } from "../functions/exports";
|
||||
import { createSignal, For } from "solid-js";
|
||||
import { Host, ifaces, setHistUpdOnFilter } from "../functions/exports";
|
||||
import { filterFunc } from "../functions/filter";
|
||||
|
||||
|
||||
|
|
@ -9,31 +9,41 @@ function Filter() {
|
|||
target: HTMLSelectElement;
|
||||
};
|
||||
|
||||
const [selectValue, setSelectValue] = createSignal("");
|
||||
|
||||
const handleFilter = (field: keyof Host, event: FilterEvent) => {
|
||||
const value = event.target ? event.target.value : 0;
|
||||
filterFunc(field, value);
|
||||
setHistUpdOnFilter(true);
|
||||
};
|
||||
|
||||
const handleReset = () => {
|
||||
filterFunc("ID", 0);
|
||||
setSelectValue("something");
|
||||
setSelectValue("");
|
||||
setHistUpdOnFilter(true);
|
||||
};
|
||||
|
||||
return (
|
||||
<div class="row">
|
||||
<div class="col input-group">
|
||||
<select onChange={(event)=>{handleFilter("Iface", event)}} class="form-select" title="Filter by Iface">
|
||||
<option selected disabled>Iface</option>
|
||||
<select onChange={(event)=>{handleFilter("Iface", event)}} class="form-select" title="Filter by Iface" value={selectValue()}>
|
||||
<option value="" selected disabled>Iface</option>
|
||||
<For each={ifaces()}>{(iface) =>
|
||||
<option value={iface}>{iface}</option>
|
||||
}</For>
|
||||
</select>
|
||||
<select onChange={(event)=>{handleFilter("Known", event)}} class="form-select" title="Filter by Known">
|
||||
<option selected disabled>Known</option>
|
||||
<select onChange={(event)=>{handleFilter("Known", event)}} class="form-select" title="Filter by Known" value={selectValue()}>
|
||||
<option value="" selected disabled>Known</option>
|
||||
<option value={1}>Known</option>
|
||||
<option value={0}>Unknown</option>
|
||||
</select>
|
||||
<select onChange={(event)=>{handleFilter("Now", event)}} class="form-select" title="Filter by Online">
|
||||
<option selected disabled>Online</option>
|
||||
<select onChange={(event)=>{handleFilter("Now", event)}} class="form-select" title="Filter by Online" value={selectValue()}>
|
||||
<option value="" selected disabled>Online</option>
|
||||
<option value={1}>On</option>
|
||||
<option value={0}>Off</option>
|
||||
</select>
|
||||
<button onClick={()=>{handleFilter("ID", new Event("") as FilterEvent)}} class="btn btn-outline-primary" title="Reset filter">Reset filter</button>
|
||||
<button onClick={handleReset} class="btn btn-outline-primary" title="Reset filter">Reset filter</button>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,22 +1,29 @@
|
|||
import { createSignal, For, onMount, Show } from "solid-js";
|
||||
import { apiGetHistory } from "../functions/api";
|
||||
import { For, onCleanup, onMount, Show } from "solid-js";
|
||||
import { getHistoryForMac } from "../functions/history";
|
||||
import { Host, show } from "../functions/exports";
|
||||
import { createStore } from "solid-js/store";
|
||||
|
||||
function MacHistory(_props: any) {
|
||||
|
||||
const [hist, setHist] = createSignal<Host[]>([]);
|
||||
const [hist, setHist] = createStore<Host[]>([]);
|
||||
let interval: number;
|
||||
|
||||
onMount(async () => {
|
||||
let h:Host[] = [];
|
||||
h = await apiGetHistory(_props.mac);
|
||||
if (h != null) {
|
||||
h.sort((a:Host, b:Host) => (a.Date < b.Date ? 1 : -1));
|
||||
setHist(h);
|
||||
}
|
||||
const newHistory = await getHistoryForMac(_props.mac);
|
||||
setHist(newHistory);
|
||||
interval = setInterval(async () => {
|
||||
// console.log("Upd Hist", new Date());
|
||||
const newHistory = await getHistoryForMac(_props.mac);
|
||||
setHist(newHistory);
|
||||
}, 60000); // 60000 ms = 1 minute
|
||||
});
|
||||
|
||||
onCleanup(() => {
|
||||
clearInterval(interval);
|
||||
});
|
||||
|
||||
return (
|
||||
<For each={hist()}>{(h, index) =>
|
||||
<For each={hist}>{(h, index) =>
|
||||
<Show
|
||||
when={index() < show()}
|
||||
>
|
||||
|
|
|
|||
|
|
@ -90,4 +90,6 @@ export const [appConfig, setAppConfig] = createSignal<Conf>(emptyConf);
|
|||
|
||||
export const [editNames, setEditNames] = createSignal(false);
|
||||
|
||||
export const [show, setShow] = createSignal<number>(200);
|
||||
export const [show, setShow] = createSignal<number>(200);
|
||||
|
||||
export const [histUpdOnFilter, setHistUpdOnFilter] = createSignal(false);
|
||||
12
frontend/src/functions/history.ts
Normal file
12
frontend/src/functions/history.ts
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
import { apiGetHistory } from "./api";
|
||||
import { Host } from "./exports";
|
||||
|
||||
export async function getHistoryForMac(mac: string) {
|
||||
let h:Host[] = [];
|
||||
h = await apiGetHistory(mac);
|
||||
if (h != null) {
|
||||
h.sort((a:Host, b:Host) => (a.Date < b.Date ? 1 : -1));
|
||||
return h;
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
|
@ -1,15 +1,27 @@
|
|||
import { For } from "solid-js"
|
||||
import { createEffect, For, Show } from "solid-js"
|
||||
import Filter from "../components/Filter"
|
||||
import { allHosts, setShow, show } from "../functions/exports"
|
||||
import { allHosts, histUpdOnFilter, Host, setHistUpdOnFilter, setShow, show } from "../functions/exports"
|
||||
import MacHistory from "../components/MacHistory"
|
||||
import HistShow from "../components/HistShow"
|
||||
|
||||
function History() {
|
||||
|
||||
let hosts: Host[] = [];
|
||||
hosts.push(...allHosts);
|
||||
|
||||
const showStr = localStorage.getItem("histShow") as string;
|
||||
setShow(+showStr);
|
||||
(show() === 0 || isNaN(show())) ? setShow(200) : '';
|
||||
|
||||
createEffect(() => {
|
||||
if (histUpdOnFilter()) {
|
||||
hosts = [];
|
||||
hosts.push(...allHosts);
|
||||
console.log("Upd on Filter");
|
||||
setHistUpdOnFilter(false);
|
||||
}
|
||||
});
|
||||
|
||||
return (
|
||||
<div class="card border-primary">
|
||||
<div class="card-header d-flex justify-content-between">
|
||||
|
|
@ -19,18 +31,22 @@ function History() {
|
|||
<div class="card-body">
|
||||
<table class="table table-striped table-hover">
|
||||
<tbody>
|
||||
<For each={allHosts}>{(host, index) =>
|
||||
<tr>
|
||||
<td class="opacity-50" style="width: 2em;">{index()+1}.</td>
|
||||
<td>
|
||||
<a href={"/host/"+host.ID}>{host.Name}</a><br></br>
|
||||
<a href={"http://"+host.IP}>{host.IP}</a>
|
||||
</td>
|
||||
<td>
|
||||
<MacHistory mac={host.Mac}></MacHistory>
|
||||
</td>
|
||||
</tr>
|
||||
}</For>
|
||||
<Show
|
||||
when={!histUpdOnFilter()}
|
||||
>
|
||||
<For each={hosts}>{(host, index) =>
|
||||
<tr>
|
||||
<td class="opacity-50" style="width: 2em;">{index()+1}.</td>
|
||||
<td>
|
||||
<a href={"/host/"+host.ID}>{host.Name}</a><br></br>
|
||||
<a href={"http://"+host.IP}>{host.IP}</a>
|
||||
</td>
|
||||
<td>
|
||||
<MacHistory mac={host.Mac}></MacHistory>
|
||||
</td>
|
||||
</tr>
|
||||
}</For>
|
||||
</Show>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import{c as h,o as v,e as c,S as w,t as u,b as d,s as S,y as g,l as f,F as p,z as y,k as m,h as b}from"./index.js";var H=u("<i>");function x(o){const[r,t]=h([]);return v(async()=>{let e=[];e=await y(o.mac),e!=null&&(e.sort((s,a)=>s.Date<a.Date?1:-1),t(e))}),c(p,{get each(){return r()},children:(e,s)=>c(w,{get when(){return s()<f()},get children(){var a=H();return d(n=>{var l="Date:"+e.Date+`
|
||||
Iface:`+e.Iface+`
|
||||
IP:`+e.IP+`
|
||||
Known:`+e.Known,i=e.Now===0?"my-box-off":"my-box-on";return l!==n.e&&S(a,"title",n.e=l),i!==n.t&&g(a,n.t=i),n},{e:void 0,t:void 0}),a}})})}var I=u('<input class=form-control placeholder="Show elements"title="Nomber of elements to show"style=max-width:10em;>');function D(o){const r=t=>{localStorage.setItem(o.name,t),m(+t),f()==0&&m(200)};return(()=>{var t=I();return t.$$input=e=>r(e.target.value),t})()}b(["input"]);export{D as H,x as M};
|
||||
import{B as h,C as y,o as d,D as H,e as m,S,t as v,b as I,s as g,E as p,m as f,F as b,l as u,h as D}from"./index.js";async function w(n){let t=[];return t=await h(n),t!=null?(t.sort((e,o)=>e.Date<o.Date?1:-1),t):[]}var $=v("<i>");function C(n){const[t,e]=y([]);let o;return d(async()=>{const a=await w(n.mac);e(a),o=setInterval(async()=>{const s=await w(n.mac);e(s)},6e4)}),H(()=>{clearInterval(o)}),m(b,{each:t,children:(a,s)=>m(S,{get when(){return s()<f()},get children(){var l=$();return I(r=>{var i="Date:"+a.Date+`
|
||||
Iface:`+a.Iface+`
|
||||
IP:`+a.IP+`
|
||||
Known:`+a.Known,c=a.Now===0?"my-box-off":"my-box-on";return i!==r.e&&g(l,"title",r.e=i),c!==r.t&&p(l,r.t=c),r},{e:void 0,t:void 0}),l}})})}var x=v('<input class=form-control placeholder="Show elements"title="Nomber of elements to show"style=max-width:10em;>');function E(n){const t=e=>{localStorage.setItem(n.name,e),u(+e),f()==0&&u(200)};return(()=>{var e=x();return e.$$input=o=>t(o.target.value),e})()}D(["input"]);export{E as H,C as M};
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
import{k as f,l as m,t as _,i as t,e as a,m as C,n as H,b as I,s as v,F}from"./index.js";import{H as M,M as N}from"./HistShow.js";var P=_('<div class="card border-primary"><div class="card-header d-flex justify-content-between"></div><div class=card-body><table class="table table-striped table-hover"><tbody></tbody>'),j=_("<tr><td class=opacity-50 style=width:2em;>.</td><td><a></a><br><a></a></td><td>");function D(){const $=localStorage.getItem("histShow");return f(+$),(m()===0||isNaN(m()))&&f(200),(()=>{var d=P(),l=d.firstChild,u=l.nextSibling,S=u.firstChild,y=S.firstChild;return t(l,a(C,{}),null),t(l,a(M,{name:"histShow"}),null),t(y,a(F,{each:H,children:(e,g)=>(()=>{var n=j(),i=n.firstChild,w=i.firstChild,o=i.nextSibling,s=o.firstChild,p=s.nextSibling,c=p.nextSibling,x=o.nextSibling;return t(i,()=>g()+1,w),t(s,()=>e.Name),t(c,()=>e.IP),t(x,a(N,{get mac(){return e.Mac}})),I(r=>{var h="/host/"+e.ID,b="http://"+e.IP;return h!==r.e&&v(s,"href",r.e=h),b!==r.t&&v(c,"href",r.t=b),r},{e:void 0,t:void 0}),n})()})),d})()}export{D as default};
|
||||
import{k as m,l as u,m as p,n as I,p as v,q as M,t as _,i as e,e as l,r as N,F as U,b as E,s as S,S as O}from"./index.js";import{H as P,M as j}from"./HistShow.js";var k=_('<div class="card border-primary"><div class="card-header d-flex justify-content-between"></div><div class=card-body><table class="table table-striped table-hover"><tbody></tbody>'),q=_("<tr><td class=opacity-50 style=width:2em;>.</td><td><a></a><br><a></a></td><td>");function R(){let s=[];s.push(...m);const $=localStorage.getItem("histShow");return u(+$),(p()===0||isNaN(p()))&&u(200),I(()=>{v()&&(s=[],s.push(...m),console.log("Upd on Filter"),M(!1))}),(()=>{var d=k(),a=d.firstChild,g=a.nextSibling,w=g.firstChild,y=w.firstChild;return e(a,l(N,{}),null),e(a,l(P,{name:"histShow"}),null),e(y,l(O,{get when(){return!v()},get children(){return l(U,{each:s,children:(t,x)=>(()=>{var o=q(),i=o.firstChild,C=i.firstChild,h=i.nextSibling,n=h.firstChild,F=n.nextSibling,c=F.nextSibling,H=h.nextSibling;return e(i,()=>x()+1,C),e(n,()=>t.Name),e(c,()=>t.IP),e(H,l(j,{get mac(){return t.Mac}})),E(r=>{var f="/host/"+t.ID,b="http://"+t.IP;return f!==r.e&&S(n,"href",r.e=f),b!==r.t&&S(c,"href",r.t=b),r},{e:void 0,t:void 0}),o})()})}})),d})()}export{R as default};
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
import{t as c,i as e,j as k,b as w,s as G,p as K,q as O,r as rt,h as L,c as x,e as u,F as nt,u as at,k as q,l as B,v as st,o as dt,w as ct,x as ot}from"./index.js";import{H as $t,M as ht}from"./HistShow.js";var bt=c('<div class="card border-primary"><div class=card-header>Host</div><div class="card-body table-responsive"><table class="table table-striped table-hover"><tbody><tr><td>ID</td><td></td></tr><tr><td>Name</td><td><input type=text class=form-control></td></tr><tr><td>DNS name</td><td></td></tr><tr><td>Iface</td><td></td></tr><tr><td>IP</td><td><a target=_blank></a></td></tr><tr><td>MAC</td><td></td></tr><tr><td>Hardware</td><td></td></tr><tr><td>Date</td><td></td></tr><tr><td>Known</td><td><div class="form-check form-switch"><input class=form-check-input type=checkbox></div></td></tr><tr><td>Online</td><td></td></tr></tbody></table><button type=button class="btn btn-outline-danger">Delete host'),ut=c('<i class="bi bi-check-circle-fill"style=color:var(--bs-success);>'),ft=c('<i class="bi bi-circle-fill"style=color:var(--bs-gray-500);>');function gt(t){let i="";const r=async o=>{i=o,await K(t.host.ID,i,""),O()},l=async()=>{i==""&&(i=t.host.Name),await K(t.host.ID,i,"toggle"),O()},h=async()=>{await rt(t.host.ID),window.location.href="/"};return(()=>{var o=bt(),f=o.firstChild,p=f.nextSibling,g=p.firstChild,H=g.firstChild,_=H.firstChild,I=_.firstChild,a=I.nextSibling,s=_.nextSibling,b=s.firstChild,d=b.nextSibling,m=d.firstChild,v=s.nextSibling,N=v.firstChild,C=N.nextSibling,n=v.nextSibling,$=n.firstChild,y=$.nextSibling,S=n.nextSibling,R=S.firstChild,T=R.nextSibling,D=T.firstChild,M=S.nextSibling,z=M.firstChild,J=z.nextSibling,E=M.nextSibling,Q=E.firstChild,U=Q.nextSibling,j=E.nextSibling,V=j.firstChild,W=V.nextSibling,F=j.nextSibling,X=F.firstChild,Y=X.nextSibling,Z=Y.firstChild,A=Z.firstChild,tt=F.nextSibling,et=tt.firstChild,lt=et.nextSibling,it=g.nextSibling;return e(a,()=>t.host.ID),m.$$input=P=>r(P.target.value),e(C,()=>t.host.DNS),e(y,()=>t.host.Iface),e(D,()=>t.host.IP),e(J,()=>t.host.Mac),e(U,()=>t.host.Hw),e(W,()=>t.host.Date),A.$$click=l,e(lt,(()=>{var P=k(()=>t.host.Now==1);return()=>P()?ut():ft()})()),it.$$click=h,w(()=>G(D,"href","http://"+t.host.IP)),w(()=>m.value=t.host.Name),w(()=>A.checked=t.host.Known==1),o})()}L(["input","click"]);var _t=c('<div class="card border-primary"><div class=card-header>Port Scan</div><div class=card-body><form class=input-group><input type=text class=form-control placeholder=1><input type=text class=form-control placeholder=65535><button type=button class="btn btn-primary">Scan</button></form><div class=mt-2>'),mt=c('<div class="d-flex justify-content-between mt-2"><button type=button class="btn btn-warning">Stop/Continue</button><div>Scanning port: '),vt=c("<a class=me-4 target=_blank>");function St(t){let i=!1;const[r,l]=x(""),[h,o]=x(""),[f,p]=x(""),[g,H]=x([]),_=async()=>{i=!1;let a=Number(r());(Number.isNaN(a)||a<1||a>65535)&&(a=1);let s=Number(h());(Number.isNaN(s)||s<1||s>65535)&&(s=65535);let b;for(let d=a;d<=s&&!i;d++)p(d.toString()),b=await at(t.IP,d),b&&H([...g(),d])},I=()=>{i?(l(f()),_()):i=!0};return(()=>{var a=_t(),s=a.firstChild,b=s.nextSibling,d=b.firstChild,m=d.firstChild,v=m.nextSibling,N=v.nextSibling,C=d.nextSibling;return m.$$input=n=>l(n.target.value),v.$$input=n=>o(n.target.value),N.$$click=_,e(b,(()=>{var n=k(()=>f()!="");return()=>n()?(()=>{var $=mt(),y=$.firstChild,S=y.nextSibling;return S.firstChild,y.$$click=I,e(S,f,null),$})():[]})(),C),e(C,u(nt,{get each(){return g()},children:n=>(()=>{var $=vt();return e($,n),w(()=>G($,"href","http://"+t.IP+":"+n)),$})()})),a})()}L(["input","click"]);var xt=c('<div class="card border-primary"><div class="card-header d-flex justify-content-between"><div>Host History</div></div><div class=card-body>');function Ct(t){const i=localStorage.getItem("hostShow");return q(+i),(B()===0||isNaN(B()))&&q(500),(()=>{var r=xt(),l=r.firstChild;l.firstChild;var h=l.nextSibling;return e(l,u($t,{name:"hostShow"}),null),e(h,(()=>{var o=k(()=>t.mac!=="");return()=>o()?u(ht,{get mac(){return t.mac}}):"Loading..."})()),r})()}var yt=c("<div class=row><div class=col-md></div><div class=col-md>"),wt=c('<div class="row mt-4"><div class=col-md>');function It(){const[t,i]=x(st);return dt(async()=>{const r=ct(),l=await ot(r.id);i(l)}),[(()=>{var r=yt(),l=r.firstChild,h=l.nextSibling;return e(l,u(gt,{get host(){return t()}})),e(h,u(St,{get IP(){return t().IP}})),r})(),(()=>{var r=wt(),l=r.firstChild;return e(l,u(Ct,{get mac(){return t().Mac}})),r})()]}export{It as default};
|
||||
import{t as c,i as e,j as k,b as w,s as G,u as K,v as O,w as rt,h as L,c as x,e as u,F as nt,x as at,l as z,m as B,y as st,o as dt,z as ct,A as ot}from"./index.js";import{H as $t,M as ht}from"./HistShow.js";var bt=c('<div class="card border-primary"><div class=card-header>Host</div><div class="card-body table-responsive"><table class="table table-striped table-hover"><tbody><tr><td>ID</td><td></td></tr><tr><td>Name</td><td><input type=text class=form-control></td></tr><tr><td>DNS name</td><td></td></tr><tr><td>Iface</td><td></td></tr><tr><td>IP</td><td><a target=_blank></a></td></tr><tr><td>MAC</td><td></td></tr><tr><td>Hardware</td><td></td></tr><tr><td>Date</td><td></td></tr><tr><td>Known</td><td><div class="form-check form-switch"><input class=form-check-input type=checkbox></div></td></tr><tr><td>Online</td><td></td></tr></tbody></table><button type=button class="btn btn-outline-danger">Delete host'),ut=c('<i class="bi bi-check-circle-fill"style=color:var(--bs-success);>'),ft=c('<i class="bi bi-circle-fill"style=color:var(--bs-gray-500);>');function gt(t){let i="";const r=async o=>{i=o,await K(t.host.ID,i,""),O()},l=async()=>{i==""&&(i=t.host.Name),await K(t.host.ID,i,"toggle"),O()},h=async()=>{await rt(t.host.ID),window.location.href="/"};return(()=>{var o=bt(),f=o.firstChild,p=f.nextSibling,g=p.firstChild,H=g.firstChild,_=H.firstChild,I=_.firstChild,a=I.nextSibling,s=_.nextSibling,b=s.firstChild,d=b.nextSibling,m=d.firstChild,v=s.nextSibling,N=v.firstChild,C=N.nextSibling,n=v.nextSibling,$=n.firstChild,y=$.nextSibling,S=n.nextSibling,R=S.firstChild,T=R.nextSibling,D=T.firstChild,M=S.nextSibling,q=M.firstChild,J=q.nextSibling,E=M.nextSibling,Q=E.firstChild,U=Q.nextSibling,j=E.nextSibling,V=j.firstChild,W=V.nextSibling,A=j.nextSibling,X=A.firstChild,Y=X.nextSibling,Z=Y.firstChild,F=Z.firstChild,tt=A.nextSibling,et=tt.firstChild,lt=et.nextSibling,it=g.nextSibling;return e(a,()=>t.host.ID),m.$$input=P=>r(P.target.value),e(C,()=>t.host.DNS),e(y,()=>t.host.Iface),e(D,()=>t.host.IP),e(J,()=>t.host.Mac),e(U,()=>t.host.Hw),e(W,()=>t.host.Date),F.$$click=l,e(lt,(()=>{var P=k(()=>t.host.Now==1);return()=>P()?ut():ft()})()),it.$$click=h,w(()=>G(D,"href","http://"+t.host.IP)),w(()=>m.value=t.host.Name),w(()=>F.checked=t.host.Known==1),o})()}L(["input","click"]);var _t=c('<div class="card border-primary"><div class=card-header>Port Scan</div><div class=card-body><form class=input-group><input type=text class=form-control placeholder=1><input type=text class=form-control placeholder=65535><button type=button class="btn btn-primary">Scan</button></form><div class=mt-2>'),mt=c('<div class="d-flex justify-content-between mt-2"><button type=button class="btn btn-warning">Stop/Continue</button><div>Scanning port: '),vt=c("<a class=me-4 target=_blank>");function St(t){let i=!1;const[r,l]=x(""),[h,o]=x(""),[f,p]=x(""),[g,H]=x([]),_=async()=>{i=!1;let a=Number(r());(Number.isNaN(a)||a<1||a>65535)&&(a=1);let s=Number(h());(Number.isNaN(s)||s<1||s>65535)&&(s=65535);let b;for(let d=a;d<=s&&!i;d++)p(d.toString()),b=await at(t.IP,d),b&&H([...g(),d])},I=()=>{i?(l(f()),_()):i=!0};return(()=>{var a=_t(),s=a.firstChild,b=s.nextSibling,d=b.firstChild,m=d.firstChild,v=m.nextSibling,N=v.nextSibling,C=d.nextSibling;return m.$$input=n=>l(n.target.value),v.$$input=n=>o(n.target.value),N.$$click=_,e(b,(()=>{var n=k(()=>f()!="");return()=>n()?(()=>{var $=mt(),y=$.firstChild,S=y.nextSibling;return S.firstChild,y.$$click=I,e(S,f,null),$})():[]})(),C),e(C,u(nt,{get each(){return g()},children:n=>(()=>{var $=vt();return e($,n),w(()=>G($,"href","http://"+t.IP+":"+n)),$})()})),a})()}L(["input","click"]);var xt=c('<div class="card border-primary"><div class="card-header d-flex justify-content-between"><div>Host History</div></div><div class=card-body>');function Ct(t){const i=localStorage.getItem("hostShow");return z(+i),(B()===0||isNaN(B()))&&z(500),(()=>{var r=xt(),l=r.firstChild;l.firstChild;var h=l.nextSibling;return e(l,u($t,{name:"hostShow"}),null),e(h,(()=>{var o=k(()=>t.mac!=="");return()=>o()?u(ht,{get mac(){return t.mac}}):"Loading..."})()),r})()}var yt=c("<div class=row><div class=col-md></div><div class=col-md>"),wt=c('<div class="row mt-4"><div class=col-md>');function It(){const[t,i]=x(st);return dt(async()=>{const r=ct(),l=await ot(r.id);i(l)}),[(()=>{var r=yt(),l=r.firstChild,h=l.nextSibling;return e(l,u(gt,{get host(){return t()}})),e(h,u(St,{get IP(){return t().IP}})),r})(),(()=>{var r=wt(),l=r.firstChild;return e(l,u(Ct,{get mac(){return t().Mac}})),r})()]}export{It as default};
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue