Skip to content

Commit

Permalink
feat: config to directed geybox 2
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandreps1123 committed Oct 9, 2024
1 parent cc79ac6 commit f24799e
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 0 deletions.
9 changes: 9 additions & 0 deletions cmd/dogefuzz/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ type Env interface {
BlackboxFuzzer() interfaces.Fuzzer
GreyboxFuzzer() interfaces.Fuzzer
DirectedGreyboxFuzzer() interfaces.Fuzzer
DirectedGreybox2Fuzzer() interfaces.Fuzzer
OtherDirectedGreyboxFuzzer() interfaces.Fuzzer
PowerSchedule() interfaces.PowerSchedule
}
Expand Down Expand Up @@ -133,6 +134,7 @@ type env struct {
blackboxFuzzer interfaces.Fuzzer
greyboxFuzzer interfaces.Fuzzer
directedGreyboxFuzzer interfaces.Fuzzer
directedGreybox2Fuzzer interfaces.Fuzzer
otherDirectedGreyboxFuzzer interfaces.Fuzzer
powerSchedule interfaces.PowerSchedule
}
Expand Down Expand Up @@ -479,6 +481,13 @@ func (e *env) DirectedGreyboxFuzzer() interfaces.Fuzzer {
return e.directedGreyboxFuzzer
}

func (e *env) DirectedGreybox2Fuzzer() interfaces.Fuzzer {
if e.directedGreybox2Fuzzer == nil {
e.directedGreybox2Fuzzer = fuzz.NewDirectedGreybox2Fuzzer(e)
}
return e.directedGreybox2Fuzzer
}

func (e *env) OtherDirectedGreyboxFuzzer() interfaces.Fuzzer {
if e.otherDirectedGreyboxFuzzer == nil {
e.otherDirectedGreyboxFuzzer = fuzz.NewOtherDirectedGreyboxFuzzer(e)
Expand Down
3 changes: 3 additions & 0 deletions fuzz/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ type env interface {

BlackboxFuzzer() interfaces.Fuzzer
GreyboxFuzzer() interfaces.Fuzzer
DirectedGreybox2Fuzzer() interfaces.Fuzzer
DirectedGreyboxFuzzer() interfaces.Fuzzer
OtherDirectedGreyboxFuzzer() interfaces.Fuzzer
PowerSchedule() interfaces.PowerSchedule
Expand All @@ -34,6 +35,8 @@ func buildOrderer(strategy common.PowerScheduleStrategy, contract *dto.ContractD
return newCoverageBasedOrderer()
case common.DISTANCE_BASED_STRATEGY:
return newDistanceBasedOrderer(contract)
case common.DISTANCE_BASED2_STRATEGY:
return newDistanceBased2Orderer(contract)
case common.DISTANCE_COVERAGE_BASED_STRATEGY:
return newDistanceCoverageBasedOrderer(contract)
default:
Expand Down
4 changes: 4 additions & 0 deletions fuzz/leader.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ type fuzzerLeader struct {
blackboxFuzzer interfaces.Fuzzer
greyboxFuzzer interfaces.Fuzzer
directedGreyboxFuzzer interfaces.Fuzzer
directedGreybox2Fuzzer interfaces.Fuzzer
otherDirectedGreyboxFuzzer interfaces.Fuzzer
}

Expand All @@ -17,6 +18,7 @@ func NewFuzzerLeader(e env) *fuzzerLeader {
blackboxFuzzer: e.BlackboxFuzzer(),
greyboxFuzzer: e.GreyboxFuzzer(),
directedGreyboxFuzzer: e.DirectedGreyboxFuzzer(),
directedGreybox2Fuzzer: e.DirectedGreybox2Fuzzer(),
otherDirectedGreyboxFuzzer: e.OtherDirectedGreyboxFuzzer(),
}
}
Expand All @@ -29,6 +31,8 @@ func (l *fuzzerLeader) GetFuzzerStrategy(typ common.FuzzingType) (interfaces.Fuz
return l.greyboxFuzzer, nil
case common.DIRECTED_GREYBOX_FUZZING:
return l.directedGreyboxFuzzer, nil
case common.DIRECTED_GREYBOX2_FUZZING:
return l.directedGreybox2Fuzzer, nil
case common.OTHER_DIRECTED_GREYBOX_FUZZING:
return l.otherDirectedGreyboxFuzzer, nil
default:
Expand Down
1 change: 1 addition & 0 deletions listener/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ type Env interface {
BlackboxFuzzer() interfaces.Fuzzer
GreyboxFuzzer() interfaces.Fuzzer
DirectedGreyboxFuzzer() interfaces.Fuzzer
DirectedGreybox2Fuzzer() interfaces.Fuzzer
OtherDirectedGreyboxFuzzer() interfaces.Fuzzer
PowerSchedule() interfaces.PowerSchedule
}
2 changes: 2 additions & 0 deletions pkg/common/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const (
BLACKBOX_FUZZING FuzzingType = "blackbox"
GREYBOX_FUZZING FuzzingType = "greybox"
DIRECTED_GREYBOX_FUZZING FuzzingType = "directed_greybox"
DIRECTED_GREYBOX2_FUZZING FuzzingType = "directed_greybox2"
OTHER_DIRECTED_GREYBOX_FUZZING FuzzingType = "other_directed_greybox"
)

Expand Down Expand Up @@ -79,6 +80,7 @@ type PowerScheduleStrategy string

const (
DISTANCE_BASED_STRATEGY PowerScheduleStrategy = "distance_based"
DISTANCE_BASED2_STRATEGY PowerScheduleStrategy = "distance_based2"
COVERAGE_BASED_STRATEGY PowerScheduleStrategy = "coverage_based"
DISTANCE_COVERAGE_BASED_STRATEGY PowerScheduleStrategy = "distance_coverage_based"
)
Expand Down

0 comments on commit f24799e

Please sign in to comment.