From 1de5cdb1247b515034ed319bd1823d17199ab78f Mon Sep 17 00:00:00 2001 From: Ice3man543 Date: Tue, 16 Feb 2021 14:46:23 +0530 Subject: [PATCH] Added read command to network --- v2/pkg/protocols/network/network.go | 2 ++ v2/pkg/protocols/network/request.go | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/v2/pkg/protocols/network/network.go b/v2/pkg/protocols/network/network.go index 06d0447d9..9e2540518 100644 --- a/v2/pkg/protocols/network/network.go +++ b/v2/pkg/protocols/network/network.go @@ -45,6 +45,8 @@ type Input struct { Data string `yaml:"data"` // Type is the type of input - hex, text. Type string `yaml:"type"` + // Read is the number of bytes to read from socket + Read int `yaml:"read"` } // GetID returns the unique ID of the request if any. diff --git a/v2/pkg/protocols/network/request.go b/v2/pkg/protocols/network/request.go index d713c1ee7..22f357913 100644 --- a/v2/pkg/protocols/network/request.go +++ b/v2/pkg/protocols/network/request.go @@ -91,6 +91,13 @@ func (r *Request) executeAddress(actualAddress, address, input string, previous r.options.Progress.DecrementRequests(1) return errors.Wrap(err, "could not write request to server") } + + bufferSize := 1024 + if r.ReadSize != 0 { + bufferSize = r.ReadSize + } + buffer := make([]byte, bufferSize) + _, _ = conn.Read(buffer) r.options.Progress.IncrementRequests() } if err != nil {