mirror of
https://github.com/sirjonasxx/G-Earth.git
synced 2024-11-26 10:20:51 +01:00
Unify G-Mem & revert back to Java 11
Signed-off-by: Eduardo Alonso <edu@error404software.com>
This commit is contained in:
parent
5a6a87eb59
commit
86e4096f79
@ -11,7 +11,7 @@
|
|||||||
<version>1.0</version>
|
<version>1.0</version>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<javafx.version>12</javafx.version>
|
<javafx.version>11</javafx.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
@ -36,7 +36,7 @@
|
|||||||
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
|
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
|
||||||
<addClasspath>true</addClasspath>
|
<addClasspath>true</addClasspath>
|
||||||
<classpathPrefix>lib/</classpathPrefix>
|
<classpathPrefix>lib/</classpathPrefix>
|
||||||
<mainClass>gearth.J12Main</mainClass>
|
<mainClass>gearth.J11Main</mainClass>
|
||||||
<useUniqueVersions>false</useUniqueVersions>
|
<useUniqueVersions>false</useUniqueVersions>
|
||||||
</manifest>
|
</manifest>
|
||||||
</archive>
|
</archive>
|
||||||
@ -58,7 +58,7 @@
|
|||||||
<outputDirectory>${project.build.directory}/bin</outputDirectory>
|
<outputDirectory>${project.build.directory}/bin</outputDirectory>
|
||||||
<archive>
|
<archive>
|
||||||
<manifest>
|
<manifest>
|
||||||
<mainClass>gearth.J12Main</mainClass>
|
<mainClass>gearth.J11Main</mainClass>
|
||||||
</manifest>
|
</manifest>
|
||||||
</archive>
|
</archive>
|
||||||
<descriptorRefs>
|
<descriptorRefs>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package gearth;
|
package gearth;
|
||||||
|
|
||||||
public class J12Main {
|
public class J11Main {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
Main.main(args);
|
Main.main(args);
|
||||||
}
|
}
|
@ -79,7 +79,7 @@ public class WindowsHabboClient extends HabboClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String g_winmem = new File(this.getClass().getProtectionDomain().getCodeSource().getLocation().toURI()).getParent() + "\\G-WinMem.exe";
|
String g_winmem = new File(this.getClass().getProtectionDomain().getCodeSource().getLocation().toURI()).getParent() + "\\G-Mem.exe";
|
||||||
if (!useCache)
|
if (!useCache)
|
||||||
pb = new ProcessBuilder(g_winmem, hConnection.getClientHostAndPort().substring(0, hConnection.getClientHostAndPort().indexOf(':')) , Integer.toString(hConnection.getPort()));
|
pb = new ProcessBuilder(g_winmem, hConnection.getClientHostAndPort().substring(0, hConnection.getClientHostAndPort().indexOf(':')) , Integer.toString(hConnection.getPort()));
|
||||||
else
|
else
|
||||||
|
39
G-Mem/Cargo.lock
generated
39
G-Mem/Cargo.lock
generated
@ -2,11 +2,13 @@
|
|||||||
# It is not intended for manual editing.
|
# It is not intended for manual editing.
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "G-Mem"
|
name = "G-Mem"
|
||||||
version = "0.1.0"
|
version = "0.2.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"netstat 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"netstat 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"procfs 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"procfs 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"read-process-memory 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"read-process-memory 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -16,7 +18,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "autocfg"
|
name = "autocfg"
|
||||||
version = "0.1.7"
|
version = "1.0.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -36,12 +38,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "chrono"
|
name = "chrono"
|
||||||
version = "0.4.9"
|
version = "0.4.10"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
|
"num-integer 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)",
|
"num-traits 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)",
|
"time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -123,29 +124,29 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "num-integer"
|
name = "num-integer"
|
||||||
version = "0.1.41"
|
version = "0.1.42"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
"autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"num-traits 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "num-traits"
|
name = "num-traits"
|
||||||
version = "0.2.8"
|
version = "0.2.11"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
"autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "procfs"
|
name = "procfs"
|
||||||
version = "0.6.0"
|
version = "0.7.7"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"chrono 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
"chrono 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"hex 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"hex 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -220,11 +221,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
|
|
||||||
[metadata]
|
[metadata]
|
||||||
"checksum adler32 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "5d2e7343e7fc9de883d1b0341e0b13970f764c14101234857d2ddafa1cb1cac2"
|
"checksum adler32 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "5d2e7343e7fc9de883d1b0341e0b13970f764c14101234857d2ddafa1cb1cac2"
|
||||||
"checksum autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2"
|
"checksum autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d"
|
||||||
"checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
|
"checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
|
||||||
"checksum byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c3dd8985a7111efc5c80b44e23ecdd8c007de8ade3b96595387e812b957cf5"
|
"checksum byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c3dd8985a7111efc5c80b44e23ecdd8c007de8ade3b96595387e812b957cf5"
|
||||||
"checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
|
"checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
|
||||||
"checksum chrono 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e8493056968583b0193c1bb04d6f7684586f3726992d6c573261941a895dbd68"
|
"checksum chrono 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "31850b4a4d6bae316f7a09e691c944c28299298837edc0a03f755618c23cbc01"
|
||||||
"checksum crc32fast 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ba125de2af0df55319f41944744ad91c71113bf74a4646efff39afe1f6842db1"
|
"checksum crc32fast 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ba125de2af0df55319f41944744ad91c71113bf74a4646efff39afe1f6842db1"
|
||||||
"checksum hex 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "023b39be39e3a2da62a94feb433e91e8bcd37676fbc8bea371daf52b7a769a3e"
|
"checksum hex 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "023b39be39e3a2da62a94feb433e91e8bcd37676fbc8bea371daf52b7a769a3e"
|
||||||
"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
|
"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
|
||||||
@ -235,9 +236,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
"checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7"
|
"checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7"
|
||||||
"checksum mach 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "196697f416cf23cf0d3319cf5b2904811b035c82df1dfec2117fb457699bf277"
|
"checksum mach 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "196697f416cf23cf0d3319cf5b2904811b035c82df1dfec2117fb457699bf277"
|
||||||
"checksum netstat 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "48b71f6e2443299ba97e8c834edcd4724be71da3a751b1be75d8b67022801bf3"
|
"checksum netstat 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "48b71f6e2443299ba97e8c834edcd4724be71da3a751b1be75d8b67022801bf3"
|
||||||
"checksum num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)" = "b85e541ef8255f6cf42bbfe4ef361305c6c135d10919ecc26126c4e5ae94bc09"
|
"checksum num-integer 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "3f6ea62e9d81a77cd3ee9a2a5b9b609447857f3d358704331e4ef39eb247fcba"
|
||||||
"checksum num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "6ba9a427cfca2be13aa6f6403b0b7e7368fe982bfa16fccc450ce74c46cd9b32"
|
"checksum num-traits 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "c62be47e61d1842b9170f0fdeec8eba98e60e90e5446449a0545e5152acd7096"
|
||||||
"checksum procfs 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "911881246ca41baceae6921e32f9f5542c83713e3825b57adedb6afeb48a23a1"
|
"checksum procfs 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)" = "e767ab205e4b292ea2c8e9fa454efe7e66e35026432eef34fed7daa763136d09"
|
||||||
"checksum read-process-memory 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "950b829b2477880c74aaed706d681bc8d50d4e2b15b5e4d98ed33d5d4f93712e"
|
"checksum read-process-memory 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "950b829b2477880c74aaed706d681bc8d50d4e2b15b5e4d98ed33d5d4f93712e"
|
||||||
"checksum redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)" = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84"
|
"checksum redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)" = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84"
|
||||||
"checksum rle-decode-fast 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cabe4fa914dec5870285fa7f71f602645da47c486e68486d2b4ceb4a343e90ac"
|
"checksum rle-decode-fast 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cabe4fa914dec5870285fa7f71f602645da47c486e68486d2b4ceb4a343e90ac"
|
||||||
|
@ -1,15 +1,32 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "G-Mem"
|
name = "G-Mem"
|
||||||
version = "0.1.0"
|
version = "0.2.0"
|
||||||
authors = ["G-Earth contributors"]
|
authors = ["G-Earth contributors"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
kernel32-sys = "0.2.2"
|
||||||
netstat = "0.7.0"
|
netstat = "0.7.0"
|
||||||
read-process-memory = "0.1.2"
|
read-process-memory = "0.1.2"
|
||||||
procfs = "0.6.0"
|
|
||||||
|
[target.'cfg(unix)'.dependencies]
|
||||||
|
procfs = "0.7.7"
|
||||||
|
|
||||||
|
[target.'cfg(windows)'.dependencies]
|
||||||
|
winapi = {version = "0.3.8", features = ["winnt", "minwindef", "memoryapi", "sysinfoapi", "processthreadsapi"]}
|
||||||
|
|
||||||
[profile.dev]
|
[profile.dev]
|
||||||
opt-level = 3
|
opt-level = 3
|
||||||
|
|
||||||
|
[profile.release]
|
||||||
|
opt-level = 3
|
||||||
|
debug = false
|
||||||
|
rpath = false
|
||||||
|
lto = false
|
||||||
|
debug-assertions = false
|
||||||
|
codegen-units = 16
|
||||||
|
panic = 'unwind'
|
||||||
|
incremental = false
|
||||||
|
overflow-checks = false
|
||||||
|
@ -1,31 +1,26 @@
|
|||||||
|
use std::thread::JoinHandle;
|
||||||
|
use std::{thread, io, env, mem};
|
||||||
|
use std::net::{IpAddr, Ipv4Addr, Ipv6Addr};
|
||||||
|
use std::sync::mpsc;
|
||||||
|
use std::convert::TryInto;
|
||||||
|
|
||||||
|
#[cfg(unix)]
|
||||||
|
use procfs::MemoryMap;
|
||||||
|
|
||||||
use netstat::*;
|
use netstat::*;
|
||||||
use read_process_memory::*;
|
use read_process_memory::*;
|
||||||
use std::io;
|
|
||||||
use std::thread;
|
|
||||||
use std::sync::mpsc;
|
|
||||||
use procfs::MemoryMap;
|
|
||||||
use std::thread::JoinHandle;
|
|
||||||
|
|
||||||
fn main() {
|
#[cfg(windows)]
|
||||||
// get_rc4_possibilities();
|
use winapi::um::winnt::{MEMORY_BASIC_INFORMATION, PMEMORY_BASIC_INFORMATION, MEM_COMMIT, PAGE_GUARD, PAGE_NOACCESS, PROCESS_QUERY_INFORMATION, PROCESS_VM_OPERATION, PROCESS_VM_READ, HANDLE};
|
||||||
let pid = get_proc_id() as Pid;
|
#[cfg(windows)]
|
||||||
get_snippet_list(get_mem_maps(pid), pid);
|
use winapi::um::processthreadsapi::OpenProcess;
|
||||||
print!("\n");
|
#[cfg(windows)]
|
||||||
}
|
use winapi::um::memoryapi::VirtualQueryEx;
|
||||||
|
#[cfg(windows)]
|
||||||
fn get_mem_maps(pid: Pid) -> Vec<MemoryMap>{
|
use winapi::um::sysinfoapi::{SYSTEM_INFO, GetSystemInfo, LPSYSTEM_INFO};
|
||||||
let mut ret: Vec<MemoryMap> = Vec::new();
|
#[cfg(windows)]
|
||||||
let habbo_proc = procfs::Process::new(pid as i32).unwrap();
|
use winapi::shared::minwindef::LPVOID;
|
||||||
|
use std::str::FromStr;
|
||||||
let maps = habbo_proc.maps().unwrap();
|
|
||||||
|
|
||||||
for map in maps {
|
|
||||||
if map.perms == String::from("rw-p") {
|
|
||||||
ret.push(map);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct MemMap {
|
struct MemMap {
|
||||||
start: usize,
|
start: usize,
|
||||||
@ -33,6 +28,47 @@ struct MemMap {
|
|||||||
mem: Vec<u8>
|
mem: Vec<u8>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(windows)]
|
||||||
|
struct MemoryMap {
|
||||||
|
address: (u64, u64)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let args: Vec<String> = env::args().collect();
|
||||||
|
|
||||||
|
if args.len() < 3 {
|
||||||
|
println!("Usage: G-Mem <IPAddress> <Port>");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let habbo_pid = get_proc_id(args[1].clone(), args[2].parse::<u16>().unwrap());
|
||||||
|
get_snippet_list(get_mem_maps(habbo_pid.try_into().unwrap()), habbo_pid.try_into().unwrap());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fn read_mem(pid: Pid, address: usize, size: usize) -> io::Result<Vec<u8>> {
|
||||||
|
let handle = pid.try_into_process_handle()?;
|
||||||
|
let _bytes = copy_address(address, size, &handle)?;
|
||||||
|
Ok(_bytes)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_proc_id(ip: String, port: u16) -> u32 {
|
||||||
|
let af_flags = AddressFamilyFlags::IPV4;
|
||||||
|
let proto_flags = ProtocolFlags::TCP;
|
||||||
|
let sockets_info = get_sockets_info(af_flags, proto_flags).unwrap();
|
||||||
|
|
||||||
|
for si in sockets_info {
|
||||||
|
match si.protocol_socket_info {
|
||||||
|
ProtocolSocketInfo::Tcp(tcp_si) => {
|
||||||
|
if tcp_si.remote_port == port && tcp_si.remote_addr == ip.parse::<IpAddr>().unwrap() {
|
||||||
|
return si.associated_pids[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ProtocolSocketInfo::Udp(_) => {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
fn get_snippet_list(maps: Vec<MemoryMap>, pid: Pid) {
|
fn get_snippet_list(maps: Vec<MemoryMap>, pid: Pid) {
|
||||||
let (tx, rx) = mpsc::channel();
|
let (tx, rx) = mpsc::channel();
|
||||||
|
|
||||||
@ -47,8 +83,8 @@ fn get_snippet_list(maps: Vec<MemoryMap>, pid: Pid) {
|
|||||||
let mut match_start : i64 = -1;
|
let mut match_start : i64 = -1;
|
||||||
let mut match_end: i64 = -1;
|
let mut match_end: i64 = -1;
|
||||||
|
|
||||||
let mem = read_mem(pid, map.address.0 as usize, (map.address.1 - map.address.0) as usize).
|
let size = ((map.address.1 as u64) - (map.address.0 as u64)) as usize;
|
||||||
unwrap();
|
let mem = read_mem(pid, map.address.0 as usize, size).unwrap();
|
||||||
|
|
||||||
for (i, data) in mem.iter().step_by(4).enumerate() {
|
for (i, data) in mem.iter().step_by(4).enumerate() {
|
||||||
let offset = 4;
|
let offset = 4;
|
||||||
@ -80,7 +116,7 @@ fn get_snippet_list(maps: Vec<MemoryMap>, pid: Pid) {
|
|||||||
|
|
||||||
if match_end < (i*4 - (256 - 1) * offset) as i64 {
|
if match_end < (i*4 - (256 - 1) * offset) as i64 {
|
||||||
let m = MemMap {
|
let m = MemMap {
|
||||||
start: (map.address.0 + match_start as u64) as usize,
|
start: (map.address.0 as u64 + match_start as u64) as usize,
|
||||||
len: (match_end - match_start as i64 + 4) as usize,
|
len: (match_end - match_start as i64 + 4) as usize,
|
||||||
mem: mem[match_start as usize..(match_end + 4) as usize].to_vec()
|
mem: mem[match_start as usize..(match_end + 4) as usize].to_vec()
|
||||||
};
|
};
|
||||||
@ -92,7 +128,7 @@ fn get_snippet_list(maps: Vec<MemoryMap>, pid: Pid) {
|
|||||||
}
|
}
|
||||||
if match_start != -1 {
|
if match_start != -1 {
|
||||||
let m = MemMap {
|
let m = MemMap {
|
||||||
start: (map.address.0 + match_start as u64) as usize,
|
start: (map.address.0 as u64 + match_start as u64) as usize,
|
||||||
len: (match_end - match_start + 4) as usize,
|
len: (match_end - match_start + 4) as usize,
|
||||||
mem: mem[match_start as usize..(match_end + 4) as usize].to_vec()
|
mem: mem[match_start as usize..(match_end + 4) as usize].to_vec()
|
||||||
};
|
};
|
||||||
@ -123,52 +159,83 @@ fn get_snippet_list(maps: Vec<MemoryMap>, pid: Pid) {
|
|||||||
fn get_rc4_possibilities(snippet: MemMap) {
|
fn get_rc4_possibilities(snippet: MemMap) {
|
||||||
let offset = 4;
|
let offset = 4;
|
||||||
|
|
||||||
if snippet.len >= 1024 && snippet.len <= 1024 + 2 * offset {
|
if snippet.len >= 1024 && snippet.len <= 1024 + 2 * offset {
|
||||||
|
|
||||||
for i in (0..snippet.len - ((256 - 1) * offset)).step_by(4) {
|
for i in (0..snippet.len - ((256 - 1) * offset)).step_by(4) {
|
||||||
let wannabe_rc4_data = snippet.mem[i..1024 + i].to_vec();
|
let wannabe_rc4_data = snippet.mem[i..1024 + i].to_vec();
|
||||||
let mut data: [u8; 256] = [0xff; 256];
|
let mut data: [u8; 256] = [0xff; 256];
|
||||||
|
|
||||||
let mut is_valid = true;
|
let mut is_valid = true;
|
||||||
for j in 0..1024 {
|
for j in 0..1024 {
|
||||||
if j % 4 != 0 && wannabe_rc4_data[j] != 0 {
|
if j % 4 != 0 && wannabe_rc4_data[j] != 0 {
|
||||||
is_valid = false;
|
is_valid = false;
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
if j % 4 == 0 {
|
|
||||||
data[j / 4] = wannabe_rc4_data[j];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if is_valid == true {
|
if j % 4 == 0 {
|
||||||
for byte in data.iter() {
|
data[j / 4] = wannabe_rc4_data[j];
|
||||||
print!("{:02x}", byte);
|
|
||||||
}
|
|
||||||
print!("\n");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
if is_valid == true {
|
||||||
}
|
for byte in data.iter() {
|
||||||
|
print!("{:02x}", byte);
|
||||||
|
|
||||||
fn read_mem(pid: Pid, address: usize, size: usize) -> io::Result<Vec<u8>> {
|
|
||||||
let handle = pid.try_into_process_handle()?;
|
|
||||||
let _bytes = copy_address(address, size, &handle)?;
|
|
||||||
Ok(_bytes)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn get_proc_id() -> u32 {
|
|
||||||
let sockets_info = get_sockets_info(AddressFamilyFlags::IPV4,
|
|
||||||
ProtocolFlags::TCP).unwrap();
|
|
||||||
for si in sockets_info {
|
|
||||||
match si.protocol_socket_info {
|
|
||||||
ProtocolSocketInfo::Tcp(tcp_si) => {
|
|
||||||
if tcp_si.remote_port == 30000 {
|
|
||||||
return si.associated_pids[0];
|
|
||||||
}
|
}
|
||||||
|
print!("\n");
|
||||||
}
|
}
|
||||||
ProtocolSocketInfo::Udp(_) => {}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return 0;
|
|
||||||
|
#[cfg(windows)]
|
||||||
|
fn get_handle(pid: Pid) -> HANDLE {
|
||||||
|
unsafe {
|
||||||
|
return OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ | PROCESS_VM_OPERATION, 0, pid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(windows)]
|
||||||
|
fn get_mem_maps(pid: Pid) -> Vec<MemoryMap> {
|
||||||
|
|
||||||
|
let mut s_info: SYSTEM_INFO = unsafe {mem::zeroed()};
|
||||||
|
let s_info_ptr = &mut s_info as LPSYSTEM_INFO;
|
||||||
|
|
||||||
|
let mut maps : Vec<MemoryMap> = Vec::new();
|
||||||
|
unsafe {
|
||||||
|
GetSystemInfo(s_info_ptr);
|
||||||
|
|
||||||
|
let mut addr = s_info.lpMinimumApplicationAddress;
|
||||||
|
let end = s_info.lpMaximumApplicationAddress;
|
||||||
|
let handle = get_handle(pid);
|
||||||
|
|
||||||
|
|
||||||
|
while (addr as u64) < (end as u64) {
|
||||||
|
let mut mbi: MEMORY_BASIC_INFORMATION = mem::zeroed();
|
||||||
|
let mbi_ptr = &mut mbi as PMEMORY_BASIC_INFORMATION;
|
||||||
|
|
||||||
|
VirtualQueryEx(handle, addr, mbi_ptr, mem::size_of::<MEMORY_BASIC_INFORMATION>());
|
||||||
|
|
||||||
|
if mbi.State == MEM_COMMIT && ((mbi.Protect & PAGE_GUARD) == 0) && ((mbi.Protect & PAGE_NOACCESS) == 0) {
|
||||||
|
maps.push(MemoryMap{
|
||||||
|
address: (addr as u64, (addr as u64) + mbi.RegionSize as u64)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
addr = (addr as u64 + mbi.RegionSize as u64) as LPVOID;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return maps;
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(unix)]
|
||||||
|
fn get_mem_maps(pid: Pid) -> Vec<MemoryMap>{
|
||||||
|
let mut ret: Vec<MemoryMap> = Vec::new();
|
||||||
|
let habbo_proc = procfs::Process::new(pid as i32).unwrap();
|
||||||
|
|
||||||
|
let maps = habbo_proc.maps().unwrap();
|
||||||
|
|
||||||
|
for map in maps {
|
||||||
|
if map.perms == String::from("rw-p") {
|
||||||
|
ret.push(map);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
}
|
}
|
25
pom.xml
25
pom.xml
@ -9,11 +9,6 @@
|
|||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<version>1.0</version>
|
<version>1.0</version>
|
||||||
|
|
||||||
<properties>
|
|
||||||
<maven.compiler.source>12</maven.compiler.source>
|
|
||||||
<maven.compiler.target>12</maven.compiler.target>
|
|
||||||
</properties>
|
|
||||||
|
|
||||||
<name>G-Earth-Parent</name>
|
<name>G-Earth-Parent</name>
|
||||||
<url>https://github.com/sirjonasxx/G-Earth</url>
|
<url>https://github.com/sirjonasxx/G-Earth</url>
|
||||||
<description>Cross Platform Habbo packetlogger/manipulator</description>
|
<description>Cross Platform Habbo packetlogger/manipulator</description>
|
||||||
@ -35,27 +30,11 @@
|
|||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>3.7.0</version>
|
<version>3.7.0</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>12</source>
|
<source>11</source>
|
||||||
<target>12</target>
|
<target>11</target>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
<!-- this would copy dependencies if we were building a non-standalone JAR -->
|
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-dependency-plugin</artifactId>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<phase>package</phase>
|
|
||||||
<goals>
|
|
||||||
<goal>copy-dependencies</goal>
|
|
||||||
</goals>
|
|
||||||
<configuration>
|
|
||||||
<outputDirectory>${project.build.directory}/bin/lib</outputDirectory>
|
|
||||||
</configuration>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
|
||||||
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<artifactId>maven-resources-plugin</artifactId>
|
<artifactId>maven-resources-plugin</artifactId>
|
||||||
<version>3.1.0</version>
|
<version>3.1.0</version>
|
||||||
|
Loading…
Reference in New Issue
Block a user