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
|
||||
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'
|
||||
New-Item -ItemType Directory -Force -Path $initDir | Out-Null
|
||||
|
||||
+1
-3
@@ -1,3 +1 @@
|
||||
pub use wakey_linux::dhcp::{
|
||||
load_mac_name_cache, read_dhcp_leases_with_names,
|
||||
};
|
||||
pub use wakey_linux::dhcp::{load_mac_name_cache, read_dhcp_leases_with_names};
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@ async fn entry() -> io::Result<()> {
|
||||
.nest("/api", api_router())
|
||||
.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?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,10 +1,10 @@
|
||||
use crate::route::error::ApiError;
|
||||
use crate::utils::query::parser::{QueryType, parse_query};
|
||||
use wakey_core::{DeviceFilters as Filters, DeviceQuery};
|
||||
use axum::Json;
|
||||
use axum::http::StatusCode;
|
||||
use axum::response::IntoResponse;
|
||||
use axum::{extract::Path, response::Redirect};
|
||||
use wakey_core::{DeviceFilters as Filters, DeviceQuery};
|
||||
|
||||
use crate::route::status::NamePath;
|
||||
use crate::utils::query::get_ips;
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
use crate::route::error::ApiError;
|
||||
use crate::utils::query::get_macs;
|
||||
use axum::{Json, http::StatusCode, response::IntoResponse};
|
||||
use axum_extra::extract::Query;
|
||||
use crate::utils::query::get_macs;
|
||||
pub use wakey_core::{DeviceQuery, NamePath, Status};
|
||||
|
||||
pub async fn get_status_json(
|
||||
|
||||
@@ -3,8 +3,8 @@ use std::io;
|
||||
|
||||
/* use crate::arpparse::IpNeighLine;
|
||||
use crate::route::api::Status; */
|
||||
use crate::utils::wake::wake_one;
|
||||
use crate::route::error::ApiError;
|
||||
use crate::utils::wake::wake_one;
|
||||
use axum::{extract::Json, http::StatusCode, response::IntoResponse};
|
||||
use futures::TryFutureExt;
|
||||
use tokio::net::UdpSocket;
|
||||
|
||||
@@ -39,4 +39,3 @@ pub fn boolish_str(s: &str) -> bool {
|
||||
|| (!matches!(t.as_str(), "0" | "false" | "no" | "off" | "n")
|
||||
&& 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 leases;
|
||||
pub mod dev {
|
||||
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 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 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_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()?);
|
||||
}
|
||||
|
||||
|
||||
@@ -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)));
|
||||
}
|
||||
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)));
|
||||
}
|
||||
if s.len() > 1
|
||||
@@ -95,7 +97,9 @@ pub mod mac {
|
||||
D: Deserializer<'de>,
|
||||
{
|
||||
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()
|
||||
.map(|ft| {
|
||||
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 {
|
||||
ft.is_dir()
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
pub mod dhcp;
|
||||
pub mod devices;
|
||||
pub mod dhcp;
|
||||
pub mod wake;
|
||||
|
||||
pub use dhcp::*;
|
||||
pub use devices::*;
|
||||
pub use dhcp::*;
|
||||
pub use wake::*;
|
||||
|
||||
@@ -68,11 +68,11 @@ pub async fn wake_many(
|
||||
.await?;
|
||||
sock.set_broadcast(true)?;
|
||||
|
||||
let iter = targets.into_iter().map(async |target| {
|
||||
match CompleteWakeTarget::try_from(target) {
|
||||
let iter = targets
|
||||
.into_iter()
|
||||
.map(async |target| match CompleteWakeTarget::try_from(target) {
|
||||
Ok(target) => wake_one(&sock, target).await,
|
||||
Err(()) => WakeTargetResult::incomplete(target),
|
||||
}
|
||||
});
|
||||
});
|
||||
Ok(futures::future::join_all(iter).await)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user