On Sun, Mar 15, 2015 at 8:36 AM, <
xiedi...@gmail.com> wrote:
> Hi everyone, I want to do something like guided random testing.
> The issue I'm facing now is how to generate inputs for a program.
To get a more useful answer, it might be worth starting by explaining
how the way afl works is different from your understanding of the term
"guided random testing". To me, there isn't any.
> As afl-fuzzer uses genetic algorithm to generate test cases, I want to reuse
> that part of code. But afl-fuzz.c has over 7k lines of code
This is not how I'd characterise the way afl generates test cases. The
case generation code itself is more or less state-of-the-art black box
generation. You'd get a similar experience with radamsa or one of many
random junk generators ( eventually ). The case generation is not what
I would call 'genetic' because there is no (current) feedback between
HOW cases are generated and the fitness function. There is, however,
some feedback between areas of the file that are fuzzed, and how long
is spent per file. Additionally, because the coverage statistic is
'masked' by the coverage bitmap you don't get to know exactly which
tests affected which program areas, unlike some earlier works.
The 'genetic' part is simply the fact that more successful cases are
used as a base for subsequent blind mutation. 'Genetic' case
generation, to me, would be (for example) if/when the generator
changes the weighting it gives to certain kinds of tests based on the
overall effectiveness of that test domain (flips, dict insert,
arithmetic... ). You have to be aware, though, that because of the way
the evolution works there's a fair chance that doing this, especially
early, would lead to local maxima that would handicap you later.
I'm also suspecting that we have something of an XY problem here, so
for best results you may try explaining what you are trying to do in
more depth ( and how afl doesn't do it )
Just my 0.02.
Cheers,
ben