Debianization

This commit is contained in:
2025-03-21 16:28:55 +01:00
parent a9918e4759
commit 2206fa0eb3
9 changed files with 91 additions and 6 deletions

2
.gitignore vendored
View File

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

View File

@@ -19,7 +19,7 @@ OBJS = $(SRCS:.c=.o)
TARGET = pcapmirror
# Installation directory
PREFIX = /usr/local
PREFIX = /usr
# Default rule
all: $(TARGET)
@@ -34,16 +34,17 @@ $(TARGET): $(OBJS)
# Clean up object files and executable
clean:
rm -f $(OBJS) $(TARGET)
rm -f -f $(OBJS) $(TARGET)
# Install the executable
install: $(TARGET)
sudo install -D $(TARGET) $(PREFIX)/bin/$(TARGET)
mkdir -p $(DESTDIR)$(PREFIX)/bin
install -D $(TARGET) $(DESTDIR)$(PREFIX)/bin/$(TARGET)
# Uninstall the executable
uninstall:
sudo rm -f $(PREFIX)/bin/$(TARGET)
rm -f $(TARGET) $(DESTDIR)$(PREFIX)/bin/$(TARGET)
# Run the executable (example)
run: $(TARGET)
sudo ./$(TARGET) -i eth0 -f "tcp port 80" -v
./$(TARGET) -i eth0 -f "tcp port 80" -v

View File

@@ -55,5 +55,14 @@ On Fedora/CentOS/RHEL systems, you can install it using:
```bash
sudo yum install libpcap-devel
```
## Build debian package
If you have never built a debian pakage you probably need debhelper:
```bash
sudo apt-get install debhelper
```
Then build the package with this command.
```bash
dpkg-buildpackage -uc -us
```

11
debian/changelog vendored Normal file
View File

@@ -0,0 +1,11 @@
pcapmirror (0.2-1) unstable; urgency=medium
* First Debian package
-- Matthias Cramer <cramer@freestone.net> Fri, 21 Mar 2025 16:00:05 +0100
pcapmirror (0.1-1) unstable; urgency=low
* Initial release.
-- Matthias Cramer <cramer@freestone.net> Fri, 21 Mar 2025 15:41:17 +0100

17
debian/control vendored Normal file
View File

@@ -0,0 +1,17 @@
Source: pcapmirror
Section: net
Priority: optional
Maintainer: Matthias Cramer <cramer@freestone.net>
Build-Depends: debhelper-compat (=13), libpcap-dev
Standards-Version: 4.5.0
Homepage: https://git.freestone.net/cramer/pcapmirror
Package: pcapmirror
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, libpcap0.8
Description: A simple packet mirroring tool using libpcap
pcapmirror is a command-line tool for capturing network traffic and
mirroring it to a remote destination using TZSP encapsulation. It
leverages the libpcap 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.

31
debian/copyright vendored Normal file
View File

@@ -0,0 +1,31 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: pcapmirror
BSD 3-Clause License
Copyright (c) 2025, Matthias Cramer, cramer@freestone.net
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

3
debian/files vendored Normal file
View File

@@ -0,0 +1,3 @@
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 Normal file
View File

@@ -0,0 +1 @@
pcapmirror /usr/bin

10
debian/rules vendored Executable file
View File

@@ -0,0 +1,10 @@
#!/usr/bin/make -f
# See debhelper(7) (>= 13) for a description of compat levels.
# dh-sequence.mk is deprecated and is now integrated into dh.
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
%:
dh $@