Fix libafl_qemu python bindings and example (#2030)
This commit is contained in:
parent
f252469d86
commit
33c6ea1ae4
17
fuzzers/python_qemu/README.md
Normal file
17
fuzzers/python_qemu/README.md
Normal file
@ -0,0 +1,17 @@
|
||||
# Python LibAFL QEMU
|
||||
|
||||
## Build
|
||||
|
||||
First, install python bindings (check `LibAFL/bindings/pylibafl`) and use the virtual environment.
|
||||
|
||||
Then, create the `in` folder and put some input inside
|
||||
```bash
|
||||
$ mkdir in
|
||||
$ echo aaaaa > in/input
|
||||
```
|
||||
|
||||
## Run
|
||||
|
||||
```bash
|
||||
$ python fuzzer.py
|
||||
```
|
@ -6,7 +6,7 @@ import lief
|
||||
MAX_SIZE = 0x100
|
||||
BINARY_PATH = './a.out'
|
||||
|
||||
emu = qemu.Emulator(['qemu-x86_64', BINARY_PATH], [])
|
||||
emu = qemu.Qemu(['qemu-x86_64', BINARY_PATH], [])
|
||||
|
||||
elf = lief.parse(BINARY_PATH)
|
||||
test_one_input = elf.get_function_address("LLVMFuzzerTestOneInput")
|
||||
|
@ -1813,6 +1813,12 @@ pub mod pybind {
|
||||
Ok(Qemu { qemu })
|
||||
}
|
||||
|
||||
fn run(&self) {
|
||||
unsafe {
|
||||
self.qemu.run().unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
fn write_mem(&self, addr: GuestAddr, buf: &[u8]) {
|
||||
unsafe {
|
||||
self.qemu.write_mem(addr, buf);
|
||||
|
@ -209,7 +209,7 @@ where
|
||||
let mut harness = |input: &BytesInput| {
|
||||
let target = input.target_bytes();
|
||||
let buf = target.as_slice();
|
||||
(harness_bytes)(buf);
|
||||
harness_bytes(buf);
|
||||
ExitKind::Ok
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user