1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
�
�4j� � �\ � d Z ddlZddlZddlZddlZddlZddlmZ ee� j � j Zedz Zej j Z
dededz fd�Zdededz fd�Zd ededz fd
�Zdeded
edefd�Zdedefd�Zd� Zedk( r ej. e� � yy)us pcap2fixture: convert a captured HTTP exchange into a captchaforge
bench fixture OR adversarial_replay::AdversarialCapture JSON.
Usage:
python3 tools/pcap2fixture/convert.py [--out-mode bench|adversarial]
Reads every file in `incoming/`, dispatches by extension:
.har → HAR v1.2 parser
.txt → curl --trace-ascii parser
.pcap → scapy parser (requires `pip install scapy` + TLS keys)
Emits files into `bench/src/fixtures.rs` (bench mode) or
`adversarial-corpus/<vendor>/<id>.json` (adversarial mode).
Stub for now — protocol locked so the implementation can land
incrementally without disrupting consumers.
� N)�Path�incoming�path�returnc � �� t j | j � � }|j di � j dg � D ]� }|j di � j dd� �t �fd�dD � � s�:|j di � }|j d i � }|j d
d� }�|j dd� |j d
g � D �ci c] }|d j � |d �� c}|d�c S yc c}w )z?Extract the first interesting captcha response from a HAR file.�log�entries�request�url� c 3 �&