add binnpat, binnpats

for parse pattern
This commit is contained in:
2022-08-27 23:41:25 +03:00
parent 22bdffa92f
commit 2d5b27d423
2 changed files with 147 additions and 10 deletions

View File

@@ -9,18 +9,17 @@ use std::fs;
use std::fs::{File, OpenOptions};
use std::ops::{Deref, DerefMut};
use binnpatch::{ApplyPatch, BytesPattern, FindPattern};
use binnpatch_macro::binnvecs;
use binnpatch::{ApplyPatch, FindPattern};
use binnpatch_macro::{binnpats, binnvecs};
fn main() {
let src_file = "Some.dll";
let dst_file = "Some.dll.patched";
let src_pattern = "40 3E 1D ?? ?? 12 1C 7C 48 ?? 73 6F 02 22 ?? 61 19 4E 13 60 48 45 19 27 5B";
let pattern =
binnpats!("40 3E 1D ?? ?? 12 1C 7C 48 ?? 73 6F 02 22 ?? 61 19 4E 13 60 48 45 19 27 5B");
let replacement =
binnvecs!("06 5A 18 74 2D 62 12 6A 13 4A 2B 0E 6F 0F 36 7A 28 0A 37 67 0A 4B 01 73 14");
let pattern = src_pattern.parse().unwrap();
let file = File::open(src_file).expect("src open");
let src_map = unsafe { Mmap::map(&file) }.expect("src map");