initial commit
This commit is contained in:
commit
bca91aeafb
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
/target
|
||||
Cargo.lock
|
9
Cargo.toml
Normal file
9
Cargo.toml
Normal file
@ -0,0 +1,9 @@
|
||||
[package]
|
||||
name = "afl"
|
||||
version = "0.1.0"
|
||||
authors = ["Dominik Maier <domenukk@gmail.com>"]
|
||||
edition = "2018"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
28
src/engines/engine.rs
Normal file
28
src/engines/engine.rs
Normal file
@ -0,0 +1,28 @@
|
||||
use std::time;
|
||||
|
||||
pub trait RandState {}
|
||||
pub trait Executor {}
|
||||
pub trait Feedback {}
|
||||
pub trait Stage {}
|
||||
|
||||
pub trait Monitor {}
|
||||
|
||||
pub struct DefaultEngine {
|
||||
|
||||
pub rand: Box<dyn RandState>,
|
||||
pub feedback: Vec<Box<dyn Feedback>>,
|
||||
|
||||
pub stages: Vec<Box<dyn Stage>>,
|
||||
pub current_stage: Box<dyn Stage>,
|
||||
|
||||
pub executor: Box<dyn Executor>,
|
||||
|
||||
pub executions: u64,
|
||||
|
||||
pub time_start: time::SystemTime,
|
||||
pub time_last_find: Option<time::SystemTime>,
|
||||
|
||||
// TODO: Map
|
||||
pub monitors: Vec<Box<dyn Monitor>>,
|
||||
|
||||
}
|
5
src/engines/mod.rs
Normal file
5
src/engines/mod.rs
Normal file
@ -0,0 +1,5 @@
|
||||
pub mod engine;
|
||||
|
||||
pub trait Engine {
|
||||
|
||||
}
|
0
src/engines/monitor.rs
Normal file
0
src/engines/monitor.rs
Normal file
20
src/inputs/bytes.rs
Normal file
20
src/inputs/bytes.rs
Normal file
@ -0,0 +1,20 @@
|
||||
use crate::inputs::Input;
|
||||
|
||||
use std::io::Error;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct BytesInput {
|
||||
bytes: Vec<u8>,
|
||||
}
|
||||
|
||||
impl Input for BytesInput {
|
||||
|
||||
fn serialize(&self) -> Result<&[u8], Error> {
|
||||
Ok(&self.bytes)
|
||||
}
|
||||
fn deserialize(&mut self, buf: &[u8]) -> Result<(), Error> {
|
||||
self.bytes.truncate(0);
|
||||
self.bytes.extend_from_slice(buf);
|
||||
Ok(())
|
||||
}
|
||||
}
|
28
src/inputs/mod.rs
Normal file
28
src/inputs/mod.rs
Normal file
@ -0,0 +1,28 @@
|
||||
pub mod bytes;
|
||||
|
||||
use std::io::Error;
|
||||
use std::fs::File;
|
||||
use std::io::Write;
|
||||
use std::io::Read;
|
||||
|
||||
pub trait Input {
|
||||
|
||||
fn to_file(&self, path: &str) -> Result<(), Error> {
|
||||
let mut file = File::create(path)?;
|
||||
file.write_all(self.serialize()?)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn from_file(&mut self, path: &str) -> Result<(), Error> {
|
||||
let mut file = File::create(path)?;
|
||||
let mut buf = vec![];
|
||||
file.read_to_end(&mut buf)?;
|
||||
self.deserialize(&buf)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn serialize(&self) -> Result<&[u8], Error>;
|
||||
|
||||
fn deserialize(&mut self, buf: &[u8]) -> Result<(), Error>;
|
||||
|
||||
}
|
10
src/lib.rs
Normal file
10
src/lib.rs
Normal file
@ -0,0 +1,10 @@
|
||||
pub mod engines;
|
||||
pub mod inputs;
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#[test]
|
||||
fn it_works() {
|
||||
assert_eq!(2 + 2, 4);
|
||||
}
|
||||
}
|
4
src/main.rs
Normal file
4
src/main.rs
Normal file
@ -0,0 +1,4 @@
|
||||
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user