-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfuzzer.go
37 lines (36 loc) · 857 Bytes
/
fuzzer.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package main;
import (
"fmt"
"io"
"bufio"
"os"
"sync"
"time"
"net/http"
)
func fuzzer(connection io.ReadWriteCloser,mu *sync.Mutex,ch *chan Task,wg *sync.WaitGroup) {
defer connection.Close()
var delay int64
for {
mu.Lock()
tsk := <- *ch
mu.Unlock()
wg.Add(1)
delay = time.Now().UnixMilli()
_,err := connection.Write([]byte(tsk.Request))
delay = time.Now().UnixMilli() - delay
if err != nil {
fmt.Fprintf(os.Stderr,"%s %s \n",tsk.Params,err.Error())
wg.Done()
continue
}
res,err := http.ReadResponse(bufio.NewReader(connection),nil)
if err != nil {
fmt.Fprintf(os.Stderr,"%s %s \n",tsk.Params,err.Error())
wg.Done()
continue
}
fmt.Printf("%s %d %d\n",tsk.Params,res.StatusCode,res.ContentLength)
wg.Done()
}
}