First instance of anything that works
This commit is contained in:
		
							
								
								
									
										11
									
								
								analyzer/binaries/main.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								analyzer/binaries/main.json
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										0
									
								
								analyzer/dumps/data.dat
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								analyzer/dumps/data.dat
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										
											BIN
										
									
								
								analyzer/dumps/rdata.dat
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								analyzer/dumps/rdata.dat
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								analyzer/dumps/starting_state.dat
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								analyzer/dumps/starting_state.dat
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								analyzer/dumps/text.dat
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								analyzer/dumps/text.dat
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										84
									
								
								analyzer/main.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										84
									
								
								analyzer/main.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,84 @@ | |||||||
|  | import base64 | ||||||
|  | from io import BytesIO | ||||||
|  | import json | ||||||
|  | import pefile | ||||||
|  |  | ||||||
|  | def main(): | ||||||
|  |     subject = pefile.PE("subjects\\main.exe") | ||||||
|  |  | ||||||
|  |     def _single_or_none(x): | ||||||
|  |         items = [i for i in x] | ||||||
|  |         if len(items) == 0: | ||||||
|  |             return None | ||||||
|  |  | ||||||
|  |         assert len(items) == 1 | ||||||
|  |         return items[0] | ||||||
|  |  | ||||||
|  |     def _dump(fname, section): | ||||||
|  |         with open(fname, "wb") as f: | ||||||
|  |             if section is not None: | ||||||
|  |                 if isinstance(section, bytes): | ||||||
|  |                     f.write(section) | ||||||
|  |                 else: | ||||||
|  |                     f.write(section.get_data()) | ||||||
|  |  | ||||||
|  |     for i in subject.sections: | ||||||
|  |         print(i) | ||||||
|  |  | ||||||
|  |     text_section = _single_or_none(i for i in subject.sections if i.Name == b".text\0\0\0") | ||||||
|  |     data_section = _single_or_none(i for i in subject.sections if i.Name == b".data\0\0\0") | ||||||
|  |     rdata_section = _single_or_none(i for i in subject.sections if i.Name == b".rdata\0\0") | ||||||
|  |  | ||||||
|  |     _dump("dumps\\text.dat", text_section) | ||||||
|  |     _dump("dumps\\data.dat", data_section) | ||||||
|  |     _dump("dumps\\rdata.dat", rdata_section) | ||||||
|  |  | ||||||
|  |     relevant_sections = [section for section in (text_section, data_section, rdata_section) if section is not None] | ||||||
|  |     if len(relevant_sections) == 0: | ||||||
|  |         raise ValueError("no sections to plot") | ||||||
|  |     min_address = min(i.VirtualAddress for i in relevant_sections) | ||||||
|  |     max_address = max(_round_up_to_page(i.VirtualAddress + i.SizeOfRawData) for i in relevant_sections) | ||||||
|  |  | ||||||
|  |     print(min_address, max_address) | ||||||
|  |     buffer = bytearray(max_address - min_address) | ||||||
|  |     for section in relevant_sections: | ||||||
|  |         data = section.get_data()  # TODO: De-pad the text section from 0xccs | ||||||
|  |         start = section.VirtualAddress - min_address | ||||||
|  |         buffer[start:start+len(data)] = data | ||||||
|  |     buffer = bytes(buffer) | ||||||
|  |      | ||||||
|  |     _dump("dumps\\starting_state.dat", buffer) | ||||||
|  |  | ||||||
|  |     binary = { | ||||||
|  |         "startingState": base64.b64encode(buffer).decode("utf8"), | ||||||
|  |         "imports": [], | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     # find imports | ||||||
|  |     # print(subject) | ||||||
|  |     # print(dir(subject)) | ||||||
|  |     for entry in subject.DIRECTORY_ENTRY_IMPORT: | ||||||
|  |  | ||||||
|  |         # print(entry.dll) | ||||||
|  |         for imp in entry.imports: | ||||||
|  |             # print(dir(imp)) | ||||||
|  |             import_address = imp.address - subject.OPTIONAL_HEADER.ImageBase - min_address | ||||||
|  |             print(hex(import_address), imp.name) | ||||||
|  |             binary["imports"].append({ | ||||||
|  |                 "dll": entry.dll.decode("utf8"), | ||||||
|  |                 "symbol": imp.name.decode("utf8"), | ||||||
|  |                 "address": import_address, | ||||||
|  |             }) | ||||||
|  |  | ||||||
|  |     entry_point_rva = subject.OPTIONAL_HEADER.AddressOfEntryPoint | ||||||
|  |     binary["entryPoint"] = entry_point_rva - min_address | ||||||
|  |     with open("binaries/main.json", "wt") as f: | ||||||
|  |         f.write(json.dumps(binary, indent=4)) | ||||||
|  |  | ||||||
|  |  | ||||||
|  | def _round_up_to_page(x: int): | ||||||
|  |     # TODO: Is this the page size on x64? I think it is | ||||||
|  |     return ((x + 0x1000 - 1) // 0x1000) * 0x1000 | ||||||
|  |  | ||||||
|  | if __name__ == "__main__": | ||||||
|  |     main() | ||||||
							
								
								
									
										17
									
								
								analyzer/poetry.lock
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								analyzer/poetry.lock
									
									
									
										generated
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,17 @@ | |||||||
|  | # This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand. | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | name = "pefile" | ||||||
|  | version = "2024.8.26" | ||||||
|  | description = "Python PE parsing module" | ||||||
|  | optional = false | ||||||
|  | python-versions = ">=3.6.0" | ||||||
|  | files = [ | ||||||
|  |     {file = "pefile-2024.8.26-py3-none-any.whl", hash = "sha256:76f8b485dcd3b1bb8166f1128d395fa3d87af26360c2358fb75b80019b957c6f"}, | ||||||
|  |     {file = "pefile-2024.8.26.tar.gz", hash = "sha256:3ff6c5d8b43e8c37bb6e6dd5085658d658a7a0bdcd20b6a07b1fcfc1c4e9d632"}, | ||||||
|  | ] | ||||||
|  |  | ||||||
|  | [metadata] | ||||||
|  | lock-version = "2.0" | ||||||
|  | python-versions = "^3.10" | ||||||
|  | content-hash = "6f28e4dc3bf3b09c57354693b75dc7975b70a7aac2ee7c83fc81b0058520d7f9" | ||||||
							
								
								
									
										15
									
								
								analyzer/pyproject.toml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								analyzer/pyproject.toml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,15 @@ | |||||||
|  | [tool.poetry] | ||||||
|  | name = "analyzer" | ||||||
|  | version = "0.1.0" | ||||||
|  | description = "" | ||||||
|  | authors = ["Nyeogmi <economicsbat@gmail.com>"] | ||||||
|  | readme = "README.md" | ||||||
|  |  | ||||||
|  | [tool.poetry.dependencies] | ||||||
|  | python = "^3.10" | ||||||
|  | pefile = "^2024.8.26" | ||||||
|  |  | ||||||
|  |  | ||||||
|  | [build-system] | ||||||
|  | requires = ["poetry-core"] | ||||||
|  | build-backend = "poetry.core.masonry.api" | ||||||
							
								
								
									
										
											BIN
										
									
								
								analyzer/subjects/main.exe
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								analyzer/subjects/main.exe
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										4
									
								
								injectable_binary/build.bat
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								injectable_binary/build.bat
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,4 @@ | |||||||
|  | @zig cc main.c -o main.exe -Os -nostdlib -nodefaultlibs -luser32 | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
							
								
								
									
										5
									
								
								injectable_binary/main.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								injectable_binary/main.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,5 @@ | |||||||
|  | extern void MessageBoxA(int, char*, char*, int); | ||||||
|  |  | ||||||
|  | void wWinMainCRTStartup() { | ||||||
|  |     MessageBoxA(0, "Hello, world!", "Hello, world!", 0); | ||||||
|  | } | ||||||
							
								
								
									
										
											BIN
										
									
								
								injectable_binary/main.exe
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								injectable_binary/main.exe
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										1
									
								
								runner/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								runner/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | |||||||
|  | /target | ||||||
							
								
								
									
										620
									
								
								runner/Cargo.lock
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										620
									
								
								runner/Cargo.lock
									
									
									
										generated
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,620 @@ | |||||||
|  | # This file is automatically @generated by Cargo. | ||||||
|  | # It is not intended for manual editing. | ||||||
|  | version = 4 | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | name = "android-tzdata" | ||||||
|  | version = "0.1.1" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | name = "android_system_properties" | ||||||
|  | version = "0.1.5" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" | ||||||
|  | dependencies = [ | ||||||
|  |  "libc", | ||||||
|  | ] | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | name = "autocfg" | ||||||
|  | version = "1.4.0" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | name = "base64" | ||||||
|  | version = "0.22.1" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | name = "bumpalo" | ||||||
|  | version = "3.17.0" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "1628fb46dfa0b37568d12e5edd512553eccf6a22a78e8bde00bb4aed84d5bdbf" | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | name = "cc" | ||||||
|  | version = "1.2.19" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "8e3a13707ac958681c13b39b458c073d0d9bc8a22cb1b2f4c8e55eb72c13f362" | ||||||
|  | dependencies = [ | ||||||
|  |  "shlex", | ||||||
|  | ] | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | name = "cfg-if" | ||||||
|  | version = "1.0.0" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | name = "chrono" | ||||||
|  | version = "0.4.40" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "1a7964611d71df112cb1730f2ee67324fcf4d0fc6606acbbe9bfe06df124637c" | ||||||
|  | dependencies = [ | ||||||
|  |  "android-tzdata", | ||||||
|  |  "iana-time-zone", | ||||||
|  |  "num-traits", | ||||||
|  |  "serde", | ||||||
|  |  "windows-link", | ||||||
|  | ] | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | name = "core-foundation-sys" | ||||||
|  | version = "0.8.7" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | name = "darling" | ||||||
|  | version = "0.20.11" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee" | ||||||
|  | dependencies = [ | ||||||
|  |  "darling_core", | ||||||
|  |  "darling_macro", | ||||||
|  | ] | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | name = "darling_core" | ||||||
|  | version = "0.20.11" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "0d00b9596d185e565c2207a0b01f8bd1a135483d02d9b7b0a54b11da8d53412e" | ||||||
|  | dependencies = [ | ||||||
|  |  "fnv", | ||||||
|  |  "ident_case", | ||||||
|  |  "proc-macro2", | ||||||
|  |  "quote", | ||||||
|  |  "strsim", | ||||||
|  |  "syn", | ||||||
|  | ] | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | name = "darling_macro" | ||||||
|  | version = "0.20.11" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" | ||||||
|  | dependencies = [ | ||||||
|  |  "darling_core", | ||||||
|  |  "quote", | ||||||
|  |  "syn", | ||||||
|  | ] | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | name = "deranged" | ||||||
|  | version = "0.4.0" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "9c9e6a11ca8224451684bc0d7d5a7adbf8f2fd6887261a1cfc3c0432f9d4068e" | ||||||
|  | dependencies = [ | ||||||
|  |  "powerfmt", | ||||||
|  |  "serde", | ||||||
|  | ] | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | name = "equivalent" | ||||||
|  | version = "1.0.2" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | name = "fnv" | ||||||
|  | version = "1.0.7" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | name = "hashbrown" | ||||||
|  | version = "0.12.3" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | name = "hashbrown" | ||||||
|  | version = "0.15.2" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | name = "hex" | ||||||
|  | version = "0.4.3" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | name = "iana-time-zone" | ||||||
|  | version = "0.1.63" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "b0c919e5debc312ad217002b8048a17b7d83f80703865bbfcfebb0458b0b27d8" | ||||||
|  | dependencies = [ | ||||||
|  |  "android_system_properties", | ||||||
|  |  "core-foundation-sys", | ||||||
|  |  "iana-time-zone-haiku", | ||||||
|  |  "js-sys", | ||||||
|  |  "log", | ||||||
|  |  "wasm-bindgen", | ||||||
|  |  "windows-core", | ||||||
|  | ] | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | name = "iana-time-zone-haiku" | ||||||
|  | version = "0.1.2" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" | ||||||
|  | dependencies = [ | ||||||
|  |  "cc", | ||||||
|  | ] | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | name = "ident_case" | ||||||
|  | version = "1.0.1" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | name = "indexmap" | ||||||
|  | version = "1.9.3" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" | ||||||
|  | dependencies = [ | ||||||
|  |  "autocfg", | ||||||
|  |  "hashbrown 0.12.3", | ||||||
|  |  "serde", | ||||||
|  | ] | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | name = "indexmap" | ||||||
|  | version = "2.9.0" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "cea70ddb795996207ad57735b50c5982d8844f38ba9ee5f1aedcfb708a2aa11e" | ||||||
|  | dependencies = [ | ||||||
|  |  "equivalent", | ||||||
|  |  "hashbrown 0.15.2", | ||||||
|  |  "serde", | ||||||
|  | ] | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | name = "itoa" | ||||||
|  | version = "1.0.15" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | name = "js-sys" | ||||||
|  | version = "0.3.77" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f" | ||||||
|  | dependencies = [ | ||||||
|  |  "once_cell", | ||||||
|  |  "wasm-bindgen", | ||||||
|  | ] | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | name = "libc" | ||||||
|  | version = "0.2.172" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa" | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | name = "log" | ||||||
|  | version = "0.4.27" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | name = "memchr" | ||||||
|  | version = "2.7.4" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | name = "num-conv" | ||||||
|  | version = "0.1.0" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | name = "num-traits" | ||||||
|  | version = "0.2.19" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" | ||||||
|  | dependencies = [ | ||||||
|  |  "autocfg", | ||||||
|  | ] | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | name = "once_cell" | ||||||
|  | version = "1.21.3" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | name = "powerfmt" | ||||||
|  | version = "0.2.0" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | name = "proc-macro2" | ||||||
|  | version = "1.0.95" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" | ||||||
|  | dependencies = [ | ||||||
|  |  "unicode-ident", | ||||||
|  | ] | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | name = "quote" | ||||||
|  | version = "1.0.40" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" | ||||||
|  | dependencies = [ | ||||||
|  |  "proc-macro2", | ||||||
|  | ] | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | name = "runner" | ||||||
|  | version = "0.1.0" | ||||||
|  | dependencies = [ | ||||||
|  |  "serde", | ||||||
|  |  "serde_bytes", | ||||||
|  |  "serde_json", | ||||||
|  |  "serde_with", | ||||||
|  |  "windows-sys", | ||||||
|  | ] | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | name = "rustversion" | ||||||
|  | version = "1.0.20" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "eded382c5f5f786b989652c49544c4877d9f015cc22e145a5ea8ea66c2921cd2" | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | name = "ryu" | ||||||
|  | version = "1.0.20" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | name = "serde" | ||||||
|  | version = "1.0.219" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" | ||||||
|  | dependencies = [ | ||||||
|  |  "serde_derive", | ||||||
|  | ] | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | name = "serde_bytes" | ||||||
|  | version = "0.11.17" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "8437fd221bde2d4ca316d61b90e337e9e702b3820b87d63caa9ba6c02bd06d96" | ||||||
|  | dependencies = [ | ||||||
|  |  "serde", | ||||||
|  | ] | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | name = "serde_derive" | ||||||
|  | version = "1.0.219" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" | ||||||
|  | dependencies = [ | ||||||
|  |  "proc-macro2", | ||||||
|  |  "quote", | ||||||
|  |  "syn", | ||||||
|  | ] | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | name = "serde_json" | ||||||
|  | version = "1.0.140" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373" | ||||||
|  | dependencies = [ | ||||||
|  |  "itoa", | ||||||
|  |  "memchr", | ||||||
|  |  "ryu", | ||||||
|  |  "serde", | ||||||
|  | ] | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | name = "serde_with" | ||||||
|  | version = "3.12.0" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "d6b6f7f2fcb69f747921f79f3926bd1e203fce4fef62c268dd3abfb6d86029aa" | ||||||
|  | dependencies = [ | ||||||
|  |  "base64", | ||||||
|  |  "chrono", | ||||||
|  |  "hex", | ||||||
|  |  "indexmap 1.9.3", | ||||||
|  |  "indexmap 2.9.0", | ||||||
|  |  "serde", | ||||||
|  |  "serde_derive", | ||||||
|  |  "serde_json", | ||||||
|  |  "serde_with_macros", | ||||||
|  |  "time", | ||||||
|  | ] | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | name = "serde_with_macros" | ||||||
|  | version = "3.12.0" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "8d00caa5193a3c8362ac2b73be6b9e768aa5a4b2f721d8f4b339600c3cb51f8e" | ||||||
|  | dependencies = [ | ||||||
|  |  "darling", | ||||||
|  |  "proc-macro2", | ||||||
|  |  "quote", | ||||||
|  |  "syn", | ||||||
|  | ] | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | name = "shlex" | ||||||
|  | version = "1.3.0" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | name = "strsim" | ||||||
|  | version = "0.11.1" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | name = "syn" | ||||||
|  | version = "2.0.100" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "b09a44accad81e1ba1cd74a32461ba89dee89095ba17b32f5d03683b1b1fc2a0" | ||||||
|  | dependencies = [ | ||||||
|  |  "proc-macro2", | ||||||
|  |  "quote", | ||||||
|  |  "unicode-ident", | ||||||
|  | ] | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | name = "time" | ||||||
|  | version = "0.3.41" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "8a7619e19bc266e0f9c5e6686659d394bc57973859340060a69221e57dbc0c40" | ||||||
|  | dependencies = [ | ||||||
|  |  "deranged", | ||||||
|  |  "itoa", | ||||||
|  |  "num-conv", | ||||||
|  |  "powerfmt", | ||||||
|  |  "serde", | ||||||
|  |  "time-core", | ||||||
|  |  "time-macros", | ||||||
|  | ] | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | name = "time-core" | ||||||
|  | version = "0.1.4" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "c9e9a38711f559d9e3ce1cdb06dd7c5b8ea546bc90052da6d06bb76da74bb07c" | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | name = "time-macros" | ||||||
|  | version = "0.2.22" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "3526739392ec93fd8b359c8e98514cb3e8e021beb4e5f597b00a0221f8ed8a49" | ||||||
|  | dependencies = [ | ||||||
|  |  "num-conv", | ||||||
|  |  "time-core", | ||||||
|  | ] | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | name = "unicode-ident" | ||||||
|  | version = "1.0.18" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | name = "wasm-bindgen" | ||||||
|  | version = "0.2.100" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5" | ||||||
|  | dependencies = [ | ||||||
|  |  "cfg-if", | ||||||
|  |  "once_cell", | ||||||
|  |  "rustversion", | ||||||
|  |  "wasm-bindgen-macro", | ||||||
|  | ] | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | name = "wasm-bindgen-backend" | ||||||
|  | version = "0.2.100" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6" | ||||||
|  | dependencies = [ | ||||||
|  |  "bumpalo", | ||||||
|  |  "log", | ||||||
|  |  "proc-macro2", | ||||||
|  |  "quote", | ||||||
|  |  "syn", | ||||||
|  |  "wasm-bindgen-shared", | ||||||
|  | ] | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | name = "wasm-bindgen-macro" | ||||||
|  | version = "0.2.100" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407" | ||||||
|  | dependencies = [ | ||||||
|  |  "quote", | ||||||
|  |  "wasm-bindgen-macro-support", | ||||||
|  | ] | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | name = "wasm-bindgen-macro-support" | ||||||
|  | version = "0.2.100" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" | ||||||
|  | dependencies = [ | ||||||
|  |  "proc-macro2", | ||||||
|  |  "quote", | ||||||
|  |  "syn", | ||||||
|  |  "wasm-bindgen-backend", | ||||||
|  |  "wasm-bindgen-shared", | ||||||
|  | ] | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | name = "wasm-bindgen-shared" | ||||||
|  | version = "0.2.100" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d" | ||||||
|  | dependencies = [ | ||||||
|  |  "unicode-ident", | ||||||
|  | ] | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | name = "windows-core" | ||||||
|  | version = "0.61.0" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "4763c1de310c86d75a878046489e2e5ba02c649d185f21c67d4cf8a56d098980" | ||||||
|  | dependencies = [ | ||||||
|  |  "windows-implement", | ||||||
|  |  "windows-interface", | ||||||
|  |  "windows-link", | ||||||
|  |  "windows-result", | ||||||
|  |  "windows-strings", | ||||||
|  | ] | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | name = "windows-implement" | ||||||
|  | version = "0.60.0" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "a47fddd13af08290e67f4acabf4b459f647552718f683a7b415d290ac744a836" | ||||||
|  | dependencies = [ | ||||||
|  |  "proc-macro2", | ||||||
|  |  "quote", | ||||||
|  |  "syn", | ||||||
|  | ] | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | name = "windows-interface" | ||||||
|  | version = "0.59.1" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8" | ||||||
|  | dependencies = [ | ||||||
|  |  "proc-macro2", | ||||||
|  |  "quote", | ||||||
|  |  "syn", | ||||||
|  | ] | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | name = "windows-link" | ||||||
|  | version = "0.1.1" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "76840935b766e1b0a05c0066835fb9ec80071d4c09a16f6bd5f7e655e3c14c38" | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | name = "windows-result" | ||||||
|  | version = "0.3.2" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "c64fd11a4fd95df68efcfee5f44a294fe71b8bc6a91993e2791938abcc712252" | ||||||
|  | dependencies = [ | ||||||
|  |  "windows-link", | ||||||
|  | ] | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | name = "windows-strings" | ||||||
|  | version = "0.4.0" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "7a2ba9642430ee452d5a7aa78d72907ebe8cfda358e8cb7918a2050581322f97" | ||||||
|  | dependencies = [ | ||||||
|  |  "windows-link", | ||||||
|  | ] | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | name = "windows-sys" | ||||||
|  | version = "0.59.0" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" | ||||||
|  | dependencies = [ | ||||||
|  |  "windows-targets", | ||||||
|  | ] | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | name = "windows-targets" | ||||||
|  | version = "0.52.6" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" | ||||||
|  | dependencies = [ | ||||||
|  |  "windows_aarch64_gnullvm", | ||||||
|  |  "windows_aarch64_msvc", | ||||||
|  |  "windows_i686_gnu", | ||||||
|  |  "windows_i686_gnullvm", | ||||||
|  |  "windows_i686_msvc", | ||||||
|  |  "windows_x86_64_gnu", | ||||||
|  |  "windows_x86_64_gnullvm", | ||||||
|  |  "windows_x86_64_msvc", | ||||||
|  | ] | ||||||
|  |  | ||||||
|  | [[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_msvc" | ||||||
|  | version = "0.52.6" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" | ||||||
|  |  | ||||||
|  | [[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_gnullvm" | ||||||
|  | version = "0.52.6" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | name = "windows_i686_msvc" | ||||||
|  | version = "0.52.6" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" | ||||||
|  |  | ||||||
|  | [[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_gnullvm" | ||||||
|  | version = "0.52.6" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | name = "windows_x86_64_msvc" | ||||||
|  | version = "0.52.6" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" | ||||||
							
								
								
									
										11
									
								
								runner/Cargo.toml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								runner/Cargo.toml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,11 @@ | |||||||
|  | [package] | ||||||
|  | name = "runner" | ||||||
|  | version = "0.1.0" | ||||||
|  | edition = "2021" | ||||||
|  |  | ||||||
|  | [dependencies] | ||||||
|  | serde = {version = "1.0.219", features=["derive"]} | ||||||
|  | serde_bytes = "0.11.17" | ||||||
|  | serde_json = "1.0.140" | ||||||
|  | serde_with = {version="3.12.0", features=["base64"]} | ||||||
|  | windows-sys = {version="0.59.0", features=["Win32_System_Memory", "Win32_System_LibraryLoader"]} | ||||||
							
								
								
									
										11
									
								
								runner/binaries/main.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								runner/binaries/main.json
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										85
									
								
								runner/src/main.rs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										85
									
								
								runner/src/main.rs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,85 @@ | |||||||
|  | use std::ffi::c_void; | ||||||
|  | use std::ptr; | ||||||
|  | use std::{fs::File, io::Read}; | ||||||
|  |  | ||||||
|  | use serde::Deserialize; | ||||||
|  | use serde_with::base64::{Base64, Standard}; | ||||||
|  | use serde_with::formats::Padded; | ||||||
|  | use serde_with::serde_as; | ||||||
|  |  | ||||||
|  | use windows_sys::Win32::Foundation::HMODULE; | ||||||
|  | use windows_sys::Win32::System::LibraryLoader; | ||||||
|  | use windows_sys::Win32::System::Memory; | ||||||
|  |  | ||||||
|  | #[serde_as] | ||||||
|  | #[derive(Debug, Deserialize)] | ||||||
|  | struct Import { | ||||||
|  |     #[serde(with = "serde_bytes")] | ||||||
|  |     dll: Vec<u8>, | ||||||
|  |     #[serde(with = "serde_bytes")] | ||||||
|  |     symbol: Vec<u8>, | ||||||
|  |     address: usize, | ||||||
|  | } | ||||||
|  |  | ||||||
|  | #[serde_as] | ||||||
|  | #[derive(Debug, Deserialize)] | ||||||
|  | struct Binary { | ||||||
|  |     #[serde(rename = "startingState")] | ||||||
|  |     #[serde_as(as = "Base64<Standard, Padded>")] | ||||||
|  |     starting_state: Vec<u8>, | ||||||
|  |     imports: Vec<Import>, | ||||||
|  |     #[serde(rename = "entryPoint")] | ||||||
|  |     entry_point: usize, | ||||||
|  | } | ||||||
|  | fn main() { | ||||||
|  |     unsafe { _main() } | ||||||
|  | } | ||||||
|  | unsafe fn _main() { | ||||||
|  |     let mut input = File::open("binaries/main.json").unwrap(); | ||||||
|  |     let mut buf: Vec<u8> = vec![]; | ||||||
|  |     let _ = input.read_to_end(&mut buf).unwrap(); | ||||||
|  |  | ||||||
|  |     let binary = serde_json::from_slice::<Binary>(&buf).unwrap(); | ||||||
|  |     println!("Binary: {:?}", binary); | ||||||
|  |  | ||||||
|  |     let address_space = Memory::VirtualAlloc( | ||||||
|  |         ptr::null(), | ||||||
|  |         binary.starting_state.len(), | ||||||
|  |         Memory::MEM_COMMIT | Memory::MEM_RESERVE, | ||||||
|  |         Memory::PAGE_EXECUTE_READWRITE, | ||||||
|  |     ); | ||||||
|  |     address_space.copy_from( | ||||||
|  |         binary.starting_state.as_ptr() as *const c_void, | ||||||
|  |         binary.starting_state.len(), | ||||||
|  |     ); | ||||||
|  |     for i in binary.imports.iter() { | ||||||
|  |         let mut lcpstr_dll = vec![]; | ||||||
|  |         lcpstr_dll.extend(&i.dll); | ||||||
|  |         lcpstr_dll.push(0); | ||||||
|  |  | ||||||
|  |         let mut lpcstr_procname = vec![]; | ||||||
|  |         lpcstr_procname.extend(&i.symbol); | ||||||
|  |         lpcstr_procname.push(0); | ||||||
|  |  | ||||||
|  |         println!("handling import"); | ||||||
|  |         let dll: HMODULE = LibraryLoader::LoadLibraryA(lcpstr_dll.as_ptr()); | ||||||
|  |  | ||||||
|  |         // TODO: Free anything? No real need to. | ||||||
|  |         let proc = LibraryLoader::GetProcAddress(dll, lpcstr_procname.as_ptr()).unwrap(); | ||||||
|  |         let proc_ptr = proc as *mut c_void; | ||||||
|  |         println!( | ||||||
|  |             "writing at {} out of {}", | ||||||
|  |             i.address, | ||||||
|  |             binary.starting_state.len() | ||||||
|  |         ); | ||||||
|  |         let location = address_space.byte_add(i.address) as *mut *mut c_void; | ||||||
|  |         *location = proc_ptr; | ||||||
|  |         println!("handled import"); | ||||||
|  |     } | ||||||
|  |     println!("done with imports"); | ||||||
|  |     let fn_start = address_space.byte_add(binary.entry_point); | ||||||
|  |     let function: unsafe fn() -> () = std::mem::transmute(fn_start); | ||||||
|  |  | ||||||
|  |     function(); | ||||||
|  |     println!("returned"); | ||||||
|  | } | ||||||
		Reference in New Issue
	
	Block a user