MCPcopy Create free account
hub / github.com/evilsocket/medusa / do_request

Function do_request

src/shell/docker.rs:10–27  ·  view source on GitHub ↗
(request: &str, stream: &mut S)

Source from the content-addressed store, hash-verified

8const DOCKER_SOCKET: &str = "/var/run/docker.sock";
9
10fn do_request<S>(request: &str, stream: &mut S) -> Result<Vec<u8>, String>
11where
12 S: Read + Write,
13{
14 debug!("{}\n\n", request);
15 stream
16 .write_all(request.as_bytes())
17 .map_err(|e| format!("could not write to {}: {}", DOCKER_SOCKET, e))?;
18
19 let mut response = vec![];
20 stream
21 .read_to_end(&mut response)
22 .map_err(|e| format!("could not read from {}: {}", DOCKER_SOCKET, e))?;
23
24 debug!("{:?}", &response);
25
26 Ok(response)
27}
28
29fn create_exec(container_id: &str, command: &str) -> Result<String, String> {
30 debug!(

Callers 2

create_execFunction · 0.85
do_execFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected