You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+21-12Lines changed: 21 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ More information on PCAP-over-IP can be found here:
9
9
10
10
`pcap-broker` supports the following features:
11
11
12
-
* Distributing packet data to one or more PCAP-over-IP listeners
12
+
* Distributing packet data to one or more PCAP-over-IP clients
13
13
* Execute a command to capture traffic, usually `tcpdump` (expects stdout to be pcap data)
14
14
*`pcap-broker` will exit if the capture command exits
15
15
@@ -90,28 +90,37 @@ One use case is to acquire PCAP from a remote machine over SSH and make this ava
90
90
Such a use case, including an example SSH command to bootstrap this, has been documented in the `docker-compose.yml.example` file:
91
91
92
92
```yaml
93
-
version: "3.2"
94
-
95
93
services:
94
+
96
95
pcap-broker-remote-host:
97
96
image: pcap-broker:latest
97
+
container_name: pcap-broker-remote-host
98
98
restart: always
99
99
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.
101
102
- ~/.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
105
103
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`
108
113
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
109
118
```
110
119
111
120
## Background
112
121
113
122
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:
114
123
115
-
* [Arkime](https://arkime.com/)
116
-
* [Tulip](https://github.com/OpenAttackDefenseTools/tulip) (after we did some custom patches)
0 commit comments