stubbing out more plugins

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
Vincent Batts 2018-06-06 11:21:08 -04:00
parent 0f0ce2af37
commit c02aa0e395
Signed by: vbatts
GPG key ID: 10937E57733F1362
7 changed files with 171 additions and 62 deletions

View file

@ -0,0 +1,23 @@
package main
import (
"os"
"time"
"git.thisco.de/vbatts/fuzz-walker/walker"
)
// NewFuzzer creates the fuzzer for this plugin
func NewFuzzer() (walker.Fuzzer, error) {
return &myFuzzer{}, nil
}
type myFuzzer struct{}
func (mf myFuzzer) Name() string {
return "chmodFuzz"
}
func (mf myFuzzer) Func(path string, info os.FileInfo, timeout time.Duration) error {
return nil
}

View file

@ -0,0 +1,28 @@
package main
import (
"os"
"time"
"git.thisco.de/vbatts/fuzz-walker/walker"
)
// NewFuzzer creates the fuzzer for this plugin
func NewFuzzer() (walker.Fuzzer, error) {
return &myFuzzer{}, nil
}
type myFuzzer struct{}
func (mf myFuzzer) Name() string {
return "ioctlFuzz"
}
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
}

View file

@ -1,7 +1,6 @@
package main
import (
"fmt"
"io"
"io/ioutil"
"os"
@ -10,6 +9,7 @@ import (
"git.thisco.de/vbatts/fuzz-walker/walker"
)
// NewFuzzer creates the fuzzer for this plugin
func NewFuzzer() (walker.Fuzzer, error) {
return &myFuzzer{}, nil
}
@ -21,22 +21,16 @@ func (mf myFuzzer) Name() string {
}
func (mf myFuzzer) Func(path string, info os.FileInfo, timeout time.Duration) error {
c1 := make(chan error, 1)
go func() {
fd, err := os.Open(path)
if err != nil {
c1 <- err
}
defer fd.Close()
_, err = io.Copy(ioutil.Discard, fd)
c1 <- err
}()
select {
case err := <-c1:
return err
case <-time.After(timeout):
return fmt.Errorf("timeout reached")
if !info.Mode().IsRegular() {
return nil
}
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

@ -0,0 +1,32 @@
package main
import (
"os"
"time"
"git.thisco.de/vbatts/fuzz-walker/walker"
)
// NewFuzzer creates the fuzzer for this plugin
func NewFuzzer() (walker.Fuzzer, error) {
return &myFuzzer{}, nil
}
type myFuzzer struct{}
func (mf myFuzzer) Name() string {
return "writeBytesFuzz"
}
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
}

View file

@ -0,0 +1,31 @@
package main
import (
"os"
"time"
"git.thisco.de/vbatts/fuzz-walker/walker"
)
// NewFuzzer creates the fuzzer for this plugin
func NewFuzzer() (walker.Fuzzer, error) {
return &myFuzzer{}, nil
}
type myFuzzer struct{}
func (mf myFuzzer) Name() string {
return "writeNumFuzz"
}
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
}