overwrite token mutator
This commit is contained in:
parent
2440aaedfc
commit
1bce5ad8cf
@ -510,6 +510,28 @@ where
|
|||||||
mem_move(input.bytes_mut(), token, 0, off, len);
|
mem_move(input.bytes_mut(), token, 0, off, len);
|
||||||
Ok(MutationResult::Mutated)
|
Ok(MutationResult::Mutated)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Overwrite with a dictionary token
|
||||||
|
pub fn mutation_tokenreplace<M, C, I, R>(
|
||||||
|
mutator: &mut M,
|
||||||
|
rand: &mut R,
|
||||||
|
_: &C,
|
||||||
|
input: &mut I,
|
||||||
|
) -> Result<MutationResult, AflError>
|
||||||
|
where
|
||||||
|
M: HasMaxSize,
|
||||||
|
I: Input + HasBytesVec,
|
||||||
|
R: Rand,
|
||||||
|
{
|
||||||
|
if mutator.tokens.size() > len || !len { return Ok(MutationResult::Skipped); }
|
||||||
|
let token = &mutator.tokens[rand.below(token.size())];
|
||||||
|
let token_len = token.size();
|
||||||
|
let size = input.bytes().len();
|
||||||
|
let off rand.below((mutator.max_size() - token_len) as u64)) as usize;
|
||||||
|
mem_move(input.bytes_mut(), token, 0, off, len);
|
||||||
|
Ok(MutationResult::Mutated)
|
||||||
|
}
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
pub fn mutation_bytesinsert<M, C, I, R>(
|
pub fn mutation_bytesinsert<M, C, I, R>(
|
||||||
|
@ -288,10 +288,10 @@ where
|
|||||||
scheduled.add_mutation(mutation_bytescopy);
|
scheduled.add_mutation(mutation_bytescopy);
|
||||||
scheduled.add_mutation(mutation_bytesswap);
|
scheduled.add_mutation(mutation_bytesswap);
|
||||||
|
|
||||||
// TODO dictionary and custom dictionary (redqueen etc.)
|
/*scheduled.add_mutation(mutation_tokeninsert);
|
||||||
/*scheduled.add_mutation(mutation_bitflip);
|
scheduled.add_mutation(mutation_tokenreplace);*/
|
||||||
scheduled.add_mutation(mutation_bitflip);
|
|
||||||
scheduled.add_mutation(mutation_bitflip);*/
|
// TODO: custom dictionary (redqueen etc.)
|
||||||
|
|
||||||
scheduled.add_mutation(mutation_splice);
|
scheduled.add_mutation(mutation_splice);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user