This repository was archived by the owner on Apr 30, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +43
-2
lines changed Expand file tree Collapse file tree 2 files changed +43
-2
lines changed Original file line number Diff line number Diff line change @@ -201,15 +201,20 @@ func (c *FuzzitClient) runGoFuzzFuzzing() error {
201201 fileName := info .Name ()
202202 if ! strings .Contains (fileName , "." ) && ! uniqueCrashes [fileName ] && fileName != "crashers" {
203203 uniqueCrashes [fileName ] = true
204- err := c .uploadGoFuzzCrash ("workdir/crashers/" + fileName )
204+ log .Println ("found new crash" )
205+ err := catLastBytes (fmt .Sprintf ("workdir/crashers/%s.output" , fileName ), 1000 )
206+ if err != nil {
207+ return err
208+ }
209+
210+ err = c .uploadGoFuzzCrash ("workdir/crashers/" + fileName )
205211 if err != nil {
206212 return err
207213 }
208214 }
209215 return nil
210216 })
211217 if err != nil {
212- cmd .Process .Kill ()
213218 return err
214219 }
215220
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ package client
33import (
44 "fmt"
55 "io"
6+ "log"
67 "net/http"
78 "os"
89 "os/user"
@@ -25,6 +26,41 @@ func getCacheFile() (string, error) {
2526 return cacheFile , nil
2627}
2728
29+ func catFile (path string ) error {
30+ fh , err := os .Open (path )
31+ if err != nil {
32+ return err
33+ }
34+ defer fh .Close ()
35+
36+ _ , err = io .Copy (os .Stdout , fh )
37+ if err != nil {
38+ return err
39+ }
40+
41+ return nil
42+ }
43+
44+ func catLastBytes (path string , lastBytes int64 ) error {
45+ fh , err := os .Open (path )
46+ if err != nil {
47+ return err
48+ }
49+ defer fh .Close ()
50+
51+ buf := make ([]byte , lastBytes )
52+ stat , err := os .Stat (path )
53+ start := stat .Size () - lastBytes
54+ _ , err = fh .ReadAt (buf , start )
55+ if err != nil {
56+ return err
57+ }
58+
59+ log .Printf ("%s\n " , buf )
60+
61+ return nil
62+ }
63+
2864func splitAndRemoveEmpty (s string , delimiter string ) []string {
2965 splitted := strings .Split (s , delimiter )
3066 var withoutEmptyStrings []string
You can’t perform that action at this time.
0 commit comments