Skip to content

Commit

Permalink
rust rewrite
Browse files Browse the repository at this point in the history
  • Loading branch information
LastExceed committed Oct 19, 2021
1 parent 8b22bea commit e691d72
Show file tree
Hide file tree
Showing 9 changed files with 123 additions and 212 deletions.
8 changes: 4 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.idea
packages
ExoTracker/bin
ExoTracker/obj
.idea
target
Cargo.lock
*.iml
12 changes: 12 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[package]
name = "exotracker-rs"
version = "0.1.0"
authors = ["LastExceed <[email protected]>"]
edition = "2018"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
console = "0.15.0"
win_mem = "0.2.2"
nalgebra = "0.29.0"
16 changes: 0 additions & 16 deletions ExoTracker.sln

This file was deleted.

56 changes: 0 additions & 56 deletions ExoTracker/ExoTracker.csproj

This file was deleted.

99 changes: 0 additions & 99 deletions ExoTracker/Program.cs

This file was deleted.

35 changes: 0 additions & 35 deletions ExoTracker/Properties/AssemblyInfo.cs

This file was deleted.

6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# ExoTracker

very rushed initial version. code is total spaghetti. full refactor incoming
Completely rewritten in Rust. Code is still somewhat spaghetti. Currently depends on [this PR](https://github.com/nevalackin/win_mem/pull/2)

# About virus warnings

Releases aren't signed yet, so expect your browser and anti-virus software to not like the executable. If you don't trust me (which is fair) you can always check the code and compile it yourself
[Explanation and workaround here](https://stackoverflow.com/a/66582477). I'm not gonna pay money for a certificate, and manually submitting each version for verification is way too much work

If you don't trust me (which is fair) you can always look at the code and compile it yourself
68 changes: 68 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
mod utils;

use std::thread;
use std::time::Duration;
use console::Term;
use nalgebra::Vector3;
use win_mem::process::Process;
use win_mem::utils::WinResult;
use utils::*;

const CANNON: Vector3<f32> = Vector3::new(
-66000f32,
0f32,
0f32
);

fn main() {
let term = Term::stdout();
term.hide_cursor().expect("");
term.set_title("ExoTracker v1.00");

loop {
term.clearprint("searching for game process...");
let process = loop {
if let Ok(process) = Process::find("EXO ONE.exe") {
break process
}
thread::sleep(Duration::from_millis(1000));
};

term.clearprint("in menu");//desktop->menu
let mut in_menu = true;
while let Ok(unity_player) = process.find_module("UnityPlayer.dll") {
while let Ok(_) = read_and_print(&term, &process, unity_player.address()) {
in_menu = false;
thread::sleep(Duration::from_millis(20));
};
if in_menu {
thread::sleep(Duration::from_millis(20));
} else {
term.clearprint("in menu");//ingame -> menu
in_menu = true;
}
}
}
}

fn read_and_print(term: &Term, process: &Process, unity_player: usize) -> WinResult<()> {
let address = resolve_multilevel_pointer(
&process,
unity_player + 0x0156C900,
&[0x3F8, 0x1A8, 0x28, 0xA0]
)?;

let position = process.read_mem::<Vector3<f32>>(address + 0x00)?;
let velocity = process.read_mem::<Vector3<f32>>(address + 0x30)?;

let distance = CANNON - position;

term.move_cursor_to(0, 0).expect("");
println!("speed vertical {} ", velocity.y as i32);
println!("speed horizontal {} ", velocity.xz().magnitude() as i32);
println!("speed total {} ", velocity.magnitude() as i32);
println!();
println!("distance to go {} ", distance.magnitude() as i32 - 7500);

Ok(())
}
35 changes: 35 additions & 0 deletions src/utils.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
use console::Term;
use win_mem::process::Process;
use win_mem::utils::WinResult;

pub trait TermEx {
fn clearprint(&self, text: &str) -> ();
}

impl TermEx for Term {
fn clearprint(&self, text: &str) -> () {
self.clear_screen().expect("screen clear failed");
println!("{}", text);
}
}

pub fn resolve_multilevel_pointer(process: &Process, base: usize, offsets: &[usize]) -> WinResult<usize> {
let mut address = base;

for offset in offsets {
address = process.read_mem::<usize>(address)? + offset;
}
Ok(address)
}

// recursive approach for novelty

// pub fn resolve_multilevel_pointer2(process: &Process, base: usize, offsets: &[usize]) -> WinResult<usize> {
// if let [first_offset, remaining_offsets @ ..] = offsets {
// resolve_multilevel_pointer2(
// process,
// process.read_mem::<usize>(base)? + first_offset,
// remaining_offsets
// )
// } else { Ok(base) }
// }

0 comments on commit e691d72

Please sign in to comment.