Added read command to network

dev
Ice3man543 2021-02-16 14:46:23 +05:30
parent 593e2319c4
commit 1de5cdb124
2 changed files with 9 additions and 0 deletions

View File

@ -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.

View File

@ -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 {