From df559c5ba163df11509cde77439a523aa889f12d Mon Sep 17 00:00:00 2001 From: Felix Guyard Date: Thu, 13 Nov 2025 23:36:55 +0100 Subject: [PATCH 1/7] First rawmem connector version --- Cargo.lock | 1012 +++++++++++++++++++++++++++++++++++++- Cargo.toml | 25 +- examples/ps_inventory.rs | 37 ++ examples/read_phys.rs | 17 + src/lib.rs | 157 +++++- 5 files changed, 1224 insertions(+), 24 deletions(-) create mode 100644 examples/ps_inventory.rs create mode 100644 examples/read_phys.rs diff --git a/Cargo.lock b/Cargo.lock index 273f98f..fa03a4c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -49,6 +49,12 @@ dependencies = [ "core_extensions", ] +[[package]] +name = "adler2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" + [[package]] name = "ahash" version = "0.8.12" @@ -61,6 +67,15 @@ dependencies = [ "zerocopy", ] +[[package]] +name = "aho-corasick" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301" +dependencies = [ + "memchr", +] + [[package]] name = "allocator-api2" version = "0.2.21" @@ -76,6 +91,56 @@ dependencies = [ "libc", ] +[[package]] +name = "anstream" +version = "0.6.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43d5b281e737544384e969a5ccad3f1cdd24b48086a0fc1b2a5262a26b8f4f4a" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78" + +[[package]] +name = "anstyle-parse" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e231f6134f61b71076a3eab506c379d4f36122f2af15a9ff04415ea4c3339e2" +dependencies = [ + "windows-sys 0.60.2", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e0633414522a32ffaac8ac6cc8f748e090c5717661fddeea04219e2344f5f2a" +dependencies = [ + "anstyle", + "once_cell_polyfill", + "windows-sys 0.60.2", +] + [[package]] name = "as_derive_utils" version = "0.10.3" @@ -94,6 +159,12 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + [[package]] name = "bit_field" version = "0.10.3" @@ -199,6 +270,25 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "colorchoice" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" + +[[package]] +name = "console" +version = "0.15.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "054ccb5b10f9f2cbf51eb355ca1d05c2d279ce1804688d0db74b4733a5aeafd8" +dependencies = [ + "encode_unicode", + "libc", + "once_cell", + "unicode-width", + "windows-sys 0.59.0", +] + [[package]] name = "core-foundation-sys" version = "0.8.7" @@ -220,6 +310,15 @@ version = "1.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "533d38ecd2709b7608fb8e18e4504deb99e9a72879e6aa66373a76d8dc4259ea" +[[package]] +name = "crc32fast" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511" +dependencies = [ + "cfg-if", +] + [[package]] name = "crossbeam-channel" version = "0.5.15" @@ -300,7 +399,18 @@ dependencies = [ "libc", "option-ext", "redox_users", - "windows-sys", + "windows-sys 0.48.0", +] + +[[package]] +name = "displaydoc" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.110", ] [[package]] @@ -309,12 +419,47 @@ version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" +[[package]] +name = "encode_unicode" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34aa73646ffb006b8f5147f3dc182bd4bcb190227ce861fc4a4844bf8e3cb2c0" + +[[package]] +name = "env_filter" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bf3c259d255ca70051b30e2e95b5446cdb8949ac4cd22c0d7fd634d89f568e2" +dependencies = [ + "log", + "regex", +] + +[[package]] +name = "env_logger" +version = "0.11.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c863f0904021b108aa8b2f55046443e6b1ebde8fd4a15c399893aae4fa069f" +dependencies = [ + "anstream", + "anstyle", + "env_filter", + "jiff", + "log", +] + [[package]] name = "equivalent" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" +[[package]] +name = "fallible-iterator" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" + [[package]] name = "find-msvc-tools" version = "0.1.4" @@ -327,12 +472,31 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bb23c599a9ff5b981529099902fe5de8d55ecc8c1f451542da17b8d2d65326e" +[[package]] +name = "flate2" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfe33edd8e85a12a67454e37f8c75e730830d83e313556ab9ebf9ee7fbeb3bfb" +dependencies = [ + "crc32fast", + "miniz_oxide", +] + [[package]] name = "fnv" version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +[[package]] +name = "form_urlencoded" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" +dependencies = [ + "percent-encoding", +] + [[package]] name = "generational-arena" version = "0.2.9" @@ -361,7 +525,7 @@ checksum = "1b363a30c165f666402fe6a3024d3bec7ebc898f96a4a23bd1c99f8dbf3f4f47" dependencies = [ "log", "plain", - "scroll", + "scroll 0.12.0", ] [[package]] @@ -404,12 +568,114 @@ dependencies = [ "cc", ] +[[package]] +name = "icu_collections" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c6b649701667bbe825c3b7e6388cb521c23d88644678e83c0c4d0a621a34b43" +dependencies = [ + "displaydoc", + "potential_utf", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locale_core" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edba7861004dd3714265b4db54a3c390e880ab658fec5f7db895fae2046b5bb6" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_normalizer" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f6c8828b67bf8908d82127b2054ea1b4427ff0230ee9141c54251934ab1b599" +dependencies = [ + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7aedcccd01fc5fe81e6b489c15b247b8b0690feb23304303a9e560f37efc560a" + +[[package]] +name = "icu_properties" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e93fcd3157766c0c8da2f8cff6ce651a31f0810eaa1c51ec363ef790bbb5fb99" +dependencies = [ + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02845b3647bb045f1100ecd6480ff52f34c35f82d9880e029d329c21d1054899" + +[[package]] +name = "icu_provider" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85962cf0ce02e1e0a629cc34e7ca3e373ce20dda4c4d7294bbd0bf1fdb59e614" +dependencies = [ + "displaydoc", + "icu_locale_core", + "writeable", + "yoke", + "zerofrom", + "zerotrie", + "zerovec", +] + [[package]] name = "ident_case" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" +[[package]] +name = "idna" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + [[package]] name = "indexmap" version = "2.12.0" @@ -420,6 +686,19 @@ dependencies = [ "hashbrown 0.16.0", ] +[[package]] +name = "indicatif" +version = "0.17.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "183b3088984b400f4cfac3620d5e076c84da5364016b4f49473de574b2586235" +dependencies = [ + "console", + "number_prefix", + "portable-atomic", + "unicode-width", + "web-time", +] + [[package]] name = "instant" version = "0.1.13" @@ -429,6 +708,12 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "is_terminal_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" + [[package]] name = "itertools" version = "0.10.5" @@ -453,6 +738,30 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" +[[package]] +name = "jiff" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49cce2b81f2098e7e3efc35bc2e0a6b7abec9d34128283d7a26fa8f32a6dbb35" +dependencies = [ + "jiff-static", + "log", + "portable-atomic", + "portable-atomic-util", + "serde_core", +] + +[[package]] +name = "jiff-static" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "980af8b43c3ad5d8d349ace167ec8170839f753a42d233ba19e08afe1850fa69" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.110", +] + [[package]] name = "js-sys" version = "0.3.82" @@ -505,6 +814,12 @@ dependencies = [ "libc", ] +[[package]] +name = "litemap" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6373607a59f0be73a39b6fe456b8192fcc3585f602af20751600e974dd455e77" + [[package]] name = "lock_api" version = "0.4.14" @@ -526,6 +841,38 @@ version = "2.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" +[[package]] +name = "memflow" +version = "0.2.4" +dependencies = [ + "abi_stable", + "bitflags 1.3.2", + "bumpalo", + "cglue", + "chrono", + "coarsetime", + "dataview 1.0.1", + "dirs", + "fixed-slice-vec", + "goblin", + "hashbrown 0.14.5", + "itertools 0.12.1", + "libloading 0.8.9", + "log", + "memflow-derive 0.2.4", + "memmap", + "no-std-compat", + "num-traits", + "once_cell", + "pelite 0.9.0", + "rangemap", + "serde", + "serde_json", + "smallvec", + "toml 0.8.23", + "x86_64", +] + [[package]] name = "memflow" version = "0.2.4" @@ -546,20 +893,31 @@ dependencies = [ "itertools 0.12.1", "libloading 0.8.9", "log", - "memflow-derive", + "memflow-derive 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", "memmap", "no-std-compat", "num-traits", "once_cell", - "pelite", + "pelite 0.9.0", "rangemap", "serde", "serde_json", "smallvec", - "toml", + "toml 0.8.23", "x86_64", ] +[[package]] +name = "memflow-derive" +version = "0.2.4" +dependencies = [ + "darling", + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 2.0.110", +] + [[package]] name = "memflow-derive" version = "0.2.4" @@ -577,7 +935,44 @@ dependencies = [ name = "memflow-rawmem" version = "0.2.0" dependencies = [ - "memflow", + "env_logger", + "log", + "memflow 0.2.4", + "memflow-win32", +] + +[[package]] +name = "memflow-win32" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "737879c7fcfb3bca8e56eb85e43d06b0f3ff1a41123b90c4241cfee4ee09f8e8" +dependencies = [ + "log", + "memflow 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "memflow-win32-defs", + "no-std-compat", + "pelite 0.10.0", + "regex", + "serde", + "toml 0.7.8", + "widestring", +] + +[[package]] +name = "memflow-win32-defs" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "286c3278386918d065b004f1b7f90148feeaccb96e3cdec6d10a07cbb24023cd" +dependencies = [ + "dirs", + "indicatif", + "log", + "memflow 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "no-std-compat", + "pdb", + "progress-streams", + "serde", + "ureq", ] [[package]] @@ -590,6 +985,16 @@ dependencies = [ "winapi", ] +[[package]] +name = "miniz_oxide" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" +dependencies = [ + "adler2", + "simd-adler32", +] + [[package]] name = "no-std-compat" version = "0.4.1" @@ -605,12 +1010,24 @@ dependencies = [ "autocfg", ] +[[package]] +name = "number_prefix" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" + [[package]] name = "once_cell" version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" +[[package]] +name = "once_cell_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" + [[package]] name = "option-ext" version = "0.2.0" @@ -648,6 +1065,17 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" +[[package]] +name = "pdb" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82040a392923abe6279c00ab4aff62d5250d1c8555dc780e4b02783a7aa74863" +dependencies = [ + "fallible-iterator", + "scroll 0.11.0", + "uuid", +] + [[package]] name = "pelite" version = "0.9.0" @@ -659,12 +1087,30 @@ dependencies = [ "pelite-macros", ] +[[package]] +name = "pelite" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88dccf4bd32294364aeb7bd55d749604450e9db54605887551f21baea7617685" +dependencies = [ + "dataview 1.0.1", + "no-std-compat", + "pelite-macros", + "serde", +] + [[package]] name = "pelite-macros" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a7cf3f8ecebb0f4895f4892a8be0a0dc81b498f9d56735cb769dc31bf00815b" +[[package]] +name = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + [[package]] name = "plain" version = "0.2.3" @@ -672,8 +1118,32 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6" [[package]] -name = "proc-macro-crate" -version = "3.4.0" +name = "portable-atomic" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483" + +[[package]] +name = "portable-atomic-util" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8a2f0d8d040d7848a709caf78912debcc3f33ee4b3cac47d73d1e1069e83507" +dependencies = [ + "portable-atomic", +] + +[[package]] +name = "potential_utf" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b73949432f5e2a09657003c25bca5e19a0e9c84f8058ca374f49e0ebe605af77" +dependencies = [ + "zerovec", +] + +[[package]] +name = "proc-macro-crate" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "219cb19e96be00ab2e37d6e299658a0cfa83e52429179969b0f0121b4ac46983" dependencies = [ @@ -689,6 +1159,12 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "progress-streams" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e965d96c8162c607b0cd8d66047ad3c9fd35273c134d994327882c6e47f986a7" + [[package]] name = "quote" version = "1.0.42" @@ -724,6 +1200,35 @@ dependencies = [ "thiserror", ] +[[package]] +name = "regex" +version = "1.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58" + [[package]] name = "repr_offset" version = "0.2.2" @@ -733,6 +1238,20 @@ dependencies = [ "tstr", ] +[[package]] +name = "ring" +version = "0.17.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" +dependencies = [ + "cc", + "cfg-if", + "getrandom", + "libc", + "untrusted", + "windows-sys 0.52.0", +] + [[package]] name = "rustc_version" version = "0.2.3" @@ -751,6 +1270,41 @@ dependencies = [ "semver 1.0.27", ] +[[package]] +name = "rustls" +version = "0.23.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "533f54bc6a7d4f647e46ad909549eda97bf5afc1585190ef692b4286b198bd8f" +dependencies = [ + "log", + "once_cell", + "ring", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-pki-types" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94182ad936a0c91c324cd46c6511b9510ed16af436d7b5bab34beab0afd55f7a" +dependencies = [ + "zeroize", +] + +[[package]] +name = "rustls-webpki" +version = "0.103.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ffdfa2f5286e2247234e03f680868ac2815974dc39e00ea15adc445d0aafe52" +dependencies = [ + "ring", + "rustls-pki-types", + "untrusted", +] + [[package]] name = "rustversion" version = "1.0.22" @@ -769,6 +1323,12 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "scroll" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04c565b551bafbef4157586fa379538366e4385d42082f255bfd96e4fe8519da" + [[package]] name = "scroll" version = "0.12.0" @@ -868,18 +1428,36 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" +[[package]] +name = "simd-adler32" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" + [[package]] name = "smallvec" version = "1.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" +[[package]] +name = "stable_deref_trait" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" + [[package]] name = "strsim" version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + [[package]] name = "syn" version = "1.0.109" @@ -902,6 +1480,17 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "synstructure" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.110", +] + [[package]] name = "tarc" version = "0.1.6" @@ -928,6 +1517,28 @@ dependencies = [ "syn 2.0.110", ] +[[package]] +name = "tinystr" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42d3e9c45c09de15d06dd8acf5f4e0e399e85927b7f00711024eb7ae10fa4869" +dependencies = [ + "displaydoc", + "zerovec", +] + +[[package]] +name = "toml" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd79e69d3b627db300ff956027cc6c3798cef26d22526befdfcd12feeb6d2257" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime 0.6.11", + "toml_edit 0.19.15", +] + [[package]] name = "toml" version = "0.8.23" @@ -958,6 +1569,19 @@ dependencies = [ "serde_core", ] +[[package]] +name = "toml_edit" +version = "0.19.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" +dependencies = [ + "indexmap", + "serde", + "serde_spanned", + "toml_datetime 0.6.11", + "winnow 0.5.40", +] + [[package]] name = "toml_edit" version = "0.22.27" @@ -969,7 +1593,7 @@ dependencies = [ "serde_spanned", "toml_datetime 0.6.11", "toml_write", - "winnow", + "winnow 0.7.13", ] [[package]] @@ -981,7 +1605,7 @@ dependencies = [ "indexmap", "toml_datetime 0.7.3", "toml_parser", - "winnow", + "winnow 0.7.13", ] [[package]] @@ -990,7 +1614,7 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0cbe268d35bdb4bb5a56a2de88d0ad0eb70af5384a99d648cd4b3d04039800e" dependencies = [ - "winnow", + "winnow 0.7.13", ] [[package]] @@ -1026,6 +1650,68 @@ version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5" +[[package]] +name = "unicode-width" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254" + +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + +[[package]] +name = "ureq" +version = "2.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02d1a66277ed75f640d608235660df48c8e3c19f3b4edb6a263315626cc3c01d" +dependencies = [ + "base64", + "flate2", + "log", + "once_cell", + "rustls", + "rustls-pki-types", + "url", + "webpki-roots 0.26.11", +] + +[[package]] +name = "url" +version = "2.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08bc136a29a3d1758e07a9cca267be308aeebf5cfd5a10f3f67ab2097683ef5b" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", + "serde", +] + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + +[[package]] +name = "uuid" +version = "1.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f87b8aa10b915a06587d0dec516c282ff295b475d94abf425d62b57710070a2" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + [[package]] name = "version_check" version = "0.9.5" @@ -1098,6 +1784,40 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "web-time" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "webpki-roots" +version = "0.26.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "521bc38abb08001b01866da9f51eb7c5d647a19260e00054a8c7fd5f9e57f7a9" +dependencies = [ + "webpki-roots 1.0.4", +] + +[[package]] +name = "webpki-roots" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2878ef029c47c6e8cf779119f20fcf52bde7ad42a731b2a304bc221df17571e" +dependencies = [ + "rustls-pki-types", +] + +[[package]] +name = "widestring" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72069c3113ab32ab29e5584db3c6ec55d416895e60715417b5b883a357c3e471" + [[package]] name = "winapi" version = "0.3.9" @@ -1185,7 +1905,34 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ - "windows-targets", + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" +dependencies = [ + "windows-targets 0.53.5", ] [[package]] @@ -1194,13 +1941,46 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm 0.52.6", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", +] + +[[package]] +name = "windows-targets" +version = "0.53.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3" +dependencies = [ + "windows-link", + "windows_aarch64_gnullvm 0.53.1", + "windows_aarch64_msvc 0.53.1", + "windows_i686_gnu 0.53.1", + "windows_i686_gnullvm 0.53.1", + "windows_i686_msvc 0.53.1", + "windows_x86_64_gnu 0.53.1", + "windows_x86_64_gnullvm 0.53.1", + "windows_x86_64_msvc 0.53.1", ] [[package]] @@ -1209,42 +1989,147 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53" + [[package]] name = "windows_aarch64_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006" + [[package]] name = "windows_i686_gnu" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnu" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c" + [[package]] name = "windows_i686_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_i686_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2" + [[package]] name = "windows_x86_64_gnu" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499" + [[package]] name = "windows_x86_64_gnullvm" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1" + [[package]] name = "windows_x86_64_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650" + +[[package]] +name = "winnow" +version = "0.5.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" +dependencies = [ + "memchr", +] + [[package]] name = "winnow" version = "0.7.13" @@ -1254,6 +2139,12 @@ dependencies = [ "memchr", ] +[[package]] +name = "writeable" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9edde0db4769d2dc68579893f2306b26c6ecfbe0ef499b013d731b7b9247e0b9" + [[package]] name = "x86_64" version = "0.14.13" @@ -1266,6 +2157,29 @@ dependencies = [ "volatile", ] +[[package]] +name = "yoke" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72d6e5c6afb84d73944e5cedb052c4680d5657337201555f9f2a16b7406d4954" +dependencies = [ + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b659052874eb698efe5b9e8cf382204678a0086ebf46982b79d6ca3182927e5d" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.110", + "synstructure", +] + [[package]] name = "zerocopy" version = "0.8.27" @@ -1285,3 +2199,63 @@ dependencies = [ "quote", "syn 2.0.110", ] + +[[package]] +name = "zerofrom" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.110", + "synstructure", +] + +[[package]] +name = "zeroize" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" + +[[package]] +name = "zerotrie" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a59c17a5562d507e4b54960e8569ebee33bee890c70aa3fe7b97e85a9fd7851" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", +] + +[[package]] +name = "zerovec" +version = "0.11.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c28719294829477f525be0186d13efa9a3c602f7ec202ca9e353d310fb9a002" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eadce39539ca5cb3985590102671f2567e659fca9666581ad3411d59207951f3" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.110", +] diff --git a/Cargo.toml b/Cargo.toml index 669c8ec..2fa57d0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "memflow-rawmem" version = "0.2.0" -authors = ["ko1N "] +authors = ["ko1N ", "k1nd0ne "] edition = "2021" description = "Raw memory dump plugin for memflow" documentation = "https://docs.rs/memflow-rawmem" @@ -16,6 +16,27 @@ categories = ["api-bindings", "memory-management", "os"] crate-type = ["lib", "cdylib"] [dependencies] -memflow = { version = "0.2" } +#memflow = { version = "0.2", features = ["plugins", "filemap"] } +memflow = { path = "../memflow/memflow" } + +log = { version = "0.4", default-features = false } + +[dev-dependencies] +env_logger = "0.11" +memflow-win32 = { version = "0.2" } + +[profile.release] +lto = true [features] +default = ["filemap", "plugins"] +plugins = ["memflow/plugins"] +filemap = ["memflow/filemap"] + +[[example]] +name = "read_phys" +path = "examples/read_phys.rs" + +[[example]] +name = "ps_inventory" +path = "examples/ps_inventory.rs" diff --git a/examples/ps_inventory.rs b/examples/ps_inventory.rs new file mode 100644 index 0000000..e103579 --- /dev/null +++ b/examples/ps_inventory.rs @@ -0,0 +1,37 @@ +/*! +Use the plugin inventory to load memraw and a win32 OS on top. +Example: + cargo run --release --example ps_inventory -- \ + --connector memraw::/tmp/mem.img --os win32 +*/ +use log::info; +use memflow::prelude::v1::*; +use std::env::args; + +fn main() { + env_logger::init_from_env(env_logger::Env::new().default_filter_or("info")); + + let connector_args = args() + .nth(1) + .map(|arg| str::parse(arg.as_ref()).expect("unable to parse connector args")); + + let mut inventory = Inventory::scan(); + let connector = inventory + .instantiate_connector("memraw", None, connector_args.as_ref()) + .expect("unable to create memraw connector"); + let mut os = inventory + .instantiate_os("win32", Some(connector), None) + .expect("unable to create win32 instance with memraw connector"); + let process_list = os.process_info_list().expect("unable to read process list"); + + info!( + "{:>5} {:>10} {:>10} {:<}", + "PID", "SYS ARCH", "PROC ARCH", "NAME" + ); + for p in process_list { + info!( + "{:>5} {:^10} {:^10} {}", + p.pid, p.sys_arch, p.proc_arch, p.name + ); + } +} diff --git a/examples/read_phys.rs b/examples/read_phys.rs new file mode 100644 index 0000000..f803c16 --- /dev/null +++ b/examples/read_phys.rs @@ -0,0 +1,17 @@ +use log::info; +use memflow::prelude::v1::*; +use std::env::args; + +fn main() { + env_logger::init(); + let connector_args: ConnectorArgs = args() + .nth(1) + .map(|a| str::parse(a.as_ref()).expect("args parse")) + .expect("need rawmem::"); + let mut conn = memflow_rawmem::create_connector(&connector_args).expect("init"); + let mut buf = [0u8; 16]; + conn.phys_view() + .read_raw_into(Address::from(0x1000), &mut buf) + .unwrap(); + info!("bytes: {:02x?}", buf); +} diff --git a/src/lib.rs b/src/lib.rs index 6c8326b..b850212 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,6 +1,157 @@ +use std::fs::OpenOptions; +use std::path::Path; + +use log::info; use memflow::prelude::v1::*; -#[os(name = "rawmem", return_wrapped = true)] -pub fn create_os(args: &OsArgs, lib: LibArc) -> Result> { - todo!() +/// identity map: file offset 0 -> [base .. base + file_len) +fn map_entire_file_with_base( + file: &std::fs::File, + base: Address, +) -> Result> { + let len = file + .metadata() + .map_err(|_| Error(ErrorOrigin::Connector, ErrorKind::Unknown).log_error("stat failed"))? + .len(); + let mut map = MemoryMap::new(); + map.push_remap(base, len as umem, Address::from(0)); + Ok(map) +} + +fn parse_base_arg(s: &str) -> Option { + let t = s.trim(); + if let Some(hex) = t.strip_prefix("0x").or_else(|| t.strip_prefix("0X")) { + u64::from_str_radix(hex, 16).ok() + } else { + t.parse::().ok() + } +} + +#[cfg(feature = "filemap")] +pub type MemRawRo<'a> = ReadMappedFilePhysicalMemory<'a>; +#[cfg(not(feature = "filemap"))] +pub type MemRawRo<'a> = FileIoMemory; + +#[connector(name = "memraw", help_fn = "help", no_default_cache = true)] +pub fn create_connector<'a>(args: &ConnectorArgs) -> Result> { + let target = args.target.as_deref().ok_or_else(|| { + Error(ErrorOrigin::Connector, ErrorKind::Unknown).log_error("`target` missing") + })?; + + let base = args + .extra_args + .get("base") + .and_then(|s| parse_base_arg(s)) + .map(Address::from) + .unwrap_or(Address::from(0)); + + let file = OpenOptions::new() + .read(true) + .open(Path::new(target)) + .map_err(|_| Error(ErrorOrigin::Connector, ErrorKind::Unknown).log_error("open failed"))?; + + let map = map_entire_file_with_base(&file, base)?; + + #[cfg(feature = "filemap")] + { + let conn = MmapInfo::try_with_filemap(file, map)?.into_connector(); // ReadMappedFilePhysicalMemory + info!("memraw: '{}' (RO mmap) base={:#x}", target, base.to_umem()); + Ok(conn) + } + #[cfg(not(feature = "filemap"))] + { + let conn = MemRawRo::with_mem_map(file.into(), map)?; + info!("memraw: '{}' (RO stdio) base={:#x}", target, base.to_umem()); + Ok(conn) + } +} + +pub fn help() -> String { + "\ +The rawmem connector exposes a raw memory image as physical memory (read-only). + +Args: + target - path to the raw image (required) + base - optional physical base (hex like 0x100000000 or decimal) + +Examples: + memraw::/path/to/mem.img + memraw::/path/to/mem.img:base=0x100000000 +" + .to_owned() +} + +/// API: RO/RW via a Rust flag +/// Could be usefull for users who import the crate directly (not via plugin). +/// Props: @segfault + +enum Inner<'a> { + Ro(ReadMappedFilePhysicalMemory<'a>), + Rw(FileIoMemory), +} + +pub struct MemRaw<'a> { + inner: Inner<'a>, +} + +impl<'a> MemRaw<'a> { + pub fn open>(path: P, base: Address, writable: bool) -> Result { + let path = path.as_ref(); + let len = std::fs::metadata(path) + .map_err(|_| { + Error(ErrorOrigin::Connector, ErrorKind::Unknown).log_error("stat failed") + })? + .len(); + let mut map = MemoryMap::new(); + map.push_remap(base, len as umem, Address::from(0)); + + if writable { + let f = OpenOptions::new() + .read(true) + .write(true) + .open(path) + .map_err(|_| { + Error(ErrorOrigin::Connector, ErrorKind::Unknown).log_error("open (rw) failed") + })?; + let io = FileIoMemory::with_mem_map(f.into(), map)?; + Ok(Self { + inner: Inner::Rw(io), + }) + } else { + let f = OpenOptions::new().read(true).open(path).map_err(|_| { + Error(ErrorOrigin::Connector, ErrorKind::Unknown).log_error("open (ro) failed") + })?; + let ro = MmapInfo::try_with_filemap(f, map)?.into_connector(); + Ok(Self { + inner: Inner::Ro(ro), + }) + } + } +} + +impl<'a> PhysicalMemory for MemRaw<'a> { + fn phys_read_raw_iter( + &mut self, + ops: memflow::mem::mem_data::PhysicalReadMemOps, + ) -> Result<()> { + match &mut self.inner { + Inner::Ro(m) => m.phys_read_raw_iter(ops), + Inner::Rw(m) => m.phys_read_raw_iter(ops), + } + } + fn phys_write_raw_iter( + &mut self, + ops: memflow::mem::mem_data::PhysicalWriteMemOps, + ) -> Result<()> { + match &mut self.inner { + Inner::Ro(m) => m.phys_write_raw_iter(ops), + Inner::Rw(m) => m.phys_write_raw_iter(ops), + } + } + fn metadata(&self) -> memflow::mem::phys_mem::PhysicalMemoryMetadata { + match &self.inner { + Inner::Ro(m) => m.metadata(), + Inner::Rw(m) => m.metadata(), + } + } } From c5c37e3fd243bcc2c10d3ed57f034e47c00c7845 Mon Sep 17 00:00:00 2001 From: Felix Guyard Date: Thu, 13 Nov 2025 23:39:13 +0100 Subject: [PATCH 2/7] adjusting comments --- examples/ps_inventory.rs | 4 +--- examples/read_phys.rs | 5 +++++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/examples/ps_inventory.rs b/examples/ps_inventory.rs index e103579..b4dc2b4 100644 --- a/examples/ps_inventory.rs +++ b/examples/ps_inventory.rs @@ -1,8 +1,6 @@ /*! -Use the plugin inventory to load memraw and a win32 OS on top. Example: - cargo run --release --example ps_inventory -- \ - --connector memraw::/tmp/mem.img --os win32 + cargo run --release --example ps_inventory -- /tmp/mem.img */ use log::info; use memflow::prelude::v1::*; diff --git a/examples/read_phys.rs b/examples/read_phys.rs index f803c16..64a61dc 100644 --- a/examples/read_phys.rs +++ b/examples/read_phys.rs @@ -1,3 +1,8 @@ +/*! +Example: + cargo run --release --example ps_inventory -- /tmp/mem.img +*/ + use log::info; use memflow::prelude::v1::*; use std::env::args; From 82e335835fb4be168ceeb2bb719b021c526ed1cd Mon Sep 17 00:00:00 2001 From: Felix Guyard Date: Fri, 14 Nov 2025 13:28:53 +0100 Subject: [PATCH 3/7] Updating README --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index f2e7a2f..07ab320 100644 --- a/README.md +++ b/README.md @@ -1 +1,9 @@ # memflow-rawmem + +[![Crates.io](https://img.shields.io/crates/v/memflow.svg)](https://crates.io/crates/memflow) +![build and test](https://github.com/memflow/memflow/workflows/Build%20and%20test/badge.svg?branch=dev) +[![codecov](https://codecov.io/gh/memflow/memflow/branch/master/graph/badge.svg?token=XT7R158N6W)](https://codecov.io/gh/memflow/memflow) +[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE) +[![Discord](https://img.shields.io/discord/738739624976973835?color=%20%237289da&label=Discord)](https://discord.gg/afsEtMR) + +This crate provides integration for raw memory files for [memflow](https://github.com/memflow/memflow). Examples can be found in the `memflow-rawmem/examples` subdirectory. From 5bf02843c1514d3315a5425e15e124860d1e286a Mon Sep 17 00:00:00 2001 From: Felix Guyard Date: Fri, 14 Nov 2025 13:44:58 +0100 Subject: [PATCH 4/7] fixing vocabulary --- examples/read_phys.rs | 2 +- src/lib.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/read_phys.rs b/examples/read_phys.rs index 64a61dc..f9430aa 100644 --- a/examples/read_phys.rs +++ b/examples/read_phys.rs @@ -1,6 +1,6 @@ /*! Example: - cargo run --release --example ps_inventory -- /tmp/mem.img + cargo run --release --example read_phys -- /tmp/mem.img */ use log::info; diff --git a/src/lib.rs b/src/lib.rs index b850212..0457ae2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -32,7 +32,7 @@ pub type MemRawRo<'a> = ReadMappedFilePhysicalMemory<'a>; #[cfg(not(feature = "filemap"))] pub type MemRawRo<'a> = FileIoMemory; -#[connector(name = "memraw", help_fn = "help", no_default_cache = true)] +#[connector(name = "rawmem", help_fn = "help", no_default_cache = true)] pub fn create_connector<'a>(args: &ConnectorArgs) -> Result> { let target = args.target.as_deref().ok_or_else(|| { Error(ErrorOrigin::Connector, ErrorKind::Unknown).log_error("`target` missing") @@ -55,13 +55,13 @@ pub fn create_connector<'a>(args: &ConnectorArgs) -> Result> { #[cfg(feature = "filemap")] { let conn = MmapInfo::try_with_filemap(file, map)?.into_connector(); // ReadMappedFilePhysicalMemory - info!("memraw: '{}' (RO mmap) base={:#x}", target, base.to_umem()); + info!("rawmem: '{}' (RO mmap) base={:#x}", target, base.to_umem()); Ok(conn) } #[cfg(not(feature = "filemap"))] { let conn = MemRawRo::with_mem_map(file.into(), map)?; - info!("memraw: '{}' (RO stdio) base={:#x}", target, base.to_umem()); + info!("rawmem: '{}' (RO stdio) base={:#x}", target, base.to_umem()); Ok(conn) } } From 8eb8949da5d3b7ddfe31e01f5627c05f2141ac7b Mon Sep 17 00:00:00 2001 From: Felix Guyard Date: Fri, 14 Nov 2025 13:48:52 +0100 Subject: [PATCH 5/7] memraw/rawmem swap --- examples/ps_inventory.rs | 6 +++--- src/lib.rs | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/ps_inventory.rs b/examples/ps_inventory.rs index b4dc2b4..a63e42c 100644 --- a/examples/ps_inventory.rs +++ b/examples/ps_inventory.rs @@ -15,11 +15,11 @@ fn main() { let mut inventory = Inventory::scan(); let connector = inventory - .instantiate_connector("memraw", None, connector_args.as_ref()) - .expect("unable to create memraw connector"); + .instantiate_connector("rawmem", None, connector_args.as_ref()) + .expect("unable to create rawmem connector"); let mut os = inventory .instantiate_os("win32", Some(connector), None) - .expect("unable to create win32 instance with memraw connector"); + .expect("unable to create win32 instance with rawmem connector"); let process_list = os.process_info_list().expect("unable to read process list"); info!( diff --git a/src/lib.rs b/src/lib.rs index 0457ae2..2256003 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -75,8 +75,8 @@ Args: base - optional physical base (hex like 0x100000000 or decimal) Examples: - memraw::/path/to/mem.img - memraw::/path/to/mem.img:base=0x100000000 + rawmem::/path/to/mem.img + rawmem::/path/to/mem.img:base=0x100000000 " .to_owned() } From 81ce1fdc7046ca07a80854120cd2aebb83e67836 Mon Sep 17 00:00:00 2001 From: Felix Guyard Date: Wed, 11 Mar 2026 14:28:18 +0100 Subject: [PATCH 6/7] Adding memflow deps to git for easy testing of the PR --- Cargo.lock | 16 +++++++++------- Cargo.toml | 3 +-- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fa03a4c..56547da 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -844,6 +844,8 @@ checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" [[package]] name = "memflow" version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b5a164dd29bb697a512c389215acf4899a3e671a72844acb04d1ddac6ba8d7f" dependencies = [ "abi_stable", "bitflags 1.3.2", @@ -859,7 +861,7 @@ dependencies = [ "itertools 0.12.1", "libloading 0.8.9", "log", - "memflow-derive 0.2.4", + "memflow-derive 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", "memmap", "no-std-compat", "num-traits", @@ -876,8 +878,7 @@ dependencies = [ [[package]] name = "memflow" version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b5a164dd29bb697a512c389215acf4899a3e671a72844acb04d1ddac6ba8d7f" +source = "git+https://github.com/forensicxlab/memflow?branch=main#e7ec6d553924cb7be17a7815e3cbada5b7af5054" dependencies = [ "abi_stable", "bitflags 1.3.2", @@ -893,7 +894,7 @@ dependencies = [ "itertools 0.12.1", "libloading 0.8.9", "log", - "memflow-derive 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "memflow-derive 0.2.4 (git+https://github.com/forensicxlab/memflow?branch=main)", "memmap", "no-std-compat", "num-traits", @@ -910,6 +911,8 @@ dependencies = [ [[package]] name = "memflow-derive" version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d894dc2b0bbce37b81280e1b36da4db3e524e4df5a57d5899b4bd943f489b506" dependencies = [ "darling", "proc-macro-crate", @@ -921,8 +924,7 @@ dependencies = [ [[package]] name = "memflow-derive" version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d894dc2b0bbce37b81280e1b36da4db3e524e4df5a57d5899b4bd943f489b506" +source = "git+https://github.com/forensicxlab/memflow?branch=main#e7ec6d553924cb7be17a7815e3cbada5b7af5054" dependencies = [ "darling", "proc-macro-crate", @@ -937,7 +939,7 @@ version = "0.2.0" dependencies = [ "env_logger", "log", - "memflow 0.2.4", + "memflow 0.2.4 (git+https://github.com/forensicxlab/memflow?branch=main)", "memflow-win32", ] diff --git a/Cargo.toml b/Cargo.toml index 2fa57d0..4ade03f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,8 +16,7 @@ categories = ["api-bindings", "memory-management", "os"] crate-type = ["lib", "cdylib"] [dependencies] -#memflow = { version = "0.2", features = ["plugins", "filemap"] } -memflow = { path = "../memflow/memflow" } +memflow = { git = "https://github.com/forensicxlab/memflow", branch = "main", features = ["plugins", "filemap"] } log = { version = "0.4", default-features = false } From 474c53808b1018cf4346fb6188fa5255cd365bdc Mon Sep 17 00:00:00 2001 From: Felix Guyard Date: Thu, 3 Sep 2026 11:48:04 +0200 Subject: [PATCH 7/7] Align development dependencies with Memflow forks --- Cargo.lock | 403 ++++++++++++++++++++++++++++++++++++++++------------- Cargo.toml | 4 +- 2 files changed, 309 insertions(+), 98 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 56547da..475e0f1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -55,6 +55,17 @@ version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" +[[package]] +name = "aead" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0" +dependencies = [ + "arrayvec", + "crypto-common", + "generic-array", +] + [[package]] name = "ahash" version = "0.8.12" @@ -141,6 +152,12 @@ dependencies = [ "windows-sys 0.60.2", ] +[[package]] +name = "arrayvec" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3fb67a6e08acf24fdeccbac2cb6ac4305825bd1f117462e0e6f2f193345ad56" + [[package]] name = "as_derive_utils" version = "0.10.3" @@ -245,6 +262,30 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "chacha20" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + +[[package]] +name = "chacha20poly1305" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10cd79432192d1c0f4e1a0fef9527696cc039165d729fb41b3f4f4f354c2dc35" +dependencies = [ + "aead", + "chacha20", + "cipher", + "poly1305", + "zeroize", +] + [[package]] name = "chrono" version = "0.4.42" @@ -259,6 +300,17 @@ dependencies = [ "windows-link", ] +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", + "zeroize", +] + [[package]] name = "coarsetime" version = "0.1.36" @@ -289,6 +341,18 @@ dependencies = [ "windows-sys 0.59.0", ] +[[package]] +name = "const-hex" +version = "1.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33e2a781ebdf4467d1428dc4593067825fb646f6871475098d8577421af73558" +dependencies = [ + "cfg-if", + "cpufeatures", + "proptest", + "serde_core", +] + [[package]] name = "core-foundation-sys" version = "0.8.7" @@ -310,6 +374,15 @@ version = "1.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "533d38ecd2709b7608fb8e18e4504deb99e9a72879e6aa66373a76d8dc4259ea" +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + [[package]] name = "crc32fast" version = "1.5.0" @@ -334,6 +407,17 @@ version = "0.8.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" +[[package]] +name = "crypto-common" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" +dependencies = [ + "generic-array", + "rand_core 0.6.4", + "typenum", +] + [[package]] name = "darling" version = "0.20.11" @@ -506,6 +590,16 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + [[package]] name = "getrandom" version = "0.2.16" @@ -517,6 +611,18 @@ dependencies = [ "wasi", ] +[[package]] +name = "getrandom" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" +dependencies = [ + "cfg-if", + "libc", + "r-efi", + "wasip2", +] + [[package]] name = "goblin" version = "0.8.2" @@ -699,6 +805,15 @@ dependencies = [ "web-time", ] +[[package]] +name = "inout" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" +dependencies = [ + "generic-array", +] + [[package]] name = "instant" version = "0.1.13" @@ -841,40 +956,6 @@ version = "2.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" -[[package]] -name = "memflow" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b5a164dd29bb697a512c389215acf4899a3e671a72844acb04d1ddac6ba8d7f" -dependencies = [ - "abi_stable", - "bitflags 1.3.2", - "bumpalo", - "cglue", - "chrono", - "coarsetime", - "dataview 1.0.1", - "dirs", - "fixed-slice-vec", - "goblin", - "hashbrown 0.14.5", - "itertools 0.12.1", - "libloading 0.8.9", - "log", - "memflow-derive 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", - "memmap", - "no-std-compat", - "num-traits", - "once_cell", - "pelite 0.9.0", - "rangemap", - "serde", - "serde_json", - "smallvec", - "toml 0.8.23", - "x86_64", -] - [[package]] name = "memflow" version = "0.2.4" @@ -894,7 +975,7 @@ dependencies = [ "itertools 0.12.1", "libloading 0.8.9", "log", - "memflow-derive 0.2.4 (git+https://github.com/forensicxlab/memflow?branch=main)", + "memflow-derive", "memmap", "no-std-compat", "num-traits", @@ -904,23 +985,10 @@ dependencies = [ "serde", "serde_json", "smallvec", - "toml 0.8.23", + "toml", "x86_64", ] -[[package]] -name = "memflow-derive" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d894dc2b0bbce37b81280e1b36da4db3e524e4df5a57d5899b4bd943f489b506" -dependencies = [ - "darling", - "proc-macro-crate", - "proc-macro2", - "quote", - "syn 2.0.110", -] - [[package]] name = "memflow-derive" version = "0.2.4" @@ -939,37 +1007,36 @@ version = "0.2.0" dependencies = [ "env_logger", "log", - "memflow 0.2.4 (git+https://github.com/forensicxlab/memflow?branch=main)", + "memflow", "memflow-win32", ] [[package]] name = "memflow-win32" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "737879c7fcfb3bca8e56eb85e43d06b0f3ff1a41123b90c4241cfee4ee09f8e8" +version = "0.2.1" +source = "git+https://github.com/forensicxlab/memflow-win32?branch=main#875fa2cb95bde955d8442beb723ec8d7a95e2c5f" dependencies = [ "log", - "memflow 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "memflow", "memflow-win32-defs", + "muddy", "no-std-compat", "pelite 0.10.0", "regex", "serde", - "toml 0.7.8", + "toml", "widestring", ] [[package]] name = "memflow-win32-defs" version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "286c3278386918d065b004f1b7f90148feeaccb96e3cdec6d10a07cbb24023cd" +source = "git+https://github.com/forensicxlab/memflow-win32?branch=main#875fa2cb95bde955d8442beb723ec8d7a95e2c5f" dependencies = [ "dirs", "indicatif", "log", - "memflow 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "memflow", "no-std-compat", "pdb", "progress-streams", @@ -997,6 +1064,32 @@ dependencies = [ "simd-adler32", ] +[[package]] +name = "muddy" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27a6fe7dd2f9fd7d385e64ba490696fc7376f7005021570a8aef1b020710285e" +dependencies = [ + "aead", + "arrayvec", + "chacha20poly1305", + "const-hex", + "muddy_macros", +] + +[[package]] +name = "muddy_macros" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c1d1b1370ba28cd45a7c771664c70dccea3d4daa42390145ed59c432ff184ea" +dependencies = [ + "chacha20poly1305", + "proc-macro2", + "quote", + "rand 0.8.8", + "syn 2.0.110", +] + [[package]] name = "no-std-compat" version = "0.4.1" @@ -1030,6 +1123,12 @@ version = "1.70.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" +[[package]] +name = "opaque-debug" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" + [[package]] name = "option-ext" version = "0.2.0" @@ -1119,6 +1218,17 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6" +[[package]] +name = "poly1305" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8159bd90725d2df49889a078b54f4f79e87f1f8a8444194cdca81d38f5393abf" +dependencies = [ + "cpufeatures", + "opaque-debug", + "universal-hash", +] + [[package]] name = "portable-atomic" version = "1.11.1" @@ -1143,6 +1253,15 @@ dependencies = [ "zerovec", ] +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + [[package]] name = "proc-macro-crate" version = "3.4.0" @@ -1167,6 +1286,21 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e965d96c8162c607b0cd8d66047ad3c9fd35273c134d994327882c6e47f986a7" +[[package]] +name = "proptest" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b45fcc2344c680f5025fe57779faef368840d0bd1f42f216291f0dc4ace4744" +dependencies = [ + "bitflags 2.10.0", + "num-traits", + "rand 0.9.5", + "rand_chacha 0.9.0", + "rand_xorshift", + "regex-syntax", + "unarray", +] + [[package]] name = "quote" version = "1.0.42" @@ -1176,6 +1310,80 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + +[[package]] +name = "rand" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e058c7de0b26af77780c769414d6257830bb240f3c38477dbc2c16e5f54d6d4c" +dependencies = [ + "libc", + "rand_chacha 0.3.1", + "rand_core 0.6.4", +] + +[[package]] +name = "rand" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9ef1d0d795eb7d84685bca4f72f3649f064e6641543d3a8c415898726a57b41" +dependencies = [ + "rand_chacha 0.9.0", + "rand_core 0.9.5", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core 0.9.5", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.16", +] + +[[package]] +name = "rand_core" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c" +dependencies = [ + "getrandom 0.3.4", +] + +[[package]] +name = "rand_xorshift" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "513962919efc330f829edb2535844d1b912b0fbe2ca165d613e4e8788bb05a5a" +dependencies = [ + "rand_core 0.9.5", +] + [[package]] name = "rangemap" version = "1.6.0" @@ -1197,7 +1405,7 @@ version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" dependencies = [ - "getrandom", + "getrandom 0.2.16", "libredox", "thiserror", ] @@ -1248,7 +1456,7 @@ checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" dependencies = [ "cc", "cfg-if", - "getrandom", + "getrandom 0.2.16", "libc", "untrusted", "windows-sys 0.52.0", @@ -1529,18 +1737,6 @@ dependencies = [ "zerovec", ] -[[package]] -name = "toml" -version = "0.7.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd79e69d3b627db300ff956027cc6c3798cef26d22526befdfcd12feeb6d2257" -dependencies = [ - "serde", - "serde_spanned", - "toml_datetime 0.6.11", - "toml_edit 0.19.15", -] - [[package]] name = "toml" version = "0.8.23" @@ -1571,19 +1767,6 @@ dependencies = [ "serde_core", ] -[[package]] -name = "toml_edit" -version = "0.19.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" -dependencies = [ - "indexmap", - "serde", - "serde_spanned", - "toml_datetime 0.6.11", - "winnow 0.5.40", -] - [[package]] name = "toml_edit" version = "0.22.27" @@ -1595,7 +1778,7 @@ dependencies = [ "serde_spanned", "toml_datetime 0.6.11", "toml_write", - "winnow 0.7.13", + "winnow", ] [[package]] @@ -1607,7 +1790,7 @@ dependencies = [ "indexmap", "toml_datetime 0.7.3", "toml_parser", - "winnow 0.7.13", + "winnow", ] [[package]] @@ -1616,7 +1799,7 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0cbe268d35bdb4bb5a56a2de88d0ad0eb70af5384a99d648cd4b3d04039800e" dependencies = [ - "winnow 0.7.13", + "winnow", ] [[package]] @@ -1646,6 +1829,18 @@ version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6af6ae20167a9ece4bcb41af5b80f8a1f1df981f6391189ce00fd257af04126a" +[[package]] +name = "typenum" +version = "1.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20" + +[[package]] +name = "unarray" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" + [[package]] name = "unicode-ident" version = "1.0.22" @@ -1658,6 +1853,16 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254" +[[package]] +name = "universal-hash" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea" +dependencies = [ + "crypto-common", + "subtle", +] + [[package]] name = "untrusted" version = "0.9.0" @@ -1732,6 +1937,15 @@ version = "0.11.1+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" +[[package]] +name = "wasip2" +version = "1.0.4+wasi-0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b67efb37e106e55ce722a510d6b5f9c17f083e5fc79afc2badeb12cc313d9487" +dependencies = [ + "wit-bindgen", +] + [[package]] name = "wasix" version = "0.12.21" @@ -2125,21 +2339,18 @@ checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650" [[package]] name = "winnow" -version = "0.5.40" +version = "0.7.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" +checksum = "21a0236b59786fed61e2a80582dd500fe61f18b5dca67a4a067d0bc9039339cf" dependencies = [ "memchr", ] [[package]] -name = "winnow" -version = "0.7.13" +name = "wit-bindgen" +version = "0.57.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21a0236b59786fed61e2a80582dd500fe61f18b5dca67a4a067d0bc9039339cf" -dependencies = [ - "memchr", -] +checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e" [[package]] name = "writeable" diff --git a/Cargo.toml b/Cargo.toml index 4ade03f..92efad2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,13 +16,13 @@ categories = ["api-bindings", "memory-management", "os"] crate-type = ["lib", "cdylib"] [dependencies] -memflow = { git = "https://github.com/forensicxlab/memflow", branch = "main", features = ["plugins", "filemap"] } +memflow = { version = "0.2.4", git = "https://github.com/forensicxlab/memflow", branch = "main", features = ["plugins", "filemap"] } log = { version = "0.4", default-features = false } [dev-dependencies] env_logger = "0.11" -memflow-win32 = { version = "0.2" } +memflow-win32 = { version = "0.2", git = "https://github.com/forensicxlab/memflow-win32", branch = "main" } [profile.release] lto = true