Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Libpacket #20

Merged
merged 2 commits into from
Sep 3, 2024
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
volumes/
19 changes: 16 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ ARCH := $(if $(filter $(ARCH), x86_64),amd64,arm64v8)
# Define the docker image name
IMAGE_NAME := $(ARCH)/krakatoa

.PHONY: build run

.PHONY: build
build:
docker build \
--build-arg ARCH=$(ARCH) \
Expand All @@ -22,9 +21,23 @@ build:
-f $(CONTAINERFILE) \
.

.PHONY: start
start:
docker run --rm -v$(PWD)/mount:/volumes -td $(IMAGE_NAME)

.PHONY: stop
stop:
docker stop $(shell docker ps --filter "ancestor=$(IMAGE_NAME)" --format "{{.ID}}")

.PHONY: attach
attach:
docker exec -ti $(shell docker ps --filter "ancestor=$(IMAGE_NAME)" --format "{{.ID}}" | head -n1) sh

.PHONY: run
run:
docker run -v$(PWD)/mount:/mount --rm -ti $(IMAGE_NAME) sh
docker run -v$(PWD)/volumes:/volumes --rm -ti $(IMAGE_NAME) sh

.PHONY: clean
clean:
docker rmi $(IMAGE_NAME)
docker rmi $(ARCH)/alpine:$(ALPINE_VERSION)
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Several dependencies to build a complete version of Snort 3 are not part officia


2. Run Krakatoa

```sh
# From your host system, create a new Krakatoa container.
docker run --rm -ti krakatoa
Expand Down Expand Up @@ -58,6 +59,19 @@ Several dependencies to build a complete version of Snort 3 are not part officia
--daq afpacket -i eth0
```

3. Persistent environment

```sh

# Launch a new Krakatoa container in the background
make start

# Attach to running Krakatoa container
make attach

# Terminate the container
make stop
```
## Credits

* Victor Roemer ([wtfbbqhax](https://www.github.com/wtfbbqhax))
33 changes: 33 additions & 0 deletions packages/libpacket/APKBUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Contributor: Victor Roemer <[email protected]>
# Maintainer: Victor Roemer <[email protected]>
pkgname=libpacket
pkgver=0.2.2
pkgrel=0
pkgdesc="Packet parser library that provides a clean API to aide in the creation of packet sniffers."
url="https://github.com/wtfbbqhax/LibPacket"
arch="all"
license="BSD"
options='!fhs !check'
giturl="https://github.com/wtfbbqhax/LibPacket.git"
builddir="$srcdir/libpacket"
depends=""
makedepends="git cmake ninja"
subpackages="$pkgname-dev"

prepare() {
mkdir -p "$builddir"
git clone --depth 1 --branch master $giturl "$builddir"
}

build() {
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE:STRING=Release
cmake --build build
}

package() {
DESTDIR="$pkgdir" cmake --install build
}

dev() {
default_dev
}
Loading