Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Style/imports #17

Merged
merged 3 commits into from
Jul 3, 2024
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
5 changes: 5 additions & 0 deletions rustfmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# SPDX-FileCopyrightText: 2023 The WAG development team
#
# SPDX-License-Identifier: CC0-1.0

imports_granularity = "Crate"
9 changes: 3 additions & 6 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,9 @@
//
// SPDX-License-Identifier: GPL-3.0-or-later

use crate::malware::ads::ADS;
use crate::malware::file::FileCreate;
use crate::malware::mutex::Mutex;
use crate::malware::namepipe::NamePipe;
use crate::malware::ppid::PPID;
use crate::malware::service::BYOVD;
use crate::malware::{
ads::ADS, file::FileCreate, mutex::Mutex, namepipe::NamePipe, ppid::PPID, service::BYOVD,
};
use clap::Parser;

#[derive(Parser)]
Expand Down
5 changes: 1 addition & 4 deletions src/malware/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,7 @@ use crate::windows::users::is_administrator;
use base64::engine::{general_purpose, Engine};
use clap::Parser;
use regex_generate::{Generator, DEFAULT_MAX_REPEAT};
use std::io::Result as IOResult;
use std::path::Path;
use std::time::Duration;
use std::{thread, time};
use std::{io::Result as IOResult, path::Path, thread, time, time::Duration};

#[derive(Parser)]
pub struct FileCreate {
Expand Down
10 changes: 7 additions & 3 deletions src/malware/mutex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,13 @@
use clap::Parser;
use regex_generate::{Generator, DEFAULT_MAX_REPEAT};
use std::{thread, time};
use windows::core::{Result as WindowsResult, PCSTR};
use windows::Win32::Foundation::{CloseHandle, HANDLE};
use windows::Win32::System::Threading::CreateMutexA;
use windows::{
core::{Result as WindowsResult, PCSTR},
Win32::{
Foundation::{CloseHandle, HANDLE},
System::Threading::CreateMutexA,
},
};

#[derive(Parser)]
pub struct Mutex {
Expand Down
12 changes: 8 additions & 4 deletions src/malware/namepipe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@
// Last update 20240224

use regex_generate::{Generator, DEFAULT_MAX_REPEAT};
use windows::core::{Result as WindowsResult, PCSTR};
use windows::Win32::Foundation::{CloseHandle, HANDLE};
use windows::Win32::Storage::FileSystem::PIPE_ACCESS_DUPLEX;
use windows::Win32::System::Pipes::{CreateNamedPipeA, PIPE_TYPE_MESSAGE};
use windows::{
core::{Result as WindowsResult, PCSTR},
Win32::{
Foundation::{CloseHandle, HANDLE},
Storage::FileSystem::PIPE_ACCESS_DUPLEX,
System::Pipes::{CreateNamedPipeA, PIPE_TYPE_MESSAGE},
},
};

use clap::Parser;
use std::{thread, time};
Expand Down
25 changes: 15 additions & 10 deletions src/malware/ppid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,23 @@ use sysinfo::System;

use core::ffi::c_void;
use std::mem::size_of;
use windows::core::PSTR;
use windows::Win32::Foundation::{CloseHandle, HANDLE};
use windows::Win32::System::Memory::{GetProcessHeap, HeapAlloc, HEAP_FLAGS};
use windows::Win32::System::Threading::{
CreateProcessA, InitializeProcThreadAttributeList, OpenProcess, TerminateProcess,
UpdateProcThreadAttribute, WaitForSingleObject, LPPROC_THREAD_ATTRIBUTE_LIST,
PROCESS_ACCESS_RIGHTS, PROCESS_CREATION_FLAGS, PROCESS_INFORMATION,
PROC_THREAD_ATTRIBUTE_PARENT_PROCESS, STARTF_USESHOWWINDOW, STARTUPINFOEXA,
use windows::{
core::PSTR,
Win32::{
Foundation::{CloseHandle, HANDLE},
System::{
Memory::{GetProcessHeap, HeapAlloc, HEAP_FLAGS},
Threading::{
CreateProcessA, InitializeProcThreadAttributeList, OpenProcess, TerminateProcess,
UpdateProcThreadAttribute, WaitForSingleObject, LPPROC_THREAD_ATTRIBUTE_LIST,
PROCESS_ACCESS_RIGHTS, PROCESS_CREATION_FLAGS, PROCESS_INFORMATION,
PROC_THREAD_ATTRIBUTE_PARENT_PROCESS, STARTF_USESHOWWINDOW, STARTUPINFOEXA,
},
},
},
};

use std::thread;
use std::time::Duration;
use std::{thread, time::Duration};

#[derive(Parser)]
pub struct PPID {
Expand Down
16 changes: 10 additions & 6 deletions src/malware/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,16 @@
use crate::windows::users::is_administrator;
use clap::Parser;
use std::{thread, time};
use windows::core::{Result as WindowsResult, PCWSTR};
use windows::Win32::Security::SC_HANDLE;
use windows::Win32::System::Services::{
ControlService, CreateServiceW, DeleteService, OpenSCManagerW, StartServiceW,
ENUM_SERVICE_TYPE, SC_MANAGER_ALL_ACCESS, SERVICE_CONTROL_STOP, SERVICE_ERROR,
SERVICE_START_TYPE, SERVICE_STATUS,
use windows::{
core::{Result as WindowsResult, PCWSTR},
Win32::{
Security::SC_HANDLE,
System::Services::{
ControlService, CreateServiceW, DeleteService, OpenSCManagerW, StartServiceW,
ENUM_SERVICE_TYPE, SC_MANAGER_ALL_ACCESS, SERVICE_CONTROL_STOP, SERVICE_ERROR,
SERVICE_START_TYPE, SERVICE_STATUS,
},
},
};

#[derive(Parser)]
Expand Down