HOLY sweep
This commit is contained in:
@@ -5,6 +5,7 @@ param(
|
|||||||
|
|
||||||
# idk what this does it works like that then thats how it is
|
# idk what this does it works like that then thats how it is
|
||||||
pscp.exe -l root -scp -pw $PASSWD -r 192.168.100.1:/etc/ldlda_help $PSScriptRoot
|
pscp.exe -l root -scp -pw $PASSWD -r 192.168.100.1:/etc/ldlda_help $PSScriptRoot
|
||||||
|
pscp.exe -l root -scp -pw $PASSWD 192.168.100.1:/etc/rc.local $PSScriptRoot
|
||||||
|
|
||||||
$initDir = Join-Path $PSScriptRoot 'init.d'
|
$initDir = Join-Path $PSScriptRoot 'init.d'
|
||||||
New-Item -ItemType Directory -Force -Path $initDir | Out-Null
|
New-Item -ItemType Directory -Force -Path $initDir | Out-Null
|
||||||
|
|||||||
+1
-3
@@ -1,3 +1 @@
|
|||||||
pub use wakey_linux::dhcp::{
|
pub use wakey_linux::dhcp::{load_mac_name_cache, read_dhcp_leases_with_names};
|
||||||
load_mac_name_cache, read_dhcp_leases_with_names,
|
|
||||||
};
|
|
||||||
|
|||||||
+1
-1
@@ -40,7 +40,7 @@ async fn entry() -> io::Result<()> {
|
|||||||
.nest("/api", api_router())
|
.nest("/api", api_router())
|
||||||
.fallback_service(get_service(static_dir));
|
.fallback_service(get_service(static_dir));
|
||||||
|
|
||||||
let port = TcpListener::bind("0.0.0.0:12012").await?;
|
let port = TcpListener::bind("[::]:12012").await?;
|
||||||
axum::serve(port, app.into_make_service()).await?;
|
axum::serve(port, app.into_make_service()).await?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -1,10 +1,10 @@
|
|||||||
use crate::route::error::ApiError;
|
use crate::route::error::ApiError;
|
||||||
use crate::utils::query::parser::{QueryType, parse_query};
|
use crate::utils::query::parser::{QueryType, parse_query};
|
||||||
use wakey_core::{DeviceFilters as Filters, DeviceQuery};
|
|
||||||
use axum::Json;
|
use axum::Json;
|
||||||
use axum::http::StatusCode;
|
use axum::http::StatusCode;
|
||||||
use axum::response::IntoResponse;
|
use axum::response::IntoResponse;
|
||||||
use axum::{extract::Path, response::Redirect};
|
use axum::{extract::Path, response::Redirect};
|
||||||
|
use wakey_core::{DeviceFilters as Filters, DeviceQuery};
|
||||||
|
|
||||||
use crate::route::status::NamePath;
|
use crate::route::status::NamePath;
|
||||||
use crate::utils::query::get_ips;
|
use crate::utils::query::get_ips;
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
use crate::route::error::ApiError;
|
use crate::route::error::ApiError;
|
||||||
|
use crate::utils::query::get_macs;
|
||||||
use axum::{Json, http::StatusCode, response::IntoResponse};
|
use axum::{Json, http::StatusCode, response::IntoResponse};
|
||||||
use axum_extra::extract::Query;
|
use axum_extra::extract::Query;
|
||||||
use crate::utils::query::get_macs;
|
|
||||||
pub use wakey_core::{DeviceQuery, NamePath, Status};
|
pub use wakey_core::{DeviceQuery, NamePath, Status};
|
||||||
|
|
||||||
pub async fn get_status_json(
|
pub async fn get_status_json(
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ use std::io;
|
|||||||
|
|
||||||
/* use crate::arpparse::IpNeighLine;
|
/* use crate::arpparse::IpNeighLine;
|
||||||
use crate::route::api::Status; */
|
use crate::route::api::Status; */
|
||||||
use crate::utils::wake::wake_one;
|
|
||||||
use crate::route::error::ApiError;
|
use crate::route::error::ApiError;
|
||||||
|
use crate::utils::wake::wake_one;
|
||||||
use axum::{extract::Json, http::StatusCode, response::IntoResponse};
|
use axum::{extract::Json, http::StatusCode, response::IntoResponse};
|
||||||
use futures::TryFutureExt;
|
use futures::TryFutureExt;
|
||||||
use tokio::net::UdpSocket;
|
use tokio::net::UdpSocket;
|
||||||
|
|||||||
@@ -39,4 +39,3 @@ pub fn boolish_str(s: &str) -> bool {
|
|||||||
|| (!matches!(t.as_str(), "0" | "false" | "no" | "off" | "n")
|
|| (!matches!(t.as_str(), "0" | "false" | "no" | "off" | "n")
|
||||||
&& t.parse::<u64>().map(|n| n != 0).unwrap_or(false))
|
&& t.parse::<u64>().map(|n| n != 0).unwrap_or(false))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
pub use wakey_linux::devices::devs_sorted;
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
pub use wakey_linux::dhcp::enrich_leases_with_nud_state;
|
|
||||||
+13
-3
@@ -1,7 +1,17 @@
|
|||||||
pub mod dev;
|
pub mod dev {
|
||||||
pub mod leases;
|
pub use wakey_linux::devices::devs_sorted;
|
||||||
|
}
|
||||||
|
pub mod leases {
|
||||||
|
pub use wakey_linux::dhcp::enrich_leases_with_nud_state;
|
||||||
|
}
|
||||||
pub mod macs;
|
pub mod macs;
|
||||||
pub mod parser;
|
pub mod parser {
|
||||||
|
pub use wakey_core::QueryInput as QueryType;
|
||||||
|
|
||||||
|
pub async fn parse_query(q: String) -> QueryType {
|
||||||
|
wakey_linux::devices::classify_query(q).await
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub use leases::*;
|
pub use leases::*;
|
||||||
pub use macs::*;
|
pub use macs::*;
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
pub use wakey_core::QueryInput as QueryType;
|
|
||||||
|
|
||||||
pub async fn parse_query(q: String) -> QueryType {
|
|
||||||
wakey_linux::devices::classify_query(q).await
|
|
||||||
}
|
|
||||||
@@ -4,4 +4,3 @@ pub async fn wake_one(
|
|||||||
) -> wakey_core::WakeTargetResult {
|
) -> wakey_core::WakeTargetResult {
|
||||||
wakey_linux::wake::wake_one(sock, t).await
|
wakey_linux::wake::wake_one(sock, t).await
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -221,7 +221,9 @@ pub fn parse_neighbor_line(s: &str) -> Result<NeighborEntry, NeighborParseError>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if state.is_none() && let Some(st) = last_tok {
|
if state.is_none()
|
||||||
|
&& let Some(st) = last_tok
|
||||||
|
{
|
||||||
state = Some(st.parse()?);
|
state = Some(st.parse()?);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,9 @@ pub fn parse_numeric_ipv4(s: &str) -> Option<std::net::IpAddr> {
|
|||||||
{
|
{
|
||||||
return Some(std::net::IpAddr::V4(std::net::Ipv4Addr::from(n)));
|
return Some(std::net::IpAddr::V4(std::net::Ipv4Addr::from(n)));
|
||||||
}
|
}
|
||||||
if s.chars().all(|c| c.is_ascii_digit()) && let Ok(n) = s.parse::<u32>() {
|
if s.chars().all(|c| c.is_ascii_digit())
|
||||||
|
&& let Ok(n) = s.parse::<u32>()
|
||||||
|
{
|
||||||
return Some(std::net::IpAddr::V4(std::net::Ipv4Addr::from(n)));
|
return Some(std::net::IpAddr::V4(std::net::Ipv4Addr::from(n)));
|
||||||
}
|
}
|
||||||
if s.len() > 1
|
if s.len() > 1
|
||||||
@@ -95,7 +97,9 @@ pub mod mac {
|
|||||||
D: Deserializer<'de>,
|
D: Deserializer<'de>,
|
||||||
{
|
{
|
||||||
let s = Option::<String>::deserialize(deserializer)?;
|
let s = Option::<String>::deserialize(deserializer)?;
|
||||||
s.map(|x| x.parse()).transpose().map_err(serde::de::Error::custom)
|
s.map(|x| x.parse())
|
||||||
|
.transpose()
|
||||||
|
.map_err(serde::de::Error::custom)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,7 +75,9 @@ pub async fn list_devs() -> HashSet<String> {
|
|||||||
if e.file_type()
|
if e.file_type()
|
||||||
.map(|ft| {
|
.map(|ft| {
|
||||||
if ft.is_symlink() {
|
if ft.is_symlink() {
|
||||||
std::fs::metadata(e.path()).map(|m| m.is_dir()).unwrap_or(false)
|
std::fs::metadata(e.path())
|
||||||
|
.map(|m| m.is_dir())
|
||||||
|
.unwrap_or(false)
|
||||||
} else {
|
} else {
|
||||||
ft.is_dir()
|
ft.is_dir()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
pub mod dhcp;
|
|
||||||
pub mod devices;
|
pub mod devices;
|
||||||
|
pub mod dhcp;
|
||||||
pub mod wake;
|
pub mod wake;
|
||||||
|
|
||||||
pub use dhcp::*;
|
|
||||||
pub use devices::*;
|
pub use devices::*;
|
||||||
|
pub use dhcp::*;
|
||||||
pub use wake::*;
|
pub use wake::*;
|
||||||
|
|||||||
@@ -68,11 +68,11 @@ pub async fn wake_many(
|
|||||||
.await?;
|
.await?;
|
||||||
sock.set_broadcast(true)?;
|
sock.set_broadcast(true)?;
|
||||||
|
|
||||||
let iter = targets.into_iter().map(async |target| {
|
let iter = targets
|
||||||
match CompleteWakeTarget::try_from(target) {
|
.into_iter()
|
||||||
|
.map(async |target| match CompleteWakeTarget::try_from(target) {
|
||||||
Ok(target) => wake_one(&sock, target).await,
|
Ok(target) => wake_one(&sock, target).await,
|
||||||
Err(()) => WakeTargetResult::incomplete(target),
|
Err(()) => WakeTargetResult::incomplete(target),
|
||||||
}
|
});
|
||||||
});
|
|
||||||
Ok(futures::future::join_all(iter).await)
|
Ok(futures::future::join_all(iter).await)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user