apex-twin 0.24.0: serve proxy connections in parallel
The proxy forks one child per accepted connection (SIGCHLD ignored, parent closes the socket). A CONNECT tunnel no longer blocks the next request; each child inherits the scope and the rewrite rules loaded at fork, and SIGHUP in the parent reloads the rules for connections accepted afterwards. A failed fork serves the connection in the parent instead of dropping it. Concurrent captures are safe: apex_traffic_add reserves the id with O_EXCL on tNNNN.json, creates the raw file O_EXCL (replacing a stale raw from a crashed run), writes raw then JSON, and unlinks both on failure. The scan-then-write race that would have let two children overwrite one record is gone. next_traffic_id() is removed. Tests: a CONNECT tunnel is held open against a silent TCP server; a GET through the same proxy answers in under 2 s, three more parallel GETs all answer, and the five captures (1 CONNECT, 4 GET) have unique ids. Red proof: putting the serial accept loop back fails both timing checks. 303 checks, coverage 76.6%, release-check green including distcheck.
This commit is contained in:
1 parent
17a7a97b46
commit
1bb6f957e8
8 files changed
+287
-55
No files matched your search
+13
-2
@@ -6,9 +6,20 @@ change behaviour, but the finding/asset/traffic JSON formats only ever gained
|
||||
fields, and state from an older version is read by a newer one.
|
||||
|
||||
There are no git tags. The hash next to a version is the commit that introduced
|
||||
it; the 0.23.0 entry is the commit that adds this file.
|
||||
it; the current entry is the commit that adds this section.
|
||||
|
||||
## 0.23.0 — 2026-11-21 — this change
|
||||
## 0.24.0 — 2026-11-21 — this change
|
||||
|
||||
- The proxy forks one child per accepted connection: a `CONNECT` tunnel no
|
||||
longer blocks the next request, and rewrite rules are inherited at fork while
|
||||
SIGHUP reloads them in the parent for later connections.
|
||||
- Traffic ids are reserved with `O_EXCL` on `tNNNN.json` (raw file created
|
||||
`O_EXCL` too); concurrent captures cannot overwrite each other.
|
||||
- Tests: a GET answers in under 2 s while a CONNECT tunnel is held open, three
|
||||
more parallel GETs all answer, and the five captures have unique ids. Red
|
||||
proof: serial handling fails the two timing checks.
|
||||
|
||||
## 0.23.0 — 2026-11-21 — 17a7a97
|
||||
|
||||
- Add this changelog; every released increment now has a section and a commit.
|
||||
- Fix the supported-version line in `SECURITY.md` (was 0.19.x) and remove the
|
||||
|
||||
@@ -30,7 +30,7 @@ separate, explicitly armed switch.
|
||||
|
||||
```sh
|
||||
make # apex-twin, ~239 kB static-ish binary, zero warnings under -Werror
|
||||
make test # gate audit + 298 end-to-end checks, no mocks
|
||||
make test # gate audit + 303 end-to-end checks, no mocks
|
||||
make asan # apex-twin-asan with ASan + UBSan
|
||||
make test-asan # the whole suite against the sanitizer binary
|
||||
make gate-audit # static audit: every target-taking tool calls the gate
|
||||
@@ -176,9 +176,12 @@ so the proxy records host, port and byte counts rather than pretending to see
|
||||
inside TLS. A request outside the scope gets `403 Forbidden` with the gate's
|
||||
reason in the body.
|
||||
|
||||
It serves one connection at a time. That is a deliberate trade: serial handling
|
||||
keeps the gate order obvious and an origin that stalls costs one timeout, not the
|
||||
process.
|
||||
It serves each accepted connection in a child process: a `CONNECT` tunnel does
|
||||
not block the next request, and two captures can be written at once because the
|
||||
traffic store reserves ids with `O_EXCL`. Each child inherits the scope and the
|
||||
rewrite rules loaded at fork time; `SIGHUP` in the parent reloads the rules for
|
||||
connections accepted afterwards. Slow origins are bounded by the per-stage
|
||||
timeouts, not by a global queue.
|
||||
|
||||
Before forwarding, the proxy loads `$APEX_HOME/rewrite.json` (`APEX_REWRITE`
|
||||
overrides the path) and applies the first matching rule:
|
||||
@@ -358,7 +361,7 @@ finding and the next report no longer mentions it.
|
||||
make test
|
||||
```
|
||||
|
||||
298 checks, real binary, real DNS, real files written; no mocks. The suite was
|
||||
303 checks, real binary, real DNS, real files written; no mocks. The suite was
|
||||
seen red on purpose: with the "no scope" branch disabled by `if (0 && ...)`,
|
||||
three checks fail, because they assert the *reason* and not merely that an error
|
||||
came back — a gate that falls through to the next deny branch looks identical
|
||||
@@ -389,7 +392,7 @@ this host is an SSH forward to another machine, and a foreign server answered
|
||||
`{"serverInfo":{"name":"koder"}}` while the suite was green.
|
||||
|
||||
The suite is also run against `apex-twin-asan` (`make test-asan`), built with
|
||||
`-fsanitize=address,undefined`. All 298 checks pass with no ASan or UBSan report,
|
||||
`-fsanitize=address,undefined`. All 303 checks pass with no ASan or UBSan report,
|
||||
and a separate batch of error paths, network captures and report generation was
|
||||
run with leak detection on: no leaks. `make analyze` runs `gcc -fanalyzer` over
|
||||
every translation unit; it was red first on `vendor/libmcp/mcp.h`, where
|
||||
@@ -448,7 +451,7 @@ example.com checks; `make test` is the fast loop.
|
||||
|
||||
`make coverage` builds `apex-twin-cov` with `-O0 --coverage`, runs the suite and
|
||||
prints per-file line coverage (`tests/coverage.py`, gcov only, no extra tools).
|
||||
The first measured pass was 55.9%; the gap tests brought it to **76.7%** —
|
||||
The first measured pass was 55.9%; the gap tests brought it to **76.6%** —
|
||||
`tools_kb.c` 100%, `tools_traffic.c` 81.8%, `tools_web.c` 71.6%,
|
||||
`tools_recon.c` 68.0%. A PTY-based Marauder simulator then raised
|
||||
`tools_radio.c` from 31.7% to 76.2% without hardware: firmware `info`/`help`,
|
||||
@@ -460,14 +463,14 @@ the copied scope reason is now bounded with a precision, not left to snprintf.
|
||||
|
||||
## Status
|
||||
|
||||
0.23.0. Built and run: 45 tools, 298 checks, 340 fuzz cases and 76.7% line
|
||||
0.24.0. Built and run: 45 tools, 303 checks, 340 fuzz cases and 76.6% line
|
||||
coverage. The loop closes: a probe captures the exchange as a pair, a finding
|
||||
points at it, `finding_update` gives it a state, an asset records the host it
|
||||
came from, `cors_check`/`cookie_audit`/`http_options` turn a web answer into a
|
||||
graded lead, `report_markdown` turns findings and inventory into one Markdown,
|
||||
CSV or JSON file, and `evidence_read`/`traffic_read` get the proof back. `--proxy` puts
|
||||
the same gate in front of curl and a browser, forwards chunked and
|
||||
Content-Length bodies, and takes rewrite rules that can set or remove a header
|
||||
the same gate in front of curl and a browser, serves connections in parallel,
|
||||
forwards chunked and Content-Length bodies, and takes rewrite rules that can set or remove a header
|
||||
or block a path; `APEX_WEBHOOK` wakes someone when the severity floor is
|
||||
crossed. The radio is tested against a PTY Marauder (firmware info, scans that
|
||||
end in `stopscan`, a login prompt that is refused, `serial_tx` gating).
|
||||
|
||||
+4
-2
@@ -72,8 +72,10 @@ only narrow what the proxy does (the scope gate still runs first).
|
||||
stored as bytes. The program does not execute target content.
|
||||
- **TLS interception.** `CONNECT` is a blind tunnel; nothing inside TLS is
|
||||
inspected, logged or rewritten. That is deliberate (no TLS stack is linked).
|
||||
- **Denial of service from a local client.** The proxy is serial; a client that
|
||||
holds a connection can delay the next one. Timeouts bound it, not isolate it.
|
||||
- **Denial of service from a local client.** The proxy forks a child per
|
||||
connection; a local client can open many and consume processes and memory.
|
||||
Per-stage timeouts bound each, but there is no authentication and no
|
||||
connection limit.
|
||||
- **Compromised operator credentials.** A stolen shell or SSH key can run the
|
||||
binary against the scope. The audit records what was asked, not who asked.
|
||||
- **Webhook confidentiality.** Evidence titles and targets are POSTed to the
|
||||
|
||||
@@ -132,6 +132,12 @@ Every request passes the scope gate before a socket opens. Plain HTTP is
|
||||
forwarded and captured under `traffic/`. `CONNECT` is tunnelled blind and only
|
||||
recorded as metadata: the binary links no TLS stack, so it does not inspect TLS.
|
||||
|
||||
Each accepted connection gets its own child process, so a `CONNECT` tunnel does
|
||||
not block the next request and parallel captures cannot overwrite each other
|
||||
(traffic ids are reserved with `O_EXCL`). A SIGHUP in the parent reloads the
|
||||
rewrite rules for connections accepted after it; children keep the rules they
|
||||
inherited at fork.
|
||||
|
||||
`rewrite.json` can set or remove headers and block a path; first match wins:
|
||||
|
||||
```json
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@
|
||||
|
||||
#include "mcp.h"
|
||||
|
||||
#define APEX_VERSION "0.23.0"
|
||||
#define APEX_VERSION "0.24.0"
|
||||
#define APEX_MAX_OUT (1u << 20)
|
||||
#define APEX_PATH_MAX 512
|
||||
#define APEX_PATH_FULL 1024
|
||||
|
||||
+19
@@ -967,6 +967,7 @@ int apex_serve_proxy(int port)
|
||||
struct sigaction sa_stop;
|
||||
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
signal(SIGCHLD, SIG_IGN); /* one child per connection, no zombies */
|
||||
memset(&sa_hup, 0, sizeof(sa_hup));
|
||||
sa_hup.sa_handler = on_hup;
|
||||
sigemptyset(&sa_hup.sa_mask);
|
||||
@@ -1008,6 +1009,7 @@ int apex_serve_proxy(int port)
|
||||
ntohs(sa.sin_port));
|
||||
for (;;) {
|
||||
int fd;
|
||||
pid_t pid;
|
||||
|
||||
if (g_stop)
|
||||
break;
|
||||
@@ -1025,6 +1027,23 @@ int apex_serve_proxy(int port)
|
||||
g_rules_dirty = 0;
|
||||
reload_rules();
|
||||
}
|
||||
/*
|
||||
* One child per connection: a CONNECT tunnel must not block the
|
||||
* next request. The traffic store reserves ids with O_EXCL, so
|
||||
* children can record at the same time.
|
||||
*/
|
||||
pid = fork();
|
||||
if (pid == 0) {
|
||||
close(ls);
|
||||
handle_client(fd);
|
||||
close(fd);
|
||||
exit(0);
|
||||
}
|
||||
if (pid > 0) {
|
||||
close(fd);
|
||||
continue;
|
||||
}
|
||||
/* fork failed: serve it in the parent rather than dropping it */
|
||||
handle_client(fd);
|
||||
close(fd);
|
||||
}
|
||||
|
||||
+78
-40
@@ -1261,22 +1261,6 @@ int apex_asset_update(const char *id, const char *label, const char *ports,
|
||||
|
||||
/* ---------------------------------------------------------------- traffic */
|
||||
|
||||
static int next_traffic_id(void)
|
||||
{
|
||||
int i;
|
||||
char path[APEX_PATH_FULL];
|
||||
|
||||
for (i = 1; i < 1000000; i++) {
|
||||
char name[32];
|
||||
|
||||
snprintf(name, sizeof(name), "t%04d.json", i);
|
||||
if (apex_path_join(path, sizeof(path), g_cfg.traffic_dir, name) != 0)
|
||||
return -1;
|
||||
if (access(path, F_OK) != 0)
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void traffic_json(mcp_buf *b, const apex_traffic *t)
|
||||
{
|
||||
@@ -1373,12 +1357,25 @@ static int load_traffic_file(const char *path, apex_traffic *t)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int write_fd_all(int fd, const char *p, size_t n)
|
||||
{
|
||||
size_t off = 0;
|
||||
|
||||
while (off < n) {
|
||||
ssize_t w = write(fd, p + off, n - off);
|
||||
|
||||
if (w <= 0)
|
||||
return -1;
|
||||
off += (size_t)w;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
char *apex_traffic_add(const char *target, int port, int tls, const char *method,
|
||||
const char *path, int status, const char *request,
|
||||
size_t request_len, const char *response,
|
||||
size_t response_len, const char *note)
|
||||
{
|
||||
int id = next_traffic_id();
|
||||
apex_traffic t;
|
||||
char json_path[APEX_PATH_FULL];
|
||||
char raw_path[APEX_PATH_FULL];
|
||||
@@ -1387,16 +1384,11 @@ char *apex_traffic_add(const char *target, int port, int tls, const char *method
|
||||
char *now;
|
||||
mcp_buf raw;
|
||||
mcp_buf js;
|
||||
int attempt;
|
||||
|
||||
if (id < 0 || target == NULL || *target == '\0')
|
||||
if (target == NULL || *target == '\0')
|
||||
return NULL;
|
||||
snprintf(t.id, sizeof(t.id), "t%04d", id);
|
||||
snprintf(fname, sizeof(fname), "%s.json", t.id);
|
||||
snprintf(rname, sizeof(rname), "%s.http", t.id);
|
||||
if (apex_path_join(json_path, sizeof(json_path), g_cfg.traffic_dir, fname) != 0 ||
|
||||
apex_path_join(raw_path, sizeof(raw_path), g_cfg.traffic_dir, rname) != 0)
|
||||
return NULL;
|
||||
|
||||
memset(&t, 0, sizeof(t));
|
||||
now = apex_now_iso();
|
||||
field_copy(t.ts, sizeof(t.ts), now != NULL ? now : "?");
|
||||
free(now);
|
||||
@@ -1408,7 +1400,6 @@ char *apex_traffic_add(const char *target, int port, int tls, const char *method
|
||||
t.status = status;
|
||||
t.request_bytes = (long)request_len;
|
||||
t.response_bytes = (long)response_len;
|
||||
field_copy(t.raw, sizeof(t.raw), raw_path);
|
||||
field_copy(t.note, sizeof(t.note), note);
|
||||
|
||||
mcp_buf_init(&raw);
|
||||
@@ -1419,23 +1410,70 @@ char *apex_traffic_add(const char *target, int port, int tls, const char *method
|
||||
mcp_buf_puts(&raw, "=== RESPONSE (raw) ===\n");
|
||||
if (response != NULL && response_len > 0)
|
||||
mcp_buf_add(&raw, response, response_len);
|
||||
if (apex_write_file(raw_path, raw.p, raw.len, 0600) != 0) {
|
||||
|
||||
/*
|
||||
* The proxy forks a child per connection now, so two recordings can run
|
||||
* at once. Reserve the id by creating the JSON file with O_EXCL: the
|
||||
* loser moves on to the next id instead of overwriting the winner.
|
||||
*/
|
||||
for (attempt = 1; attempt < 1000000; attempt++) {
|
||||
int jfd;
|
||||
int rfd;
|
||||
|
||||
snprintf(t.id, sizeof(t.id), "t%04d", attempt);
|
||||
snprintf(fname, sizeof(fname), "%s.json", t.id);
|
||||
snprintf(rname, sizeof(rname), "%s.http", t.id);
|
||||
if (apex_path_join(json_path, sizeof(json_path), g_cfg.traffic_dir,
|
||||
fname) != 0 ||
|
||||
apex_path_join(raw_path, sizeof(raw_path), g_cfg.traffic_dir,
|
||||
rname) != 0)
|
||||
break;
|
||||
jfd = open(json_path, O_WRONLY | O_CREAT | O_EXCL, 0600);
|
||||
if (jfd < 0) {
|
||||
if (errno == EEXIST)
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
rfd = open(raw_path, O_WRONLY | O_CREAT | O_EXCL, 0600);
|
||||
if (rfd < 0 && errno == EEXIST) {
|
||||
/* stale raw without JSON from a crashed run: replace it */
|
||||
unlink(raw_path);
|
||||
rfd = open(raw_path, O_WRONLY | O_CREAT | O_EXCL, 0600);
|
||||
}
|
||||
if (rfd < 0) {
|
||||
close(jfd);
|
||||
unlink(json_path);
|
||||
if (errno == EEXIST)
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
field_copy(t.raw, sizeof(t.raw), raw_path);
|
||||
if (write_fd_all(rfd, raw.p, raw.len) != 0) {
|
||||
close(rfd);
|
||||
close(jfd);
|
||||
unlink(raw_path);
|
||||
unlink(json_path);
|
||||
break;
|
||||
}
|
||||
close(rfd);
|
||||
mcp_buf_init(&js);
|
||||
traffic_json(&js, &t);
|
||||
mcp_buf_puts(&js, "\n");
|
||||
if (write_fd_all(jfd, js.p, js.len) != 0) {
|
||||
mcp_buf_free(&js);
|
||||
close(jfd);
|
||||
unlink(raw_path);
|
||||
unlink(json_path);
|
||||
break;
|
||||
}
|
||||
mcp_buf_free(&js);
|
||||
close(jfd);
|
||||
mcp_buf_free(&raw);
|
||||
return NULL;
|
||||
apex_audit("http_capture", target, port, 1, t.id, method);
|
||||
return apex_strdup(t.id);
|
||||
}
|
||||
mcp_buf_free(&raw);
|
||||
|
||||
mcp_buf_init(&js);
|
||||
traffic_json(&js, &t);
|
||||
mcp_buf_puts(&js, "\n");
|
||||
if (apex_write_file(json_path, js.p, js.len, 0600) != 0) {
|
||||
mcp_buf_free(&js);
|
||||
unlink(raw_path);
|
||||
return NULL;
|
||||
}
|
||||
mcp_buf_free(&js);
|
||||
apex_audit("http_capture", target, port, 1, t.id, method);
|
||||
return apex_strdup(t.id);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int apex_traffic_list(mcp_buf *b, const char *target_filter, int limit)
|
||||
|
||||
+153
@@ -1592,6 +1592,159 @@ check("the raw capture keeps the chunked framing",
|
||||
craw[:160])
|
||||
shutil.rmtree(chunk_home, ignore_errors=True)
|
||||
|
||||
print("\n== proxy concurrency ==")
|
||||
|
||||
|
||||
class _ConcurrencyOrigin(http.server.BaseHTTPRequestHandler):
|
||||
def do_GET(self):
|
||||
body = b"ok"
|
||||
self.send_response(200)
|
||||
self.send_header("Content-Length", str(len(body)))
|
||||
self.end_headers()
|
||||
self.wfile.write(body)
|
||||
|
||||
def log_message(self, *args):
|
||||
pass
|
||||
|
||||
|
||||
conc_origin = http.server.HTTPServer(("127.0.0.1", 0), _ConcurrencyOrigin)
|
||||
cport2 = conc_origin.server_address[1]
|
||||
threading.Thread(target=conc_origin.serve_forever, daemon=True).start()
|
||||
|
||||
hold_srv = socket.socket()
|
||||
hold_srv.bind(("127.0.0.1", 0))
|
||||
hold_srv.listen(4)
|
||||
hold_port = hold_srv.getsockname()[1]
|
||||
held_conns = []
|
||||
hold_stop = threading.Event()
|
||||
|
||||
|
||||
def hold_loop():
|
||||
while not hold_stop.is_set():
|
||||
try:
|
||||
hold_srv.settimeout(0.2)
|
||||
conn, _ = hold_srv.accept()
|
||||
except socket.timeout:
|
||||
continue
|
||||
except OSError:
|
||||
break
|
||||
held_conns.append(conn) # stay silent and keep it open
|
||||
|
||||
|
||||
threading.Thread(target=hold_loop, daemon=True).start()
|
||||
conc_home = tempfile.mkdtemp(prefix="apex-conc-")
|
||||
write_scope(conc_home, {"label": "conc", "expires": "2099-12-31T23:59:59Z",
|
||||
"allow_private": True, "allow_ip": ["127.0.0.1"],
|
||||
"allow_port": [str(cport2), str(hold_port)]})
|
||||
conc_port = free_port()
|
||||
crenv = dict(env)
|
||||
crenv["APEX_HOME"] = conc_home
|
||||
conc_srv = subprocess.Popen([BIN, "--proxy", str(conc_port)], env=crenv,
|
||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE,
|
||||
text=True)
|
||||
deadline = time.time() + 10
|
||||
cup = False
|
||||
while time.time() < deadline:
|
||||
probe = socket.socket()
|
||||
try:
|
||||
probe.connect(("127.0.0.1", conc_port))
|
||||
cup = True
|
||||
probe.close()
|
||||
break
|
||||
except OSError:
|
||||
probe.close()
|
||||
time.sleep(0.1)
|
||||
check("concurrency proxy came up", cup, conc_port)
|
||||
|
||||
tunnel = None
|
||||
try:
|
||||
tunnel = socket.create_connection(("127.0.0.1", conc_port), timeout=5)
|
||||
tunnel.sendall(("CONNECT 127.0.0.1:%d HTTP/1.1\r\n"
|
||||
"Host: 127.0.0.1:%d\r\n\r\n" %
|
||||
(hold_port, hold_port)).encode())
|
||||
tunnel.settimeout(3)
|
||||
first = tunnel.recv(200)
|
||||
check("a CONNECT tunnel is established", b" 200 " in first.split(b"\r\n")[0],
|
||||
first)
|
||||
|
||||
started = time.time()
|
||||
s = socket.create_connection(("127.0.0.1", conc_port), timeout=5)
|
||||
s.sendall(("GET http://127.0.0.1:%d/ HTTP/1.1\r\n"
|
||||
"Host: 127.0.0.1:%d\r\n"
|
||||
"Connection: close\r\n\r\n" % (cport2, cport2)).encode())
|
||||
s.settimeout(3)
|
||||
got = b""
|
||||
try:
|
||||
while True:
|
||||
chunk = s.recv(65536)
|
||||
if not chunk:
|
||||
break
|
||||
got += chunk
|
||||
except socket.timeout:
|
||||
got += b"<TIMEOUT>"
|
||||
s.close()
|
||||
elapsed = time.time() - started
|
||||
check("a second request is served while the tunnel is open",
|
||||
b" 200 " in got.split(b"\r\n")[0] and b"ok" in got and elapsed < 2.0,
|
||||
(got[:60], elapsed))
|
||||
|
||||
parallel = []
|
||||
plock = threading.Lock()
|
||||
|
||||
def one_parallel_get():
|
||||
try:
|
||||
ps = socket.create_connection(("127.0.0.1", conc_port), timeout=5)
|
||||
ps.sendall(("GET http://127.0.0.1:%d/ HTTP/1.1\r\n"
|
||||
"Host: 127.0.0.1:%d\r\n"
|
||||
"Connection: close\r\n\r\n" % (cport2, cport2)).encode())
|
||||
ps.settimeout(3)
|
||||
buf = b""
|
||||
while True:
|
||||
chunk = ps.recv(65536)
|
||||
if not chunk:
|
||||
break
|
||||
buf += chunk
|
||||
ps.close()
|
||||
except OSError:
|
||||
buf = b""
|
||||
with plock:
|
||||
parallel.append(buf)
|
||||
|
||||
workers = [threading.Thread(target=one_parallel_get) for _ in range(3)]
|
||||
for worker in workers:
|
||||
worker.start()
|
||||
for worker in workers:
|
||||
worker.join(timeout=5)
|
||||
check("parallel requests are all answered while the tunnel is open",
|
||||
len(parallel) == 3 and
|
||||
all(b" 200 " in r.split(b"\r\n")[0] for r in parallel), parallel)
|
||||
finally:
|
||||
if tunnel is not None:
|
||||
tunnel.close()
|
||||
hold_stop.set()
|
||||
for conn in held_conns:
|
||||
try:
|
||||
conn.close()
|
||||
except OSError:
|
||||
pass
|
||||
hold_srv.close()
|
||||
time.sleep(0.5)
|
||||
conc_srv.terminate()
|
||||
try:
|
||||
conc_srv.wait(timeout=5)
|
||||
except subprocess.TimeoutExpired:
|
||||
conc_srv.kill()
|
||||
conc_origin.shutdown()
|
||||
conc_origin.server_close()
|
||||
|
||||
res, _ = run([call(1, "traffic_list")], home=conc_home)
|
||||
conc_list = json.loads(text(res[0]))
|
||||
methods = [c["method"] for c in conc_list]
|
||||
check("both concurrent exchanges were captured",
|
||||
methods.count("CONNECT") == 1 and methods.count("GET") == 4 and
|
||||
len(set(c["id"] for c in conc_list)) == len(conc_list), methods)
|
||||
shutil.rmtree(conc_home, ignore_errors=True)
|
||||
|
||||
# ------------------------------------------------------------- serial guard
|
||||
print("\n== serial guard ==")
|
||||
fake = os.path.join(ROOT, "notamodem")
|
||||
|
||||
Reference in new issue
Block a user