func (fuzzer *Fuzzer) RawFrameFuzzer() { fuzzer.CheckConnection() for fuzzer.Alive { frameType := uint8(9) for frameType == 9 { frameType = uint8(rand.Intn(15)) } flags := uint8(rand.Intn(256)) streamId := uint32(rand.Int31()) payloadLength := int32(rand.Intn(100)) payload := make([]byte, payloadLength) crand.Read(payload) fuzzer.Mu.Lock() fuzzer.Conn.WriteRawFrame(frameType, flags, streamId, payload) fuzzer.Mu.Unlock() fmt.Printf("%d, %d, %d, FromBase64(%s)\n", frameType, flags, streamId, util.ToBase64(payload)) time.Sleep(config.FuzzDelay) fuzzer.CheckConnection() } fmt.Println("Stopping RawFrameFuzzer:", fuzzer.Conn.Err) }
func SaveDataFrame(streamID uint32, endStream bool, data []byte) { frame := map[string]interface{}{ "FrameMethod": "DataFrame", "StreamID": streamID, "EndStream": endStream, "Data": util.ToBase64(data), "Time": time.Now().Format(time.RFC3339), } out := util.ToJSON(frame) WriteToReplayFile(out) }
func SaveRawFrame(frameType, flags uint8, streamID uint32, payload []byte) { frame := map[string]interface{}{ "FrameMethod": "RawFrame", "FrameType": frameType, "Flags": flags, "StreamID": streamID, "Payload": util.ToBase64(payload), } out := util.ToJSON(frame) WriteToReplayFile(out) }