default to compile in, but also allow plugins

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
Vincent Batts 2018-06-06 12:29:33 -04:00
parent 4e78ffab6a
commit 66e91e3ddf
Signed by: vbatts
GPG key ID: 10937E57733F1362
13 changed files with 170 additions and 63 deletions

View file

@ -0,0 +1,17 @@
package chmodFuzz
import (
"os"
"git.thisco.de/vbatts/fuzz-walker/walker"
)
func init() {
walker.RegisterFuzzFunc(Name, FuzzFunc)
}
const Name = "chmodFuzz"
func FuzzFunc(path string, info os.FileInfo) error {
return nil
}

View file

@ -1,3 +1,5 @@
// +build ignore
package main
import (
@ -5,6 +7,7 @@ import (
"time"
"git.thisco.de/vbatts/fuzz-walker/walker"
"git.thisco.de/vbatts/fuzz-walker/walker/walkers/chmodFuzz"
)
// NewFuzzer creates the fuzzer for this plugin
@ -15,9 +18,9 @@ func NewFuzzer() (walker.Fuzzer, error) {
type myFuzzer struct{}
func (mf myFuzzer) Name() string {
return "chmodFuzz"
return chmodFuzz.Name
}
func (mf myFuzzer) Func(path string, info os.FileInfo, timeout time.Duration) error {
return nil
return chmodFuzz.Func(path, info)
}

View file

@ -0,0 +1,17 @@
package ioctlFuzz
import (
"os"
"git.thisco.de/vbatts/fuzz-walker/walker"
)
func init() {
walker.RegisterFuzzFunc(Name, FuzzFunc)
}
const Name = "ioctlFuzz"
func FuzzFunc(path string, info os.FileInfo) error {
return nil
}

View file

@ -1,3 +1,5 @@
// +build ignore
package main
import (
@ -5,6 +7,7 @@ import (
"time"
"git.thisco.de/vbatts/fuzz-walker/walker"
"git.thisco.de/vbatts/fuzz-walker/walker/walkers/ioctlFuzz"
)
// NewFuzzer creates the fuzzer for this plugin
@ -15,14 +18,9 @@ func NewFuzzer() (walker.Fuzzer, error) {
type myFuzzer struct{}
func (mf myFuzzer) Name() string {
return "ioctlFuzz"
return ioctlFuzz.Name
}
func (mf myFuzzer) Func(path string, info os.FileInfo, timeout time.Duration) error {
// check whether it is a device file
//if !info.Mode().IsRegular() {
// return nil
//}
return nil
return ioctlFuzz.Func(path, info)
}

View file

@ -0,0 +1,30 @@
package readFuzz
import (
"io"
"io/ioutil"
"os"
"git.thisco.de/vbatts/fuzz-walker/walker"
)
func init() {
walker.RegisterFuzzFunc(Name, FuzzFunc)
}
const Name = "readFuzz"
func FuzzFunc(path string, info os.FileInfo) error {
if !info.Mode().IsRegular() {
return nil
}
fd, err := os.Open(path)
if err != nil {
return err
}
defer fd.Close()
_, err = io.Copy(ioutil.Discard, fd)
return err
}

View file

@ -1,12 +1,12 @@
// +build ignore
package main
import (
"io"
"io/ioutil"
"os"
"time"
"git.thisco.de/vbatts/fuzz-walker/walker"
"git.thisco.de/vbatts/fuzz-walker/walker/walkers/readFuzz"
)
// NewFuzzer creates the fuzzer for this plugin
@ -17,20 +17,9 @@ func NewFuzzer() (walker.Fuzzer, error) {
type myFuzzer struct{}
func (mf myFuzzer) Name() string {
return "readFuzz"
return readFuzz.Name
}
func (mf myFuzzer) Func(path string, info os.FileInfo, timeout time.Duration) error {
if !info.Mode().IsRegular() {
return nil
}
fd, err := os.Open(path)
if err != nil {
return err
}
defer fd.Close()
_, err = io.Copy(ioutil.Discard, fd)
return err
func (mf myFuzzer) Func(path string, info os.FileInfo) error {
return readFuzz.FuzzFunc(path, info)
}

View file

@ -0,0 +1,17 @@
package writeBytesFuzz
import (
"os"
"git.thisco.de/vbatts/fuzz-walker/walker"
)
func init() {
walker.RegisterFuzzFunc(Name, FuzzFunc)
}
const Name = "writeBytesFuzz"
func FuzzFunc(path string, info os.FileInfo) error {
return nil
}

View file

@ -1,3 +1,5 @@
// +build ignore
package main
import (
@ -5,6 +7,7 @@ import (
"time"
"git.thisco.de/vbatts/fuzz-walker/walker"
"git.thisco.de/vbatts/fuzz-walker/walker/walkers/writeBytesFuzz"
)
// NewFuzzer creates the fuzzer for this plugin
@ -15,18 +18,9 @@ func NewFuzzer() (walker.Fuzzer, error) {
type myFuzzer struct{}
func (mf myFuzzer) Name() string {
return "writeBytesFuzz"
return writeBytesFuzz.Name
}
func (mf myFuzzer) Func(path string, info os.FileInfo, timeout time.Duration) error {
if !info.Mode().IsRegular() {
return nil
}
fd, err := os.Open(path)
if err != nil {
return err
}
defer fd.Close()
return nil
return writeBytesFuzz.Func(path, info)
}

View file

@ -0,0 +1,17 @@
package writeNumFuzz
import (
"os"
"git.thisco.de/vbatts/fuzz-walker/walker"
)
func init() {
walker.RegisterFuzzFunc(Name, FuzzFunc)
}
const Name = "writeNumFuzz"
func FuzzFunc(path string, info os.FileInfo) error {
return nil
}

View file

@ -1,3 +1,5 @@
// +build ignore
package main
import (
@ -5,6 +7,7 @@ import (
"time"
"git.thisco.de/vbatts/fuzz-walker/walker"
"git.thisco.de/vbatts/fuzz-walker/walker/walkers/writeNumFuzz"
)
// NewFuzzer creates the fuzzer for this plugin
@ -15,17 +18,9 @@ func NewFuzzer() (walker.Fuzzer, error) {
type myFuzzer struct{}
func (mf myFuzzer) Name() string {
return "writeNumFuzz"
return writeNumFuzz.Name
}
func (mf myFuzzer) Func(path string, info os.FileInfo, timeout time.Duration) error {
if !info.Mode().IsRegular() {
return nil
}
fd, err := os.Open(path)
if err != nil {
return err
}
defer fd.Close()
return nil
return writeNumFuzz.Func(path, info)
}