Skip to content

Commit 71303d3

Browse files
authored
Update README.md and docker-compose.yml example (#9)
1 parent 8f69ce3 commit 71303d3

File tree

2 files changed

+38
-20
lines changed

2 files changed

+38
-20
lines changed

README.md

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ More information on PCAP-over-IP can be found here:
99

1010
`pcap-broker` supports the following features:
1111

12-
* Distributing packet data to one or more PCAP-over-IP listeners
12+
* Distributing packet data to one or more PCAP-over-IP clients
1313
* Execute a command to capture traffic, usually `tcpdump` (expects stdout to be pcap data)
1414
* `pcap-broker` will exit if the capture command exits
1515

@@ -90,28 +90,37 @@ One use case is to acquire PCAP from a remote machine over SSH and make this ava
9090
Such a use case, including an example SSH command to bootstrap this, has been documented in the `docker-compose.yml.example` file:
9191

9292
```yaml
93-
version: "3.2"
94-
9593
services:
94+
9695
pcap-broker-remote-host:
9796
image: pcap-broker:latest
97+
container_name: pcap-broker-remote-host
9898
restart: always
9999
volumes:
100-
# mount local user's SSH key into container
100+
# Mount the private key into container that wil be used for SSH
101+
# Ensure that on the `remote-host` the public key is in the /root/.ssh/authorized_keys file.
101102
- ~/.ssh/id_ed25519:/root/.ssh/id_ed25519:ro
102-
ports:
103-
# make the PCAP-over-IP port also available on the host on port 4200
104-
- 4200:4242
105103
environment:
106-
# Command to SSH into remote-host and execute tcpdump and filter out it's own SSH client traffic
107-
PCAP_COMMAND: ssh root@remote-host -o StrictHostKeyChecking=no 'IFACE=$$(ip route show to default | grep -Po1 "dev \K\w+") && BPF=$$(echo $$SSH_CLIENT | awk "{printf \"not (host %s and port %s and %s)\", \$$1, \$$2, \$$3;}") && tcpdump -U --immediate-mode -ni $$IFACE $$BPF -s 65535 -w -'
104+
# Command that will be executed by pcap-broker to read PCAP data.
105+
# Which is to SSH into `remote-host` and run tcpdump on eth0 and write PCAP data to stdout.
106+
# The `not port 22` BPF is necessary to avoid any traffic loops as the PCAP data is transferred over SSH.
107+
PCAP_COMMAND: |-
108+
ssh root@remote-host -oStrictHostKeyChecking=no
109+
tcpdump -U --immediate-mode -ni eth0 -s 65535 -w - not port 22
110+
111+
# Bind on 0.0.0.0 port 4242. From within the same Docker network you can reach it using the `container_name`
112+
# For example in another Docker service you can reach this pcap-broker using `pcap-broker-remote-host:4242`
108113
LISTEN_ADDRESS: "0.0.0.0:4242"
114+
ports:
115+
# This is optional, but makes the PCAP-over-IP port also available locally on the Docker host on port 4200.
116+
# Handy for debugging, for example: `nc -v localhost 4200 | tcpdump -nr -`
117+
- 127.0.0.1:4200:4242
109118
```
110119
111120
## Background
112121
113122
This tool was initially written for Attack & Defend CTF purposes but can be useful in other situations where low latency is preferred, or whenever a no-nonsense PCAP-over-IP server is needed. During the CTF that Fox-IT participated in, `pcap-broker` allowed the Blue Team to capture network data once and disseminate this to other tools that natively support PCAP-over-IP, such as:
114123

115-
* [Arkime](https://arkime.com/)
116-
* [Tulip](https://github.com/OpenAttackDefenseTools/tulip) (after we did some custom patches)
117-
* WireShark's dumpcap and tshark
124+
* [Arkime](https://arkime.com/) ([docs](https://arkime.com/settings#reader-poi))
125+
* [Tulip](https://github.com/OpenAttackDefenseTools/tulip) ([#24](https://github.com/OpenAttackDefenseTools/tulip/pull/24))
126+
* WireShark's [dumpcap](https://www.wireshark.org/docs/man-pages/dumpcap.html) and [tshark](https://www.wireshark.org/docs/man-pages/tshark.html) (`-i TCP@<host>:<port>`)

docker-compose.yml.example

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,25 @@
1-
version: "3.2"
2-
31
services:
2+
43
pcap-broker-remote-host:
54
image: pcap-broker:latest
5+
container_name: pcap-broker-remote-host
66
restart: always
77
volumes:
8-
# mount local user's SSH key into container
8+
# Mount the private key into container that wil be used for SSH
9+
# Ensure that on the `remote-host` the public key is in the /root/.ssh/authorized_keys file.
910
- ~/.ssh/id_ed25519:/root/.ssh/id_ed25519:ro
10-
ports:
11-
# make the PCAP-over-IP port also available on the host on port 4200
12-
- 4200:4242
1311
environment:
14-
# Command to SSH into remote-host and execute tcpdump and filter out it's own SSH client traffic
15-
PCAP_COMMAND: ssh root@remote-host -o StrictHostKeyChecking=no 'IFACE=$$(ip route show to default | grep -Po1 "dev \K\w+") && BPF=$$(echo $$SSH_CLIENT | awk "{printf \"not (host %s and port %s and %s)\", \$$1, \$$2, \$$3;}") && tcpdump -U --immediate-mode -ni $$IFACE $$BPF -s 65535 -w -'
12+
# Command that will be executed by pcap-broker to read PCAP data.
13+
# Which is to SSH into `remote-host` and run tcpdump on eth0 and write PCAP data to stdout.
14+
# The `not port 22` BPF is necessary to avoid any traffic loops as the PCAP data is transferred over SSH.
15+
PCAP_COMMAND: |-
16+
ssh root@remote-host -oStrictHostKeyChecking=no
17+
tcpdump -U --immediate-mode -ni eth0 -s 65535 -w - not port 22
18+
19+
# Bind on 0.0.0.0 port 4242. From within the same Docker network you can reach it using the `container_name`
20+
# For example in another Docker service you can reach this pcap-broker using `pcap-broker-remote-host:4242`
1621
LISTEN_ADDRESS: "0.0.0.0:4242"
22+
ports:
23+
# This is optional, but makes the PCAP-over-IP port also available locally on the Docker host on port 4200.
24+
# Handy for debugging, for example: `nc -v localhost 4200 | tcpdump -nr -`
25+
- 127.0.0.1:4200:4242

0 commit comments

Comments
 (0)