default to compile in, but also allow plugins
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
parent
4e78ffab6a
commit
66e91e3ddf
13 changed files with 170 additions and 63 deletions
30
walker/walkers/readFuzz/fuzz.go
Normal file
30
walker/walkers/readFuzz/fuzz.go
Normal 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
|
||||
}
|
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue