30 Commits
v0.2 ... 0.3-4

Author SHA1 Message Date
9d91fda7e1 PACKAGENAME not defined 2025-03-22 18:08:15 +01:00
3c007c3fcc test2 2025-03-22 18:04:29 +01:00
8ff71daa36 upload debug 2025-03-22 18:01:26 +01:00
3a078c5ba2 try to upload artifacts to registry 2025-03-22 17:39:09 +01:00
232fe98fd9 rocky needs the v 2025-03-22 16:42:42 +01:00
9e30e4e7aa version bump to 0.3 2025-03-22 16:40:49 +01:00
2f4c086eba typo 2025-03-22 16:33:59 +01:00
e76fb7e61f does not need to be in the repository 2025-03-22 16:31:20 +01:00
269488b60d man install fix 2025-03-22 16:31:16 +01:00
b07369b5b0 rename target 2025-03-22 16:09:15 +01:00
8e01a2823c rl8 only tags 2025-03-22 16:06:19 +01:00
d86c3829f5 manpage info packages 2025-03-22 16:05:37 +01:00
1471e39e50 man page 2025-03-22 14:23:29 +01:00
0ffa2b82bf changelog2 2025-03-22 14:09:17 +01:00
f3604f7390 changelog 2025-03-22 14:07:09 +01:00
0a71915fd8 rocky8 2025-03-22 14:03:31 +01:00
f207c5bdc2 ts 2025-03-22 13:56:41 +01:00
8869da41b5 release dist? 2025-03-22 13:54:33 +01:00
f1c0985c99 less is more 2025-03-22 13:49:51 +01:00
bc23a64b46 -v 2025-03-22 13:48:46 +01:00
b334754945 source 2025-03-22 13:47:10 +01:00
faece01978 tar.gz 2025-03-22 13:45:47 +01:00
02c69f2936 -r 2025-03-22 13:43:48 +01:00
c2475e04f9 mkdir 2025-03-22 13:42:43 +01:00
ba55d4d958 BUILD 2025-03-22 13:40:53 +01:00
b176c8edef dnf 2025-03-22 13:03:18 +01:00
1d67a904b9 sequence error 2025-03-22 13:02:22 +01:00
646a888e84 libpcap-devel 2025-03-22 13:00:59 +01:00
aa86180054 : 2025-03-22 12:59:31 +01:00
94266b53a9 rpm build 2025-03-22 12:58:26 +01:00
8 changed files with 203 additions and 20 deletions

2
.gitignore vendored
View File

@@ -1,5 +1,7 @@
*~
*.o
*.gz
pcapmirror
debian/debhelper-build-stamp
debian/pcapmirror.substvars
debian/files

View File

@@ -1,6 +1,7 @@
stages:
- build
- publish
variables:
DEBIAN_FRONTEND: noninteractive
@@ -12,7 +13,7 @@ build-bookworm:
tags:
- bookworm
script:
- tar -czf ../pcapmirror_0.2.orig.tar.gz --exclude=debian .
- tar -czf ../pcapmirror_0.3.orig.tar.gz --exclude=debian .
- apt-get update && apt-get install -y libpcap-dev
- dpkg-buildpackage -uc -us
- mkdir -p build
@@ -20,12 +21,21 @@ build-bookworm:
artifacts:
paths:
- build/*.deb
- build/*.dsc
- build/*.tar.xz
- build/*.changes
- build/*.buildinfo
- build/*.diff.gz
- build
publish-bookworm:
stage: publish
dependencies:
- build-bookworm
only:
- tags
tags:
- bookworm
script:
- apt-get update && apt-get install -y curl
- ls -la build
- 'echo "Uploading to: ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/bookworm/pcapmirror_0.3-1_amd64.deb"'
- 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file build/pcapmirror_0.3-1_amd64.deb ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${PACKAGENAME}/bookworm/pcapmirror_0.3-1_amd64.deb'
build-sid:
stage: build
@@ -34,7 +44,7 @@ build-sid:
tags:
- sid
script:
- tar -czf ../pcapmirror_0.2.orig.tar.gz --exclude=debian .
- tar -czf ../pcapmirror_0.3.orig.tar.gz --exclude=debian .
- apt-get update && apt-get install -y libpcap-dev
- dpkg-buildpackage -uc -us
- mkdir -p build
@@ -42,9 +52,86 @@ build-sid:
artifacts:
paths:
- build/*.deb
- build/*.dsc
- build/*.tar.xz
- build/*.changes
- build/*.buildinfo
- build/*.diff.gz
- build
publish-sid:
stage: publish
dependencies:
- build-sid
only:
- tags
tags:
- bookworm
script:
- apt-get update && apt-get install -y curl
- ls -la build
- 'echo "Uploading to: ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/sid/pcapmirror_0.3-1_amd64.deb"'
- 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file build/pcapmirror_0.3-1_amd64.deb ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${PACKAGENAME}/sid/pcapmirror_0.3-1_amd64.deb'
build-rocky9:
stage: build
only:
- tags
tags:
- rocky9
script:
- dnf install -y libpcap-devel
- mkdir -p /root/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
- tar -czf /root/rpmbuild/SOURCES/pcapmirror-v0.3.tar.gz --exclude=debian --exclude=.git .
- cp -r * /root/rpmbuild/BUILD
- rpmbuild -ba pcapmirror.spec
- mkdir -p build
- mv /root/rpmbuild/RPMS/x86_64/pcapmirror*.* build/
- mv /root/rpmbuild/SRPMS/pcapmirror*.* build/
artifacts:
paths:
- build
publish-rocky9:
stage: publish
dependencies:
- build-rocky9
only:
- tags
tags:
- bookworm
script:
- apt-get update && apt-get install -y curl
- ls -la build
- 'echo "Uploading to: ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/rockylinux9/pcapmirror-0.3-1.el8.x86_64.rpm"'
- 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file build/pcapmirror-0.3-*.el9.x86_64.rpm ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${PACKAGENAME}/rockylinux9/pcapmirror-0.3-1.el8.x86_64.rpm'
build-rocky8:
stage: build
only:
- tags
tags:
- rocky8
script:
- dnf install -y libpcap-devel
- mkdir -p /root/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
- tar -czf /root/rpmbuild/SOURCES/pcapmirror-v0.3.tar.gz --exclude=debian --exclude=.git .
- cp -r * /root/rpmbuild/BUILD
- rpmbuild -ba pcapmirror.spec
- mkdir -p build
- mv /root/rpmbuild/RPMS/x86_64/pcapmirror*.* build/
- mv /root/rpmbuild/SRPMS/pcapmirror*.* build/
artifacts:
paths:
- build
publish-rocky8:
stage: publish
dependencies:
- build-rocky8
only:
- tags
tags:
- bookworm
script:
- apt-get update && apt-get install -y curl
- ls -la build
- 'echo "Uploading to: ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/rockylinux8/pcapmirror-0.3-1.el8.x86_64.rpm"'
- 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file build/pcapmirror-0.3-*.el8.x86_64.rpm ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${PACKAGENAME}/rockylinux8/pcapmirror-0.3-1.el8.x86_64.rpm'

View File

@@ -22,7 +22,7 @@ TARGET = pcapmirror
PREFIX = /usr
# Default rule
all: $(TARGET)
all: $(TARGET) man
# Create executable
$(TARGET): $(OBJS)
@@ -32,6 +32,9 @@ $(TARGET): $(OBJS)
%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@
man:
gzip -9 -c pcapmirror.8 > pcapmirror.8.gz
# Clean up object files and executable
clean:
rm -f -f $(OBJS) $(TARGET)
@@ -39,11 +42,14 @@ clean:
# Install the executable
install: $(TARGET)
mkdir -p $(DESTDIR)$(PREFIX)/bin
install -D $(TARGET) $(DESTDIR)$(PREFIX)/bin/$(TARGET)
install -D $(TARGET) $(DESTDIR)$(PREFIX)/bin/$(TARGET)
install -D $(TARGET).8 $(DESTDIR)$(PREFIX)/share/man/man8/$(TARGET).8
# Uninstall the executable
uninstall:
rm -f $(TARGET) $(DESTDIR)$(PREFIX)/bin/$(TARGET)
rm -f $(TARGET).8.gz $(DESTDIR)$(PREFIX)/share/man/man8/$(TARGET).8.gz
# Run the executable (example)
run: $(TARGET)

6
debian/changelog vendored
View File

@@ -1,3 +1,9 @@
pcapmirror (0.3-1) unstable; urgency=medium
* added manpage
-- Matthias Cramer <cramer@freestone.net> Fri, 21 Mar 2025 16:00:05 +0100
pcapmirror (0.2-1) unstable; urgency=medium
* First Debian package

3
debian/files vendored
View File

@@ -1,3 +0,0 @@
pcapmirror-dbgsym_0.2-1_amd64.deb debug optional automatic=yes
pcapmirror_0.2-1_amd64.buildinfo net optional
pcapmirror_0.2-1_amd64.deb net optional

1
debian/install vendored
View File

@@ -1 +1,2 @@
pcapmirror /usr/bin
pcapmirror.8 /usr/share/man/man8

52
pcapmirror.8 Normal file
View File

@@ -0,0 +1,52 @@
.TH PCAPMIRROR 1 "March 22, 2025" "pcapmirror 0.3" "User Commands"
.SH NAME
pcapmirror \- A command-line tool for capturing and mirroring network traffic
.SH SYNOPSIS
.B pcapmirror
[\fIoptions\fR]
.SH DESCRIPTION
.B pcapmirror
is a command-line tool for capturing network traffic and mirroring it to a remote destination using TZSP encapsulation. It leverages the \fBlibpcap\fR library for packet capture and provides options for filtering traffic based on BPF syntax. This tool is useful for network monitoring, intrusion detection, and remote packet analysis.
.SH OPTIONS
.TP
.B \-i \fIinterface\fR
Specify the capture interface (e.g., eth0).
.TP
.B \-f \fIfilter\fR
Specify the capture filter in BPF syntax (e.g., tcp port 80).
.TP
.B \-r \fIip_address\fR
Specify the destination IP address (required).
.TP
.B \-p \fIport\fR
Specify the destination port (default: 37008).
.TP
.B \-v
Enable verbose mode (prints packet information).
.TP
.B \-h
Show this help message.
.SH EXAMPLES
To capture traffic on the eth0 interface, filter for TCP port 80, and send it to the destination, use the following command:
.EX
sudo pcapmirror -i eth0 -f "tcp port 80" -r 192.168.1.100 -p 47008 -v
.EE
.SH USAGE WITH WIRESHARK
With this tool, you can mirror traffic directly to a running Wireshark.
To avoid capturing traffic from your own monitoring machine, configure Wireshark with a capture filter of udp port 37008 or udp dst port 37008. Also, verify that your firewall permits this UDP traffic.
.SH SEE ALSO
.BR bpf (2), tcpdump (1), wireshark (1), pcap (3)
.SH AUTHOR
Matthias Cramer <cramer@freestone.net>
.SH COPYRIGHT
Copyright (c) 2025, Matthias Cramer. All rights reserved.

32
pcapmirror.spec Normal file
View File

@@ -0,0 +1,32 @@
Name: pcapmirror
Version: 0.3
Release: %(perl -e 'print time()')%{?dist}
Summary: A simple packet capture mirror
License: BSD 3-Clause License
URL: https://git.freestone.net/cramer/pcapmirror
Source: https://git.freestone.net/cramer/pcapmirror/-/archive/v%version/pcapmirror-v%version.tar.gz
BuildRequires: gcc
BuildRequires: make
BuildRequires: libpcap-devel
%description
pcapmirror is a command-line tool for capturing and mirroring network traffic using TZSP encapsulation. It leverages the `libpcap` library for packet capture and supports BPF syntax for filtering traffic.
%build
%make_build
%install
%make_install
%files
%{_bindir}/pcapmirror
%{_mandir}/man8/pcapmirror.8.gz
%license LICENSE
%doc README.md
%changelog
* Sat Mar 22 2025 Matthias Cramer <cramer@freesone.net> 0.3-1
- added manpage
* Sat Mar 22 2025 Matthias Cramer <cramer@freesone.net> 0.2-1
- Initial release of pcapmirror