Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 91 additions & 0 deletions .github/workflows/ppa.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: PPA Release

on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
series:
description: 'Ubuntu series to build for (comma-separated)'
required: false
default: 'noble,jammy'

jobs:
build-and-upload:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
series: ${{ fromJson(format('["{0}"]', join(inputs.series != '' && inputs.series || 'noble,jammy', '","'))) }}
env:
DEBFULLNAME: Xiaming Chen
DEBEMAIL: chenxm35@gmail.com
PPA_TARGET: ppa:caesar0301/ppa
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install build tools
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
devscripts debhelper dput \
cmake pkg-config libpcap-dev

- name: Setup GPG for non-interactive signing
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
run: |
test -n "$GPG_PRIVATE_KEY" || { echo 'GPG_PRIVATE_KEY secret not set'; exit 1; }
mkdir -p ~/.gnupg
chmod 700 ~/.gnupg
printf 'pinentry-mode loopback\n' >> ~/.gnupg/gpg.conf
printf 'allow-loopback-pinentry\n' >> ~/.gnupg/gpg-agent.conf
gpgconf --kill gpg-agent || true
echo "$GPG_PRIVATE_KEY" | gpg --batch --import
echo "Imported keys:" && gpg --list-keys --keyid-format LONG
KEYID=$(gpg --list-keys --with-colons | awk -F: '/^pub/{print $5; exit}')
echo "DEBSIGN_KEYID=$KEYID" >> $GITHUB_ENV

- name: Compute version from tag
id: ver
run: |
TAG_REF="${GITHUB_REF_NAME:-${GITHUB_REF##*/}}"
UPSTREAM="${TAG_REF#v}"
echo "upstream=$UPSTREAM" >> $GITHUB_OUTPUT

- name: Update changelog for series
run: |
VERSION="${{ steps.ver.outputs.upstream }}-0ppa1~${{ matrix.series }}1"
dch --force-distribution -v "$VERSION" -D "${{ matrix.series }}" "Automated PPA release for ${{ matrix.series }} from tag v${{ steps.ver.outputs.upstream }}"
tail -n +1 debian/changelog

- name: Build signed source package
env:
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
DEBSIGN_KEYID: ${{ env.DEBSIGN_KEYID }}
run: |
test -n "$DEBSIGN_KEYID" || { echo 'Missing DEBSIGN_KEYID'; exit 1; }
# debuild uses debsign -> gpg; force loopback pinentry to passphrase
export GPG_TTY=$(tty || true)
debuild -S -sa -k"$DEBSIGN_KEYID" -p"gpg --batch --yes --pinentry-mode loopback --passphrase $GPG_PASSPHRASE"

- name: Upload to PPA
run: |
CHANGES_FILE=$(ls -1 ../pkt2flow_*~${{ matrix.series }}1_source.changes | tail -n1)
test -n "$CHANGES_FILE" || { echo 'No .changes found'; ls -l ..; exit 1; }
dput $PPA_TARGET "$CHANGES_FILE"

- name: Upload source artifacts
uses: actions/upload-artifact@v4
with:
name: ppa-source-${{ matrix.series }}
path: |
../pkt2flow_*~${{ matrix.series }}1.dsc
../pkt2flow_*~${{ matrix.series }}1_source.changes
../pkt2flow_*~${{ matrix.series }}1.debian.tar.*
../pkt2flow_*~${{ matrix.series }}1.orig.tar.*
if-no-files-found: warn
12 changes: 7 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.16)

project(pkt2flow
VERSION 1.2.0
VERSION 1.4.1
DESCRIPTION "A simple utility to classify packets into flows"
LANGUAGES C CXX)

Expand Down Expand Up @@ -163,10 +163,12 @@ if(BUILD_TESTS)
target_link_libraries(pkt2flow_tests pkt2flow_lib pkt2flow_test_lib)
endif()

# Build example in examples/
add_executable(example_pkt2flow examples/example_pkt2flow.c)
target_link_libraries(example_pkt2flow pkt2flow_lib)
target_include_directories(example_pkt2flow PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include)
# Build example in examples/ only when tests and libs are built
if(BUILD_TESTS)
add_executable(example_pkt2flow examples/example_pkt2flow.c)
target_link_libraries(example_pkt2flow pkt2flow_lib)
target_include_directories(example_pkt2flow PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include)
endif()

# CPack configuration for packaging
include(CPack)
Expand Down
5 changes: 5 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pkt2flow (1.2.0-0ppa1) noble; urgency=medium

* Initial release for Ubuntu PPA. Build with CMake; tests disabled.

-- Xiaming Chen <chenxm35@gmail.com> Tue, 12 Aug 2025 00:00:00 +0000
16 changes: 16 additions & 0 deletions debian/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Source: pkt2flow
Section: utils
Priority: optional
Maintainer: Xiaming Chen <chenxm35@gmail.com>
Build-Depends: debhelper-compat (= 13), cmake, pkg-config, libpcap-dev
Standards-Version: 4.6.2
Homepage: https://github.com/caesar0301/pkt2flow
Rules-Requires-Root: no

Package: pkt2flow
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: Split packets in pcap into per-flow pcaps
A simple utility that classifies packets into flows using the 4-tuple
(source IP, destination IP, source port, destination port) and writes each
flow to a separate pcap file.
24 changes: 24 additions & 0 deletions debian/copyright
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: pkt2flow
Source: https://github.com/caesar0301/pkt2flow

Files: *
Copyright: 2024-2025 Xiaming Chen
License: MIT
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
1 change: 1 addition & 0 deletions debian/docs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
README.md
29 changes: 29 additions & 0 deletions debian/pkt2flow.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
.TH pkt2flow 1 "August 2025" "pkt2flow 1.2.0" "User Commands"
.SH NAME
pkt2flow \- split packets in pcap into per-flow pcaps
.SH SYNOPSIS
.B pkt2flow
.RI [ options ]
.RI "pcapfile"
.SH DESCRIPTION
A simple utility to classify packets into flows using the 4-tuple
(source IP, destination IP, source port, destination port) and write each
flow to a separate pcap file.
.SH OPTIONS
.TP
.B -h
Print help and exit.
.TP
.B -u
Also dump UDP flows.
.TP
.B -v
Also dump invalid TCP flows without the SYN option.
.TP
.B -x
Also dump non-UDP/non-TCP IP flows.
.TP
.B -o DIR
Output directory.
.SH AUTHOR
Xiaming Chen <chenxm35@gmail.com>
1 change: 1 addition & 0 deletions debian/pkt2flow.manpages
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
debian/pkt2flow.1
12 changes: 12 additions & 0 deletions debian/rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/make -f
export DH_VERBOSE = 1

%:
dh $@ --buildsystem=cmake

override_dh_auto_configure:
dh_auto_configure -- -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=OFF

# No tests during package build
override_dh_auto_test:
true
1 change: 1 addition & 0 deletions debian/source/format
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.0 (quilt)
3 changes: 3 additions & 0 deletions debian/watch
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
version=4
opts=filenamemangle=s/.+\/v?(\d\S*)\.tar\.gz/pkt2flow-$1.tar.gz/ \
https://github.com/caesar0301/pkt2flow/tags .*/archive/.+\.tar\.gz
Loading