diff --git a/docker/adbhoney/Dockerfile b/docker/adbhoney/Dockerfile index b2e4ebe7..36ac7924 100644 --- a/docker/adbhoney/Dockerfile +++ b/docker/adbhoney/Dockerfile @@ -5,11 +5,11 @@ COPY dist/ /root/dist/ # # Install packages RUN apk --no-cache -U add \ - git \ - procps \ - py3-psutil \ - py3-requests \ - python3 && \ + git \ + procps \ + py3-psutil \ + py3-requests \ + python3 && \ # # Install adbhoney from git git clone https://github.com/huuck/ADBHoney /opt/adbhoney && \ @@ -17,7 +17,7 @@ RUN apk --no-cache -U add \ # git checkout 2417a7a982f4fd527b3a048048df9a23178767ad && \ git checkout 42afd98611724ca3d694a48b694c957e8d953db4 && \ cp /root/dist/adbhoney.cfg /opt/adbhoney && \ - cp /root/dist/cpu_check.py /opt/adbhoney && \ + cp /root/dist/cpu_check.py / && \ sed -i 's/dst_ip/dest_ip/' /opt/adbhoney/adbhoney/core.py && \ sed -i 's/dst_port/dest_port/' /opt/adbhoney/adbhoney/core.py && \ # @@ -32,8 +32,8 @@ RUN apk --no-cache -U add \ # # Set workdir and start adbhoney STOPSIGNAL SIGINT -# Adbhoney sometimes hangs at 100% CPU usage, if detected process will be killed and container restarts per docker-compose settings -HEALTHCHECK --interval=5m --timeout=30s --retries=3 CMD python3 /opt/adbhoney/cpu_check.py +# Adbhoney sometimes hangs at 100% CPU usage, if detected container will become unhealthy and restarted by tpotinit +HEALTHCHECK --interval=5m --timeout=30s --retries=3 CMD python3 /cpu_check.py $(pgrep -of run.py) 99 USER adbhoney:adbhoney WORKDIR /opt/adbhoney/ CMD /usr/bin/python3 run.py diff --git a/docker/adbhoney/dist/cpu_check.py b/docker/adbhoney/dist/cpu_check.py index 12204d49..13245287 100644 --- a/docker/adbhoney/dist/cpu_check.py +++ b/docker/adbhoney/dist/cpu_check.py @@ -1,10 +1,42 @@ import psutil +import sys +import time -# Get the overall CPU usage percentage -cpu_usage = psutil.cpu_percent(interval=1) -print(cpu_usage) -# Check CPU usage threshold -if cpu_usage >= 75: # Adjust the threshold as needed - exit(1) +if len(sys.argv) != 3: + print("Usage: script.py <PID> <CPU_USAGE_THRESHOLD>") + sys.exit(1) + +try: + pid = int(sys.argv[1]) +except ValueError: + print("Please provide a valid integer value for the PID.") + sys.exit(1) + +try: + cpu_threshold = float(sys.argv[2]) +except ValueError: + print("Please provide a valid number for the CPU usage threshold.") + sys.exit(1) + +try: + target_process = psutil.Process(pid) +except psutil.NoSuchProcess: + print(f"No process with the PID {pid} was found.") + sys.exit(1) + +# Prepare to calculate the average CPU usage over 3 intervals of 1 second each +cpu_usages = [] +for _ in range(3): + cpu_usages.append(target_process.cpu_percent(interval=1)) + +# Calculate the average CPU usage +average_cpu_usage = sum(cpu_usages) / len(cpu_usages) +print(f"Average CPU Usage of PID {pid} over 3 seconds: {average_cpu_usage}%") + +# Check average CPU usage against the threshold +if average_cpu_usage >= cpu_threshold: + print(f"Average CPU usage of PID {pid} is above or equal to the threshold of {cpu_threshold}%.") + sys.exit(1) else: - exit(0) + print(f"Average CPU usage of PID {pid} is below the threshold of {cpu_threshold}%. Exiting with code 0.") + sys.exit(0) diff --git a/docker/ciscoasa/Dockerfile b/docker/ciscoasa/Dockerfile index 1b2f8c4c..da7f2714 100644 --- a/docker/ciscoasa/Dockerfile +++ b/docker/ciscoasa/Dockerfile @@ -6,15 +6,15 @@ COPY dist/ /root/dist/ # Setup env and apt RUN apk --no-cache -U upgrade && \ apk --no-cache add build-base \ - git \ - libffi \ - libffi-dev \ - openssl \ - openssl-dev \ - py3-cryptography \ - py3-pip \ - python3 \ - python3-dev && \ + git \ + libffi \ + libffi-dev \ + openssl \ + openssl-dev \ + py3-cryptography \ + py3-pip \ + python3 \ + python3-dev && \ # # Setup user addgroup -g 2000 ciscoasa && \ diff --git a/docker/citrixhoneypot/Dockerfile b/docker/citrixhoneypot/Dockerfile index 21fe06c5..b51dd882 100644 --- a/docker/citrixhoneypot/Dockerfile +++ b/docker/citrixhoneypot/Dockerfile @@ -2,11 +2,11 @@ FROM alpine:3.19 # # Install packages RUN apk --no-cache -U add \ - git \ - libcap \ - openssl \ - py3-pip \ - python3 && \ + git \ + libcap \ + openssl \ + py3-pip \ + python3 && \ # pip3 install --break-system-packages --no-cache-dir python-json-logger && \ # diff --git a/docker/conpot/Dockerfile b/docker/conpot/Dockerfile index b6a41e8e..792210d3 100644 --- a/docker/conpot/Dockerfile +++ b/docker/conpot/Dockerfile @@ -72,6 +72,7 @@ RUN apk --no-cache -U add \ wget https://www.wireshark.org/download/automated/data/manuf -o /usr/share/wireshark/manuf && \ cp /root/dist/conpot.cfg /etc/conpot/conpot.cfg && \ cp -R /root/dist/templates /usr/lib/$(readlink -f $(type -P python3) | cut -f4 -d"/")/site-packages/conpot/ && \ + cp /root/dist/cpu_check.py / && \ addgroup -g 2000 conpot && \ adduser -S -s /bin/ash -u 2000 -D -g 2000 conpot && \ # @@ -93,7 +94,7 @@ RUN apk --no-cache -U add \ # # Start conpot STOPSIGNAL SIGINT -# Conpot sometimes hangs at 100% CPU usage, if detected process will be killed and container restarts per docker-compose settings -HEALTHCHECK CMD if [ $(ps -C mpv -p 1 -o %cpu | tail -n 1 | cut -f 1 -d ".") -gt 75 ]; then kill -2 1; else exit 0; fi +# Conpot sometimes hangs at 100% CPU usage, if detected container will become unhealthy and restarted by tpotinit +HEALTHCHECK --interval=5m --timeout=30s --retries=3 CMD python3 /cpu_check.py $(pgrep -of conpot) 99 USER conpot:conpot CMD exec /usr/bin/conpot --mibcache $CONPOT_TMP --temp_dir $CONPOT_TMP --template $CONPOT_TEMPLATE --logfile $CONPOT_LOG --config $CONPOT_CONFIG diff --git a/docker/conpot/dist/cpu_check.py b/docker/conpot/dist/cpu_check.py new file mode 100644 index 00000000..13245287 --- /dev/null +++ b/docker/conpot/dist/cpu_check.py @@ -0,0 +1,42 @@ +import psutil +import sys +import time + +if len(sys.argv) != 3: + print("Usage: script.py <PID> <CPU_USAGE_THRESHOLD>") + sys.exit(1) + +try: + pid = int(sys.argv[1]) +except ValueError: + print("Please provide a valid integer value for the PID.") + sys.exit(1) + +try: + cpu_threshold = float(sys.argv[2]) +except ValueError: + print("Please provide a valid number for the CPU usage threshold.") + sys.exit(1) + +try: + target_process = psutil.Process(pid) +except psutil.NoSuchProcess: + print(f"No process with the PID {pid} was found.") + sys.exit(1) + +# Prepare to calculate the average CPU usage over 3 intervals of 1 second each +cpu_usages = [] +for _ in range(3): + cpu_usages.append(target_process.cpu_percent(interval=1)) + +# Calculate the average CPU usage +average_cpu_usage = sum(cpu_usages) / len(cpu_usages) +print(f"Average CPU Usage of PID {pid} over 3 seconds: {average_cpu_usage}%") + +# Check average CPU usage against the threshold +if average_cpu_usage >= cpu_threshold: + print(f"Average CPU usage of PID {pid} is above or equal to the threshold of {cpu_threshold}%.") + sys.exit(1) +else: + print(f"Average CPU usage of PID {pid} is below the threshold of {cpu_threshold}%. Exiting with code 0.") + sys.exit(0) diff --git a/docker/cowrie/Dockerfile b/docker/cowrie/Dockerfile index 0eab1c73..e392cdb3 100644 --- a/docker/cowrie/Dockerfile +++ b/docker/cowrie/Dockerfile @@ -5,33 +5,33 @@ COPY dist/ /root/dist/ # # Get and install dependencies & packages RUN apk --no-cache -U add \ - bash \ - build-base \ - git \ - gmp-dev \ - libcap \ - libffi-dev \ - mpc1-dev \ - mpfr-dev \ - openssl \ - openssl-dev \ - py3-appdirs \ - py3-asn1-modules \ - py3-attrs \ - py3-bcrypt \ - py3-cryptography \ - py3-dateutil \ - py3-greenlet \ - py3-mysqlclient \ - py3-openssl \ - py3-packaging \ - py3-parsing \ - py3-pip \ - py3-service_identity \ - py3-treq \ - py3-twisted \ - python3 \ - python3-dev && \ + bash \ + build-base \ + git \ + gmp-dev \ + libcap \ + libffi-dev \ + mpc1-dev \ + mpfr-dev \ + openssl \ + openssl-dev \ + py3-appdirs \ + py3-asn1-modules \ + py3-attrs \ + py3-bcrypt \ + py3-cryptography \ + py3-dateutil \ + py3-greenlet \ + py3-mysqlclient \ + py3-openssl \ + py3-packaging \ + py3-parsing \ + py3-pip \ + py3-service_identity \ + py3-treq \ + py3-twisted \ + python3 \ + python3-dev && \ # # Setup user addgroup -g 2000 cowrie && \ diff --git a/docker/ddospot/Dockerfile b/docker/ddospot/Dockerfile index 94d5af06..f1754d0e 100644 --- a/docker/ddospot/Dockerfile +++ b/docker/ddospot/Dockerfile @@ -5,18 +5,18 @@ COPY dist/ /root/dist/ # # Install packages RUN apk --no-cache -U add \ - build-base \ - git \ - libcap \ - py3-colorama \ - py3-greenlet \ - py3-pip \ - py3-schedule \ - py3-sqlalchemy \ - py3-twisted \ - py3-wheel \ - python3 \ - python3-dev && \ + build-base \ + git \ + libcap \ + py3-colorama \ + py3-greenlet \ + py3-pip \ + py3-schedule \ + py3-sqlalchemy \ + py3-twisted \ + py3-wheel \ + python3 \ + python3-dev && \ # # Install ddospot from GitHub and setup mkdir -p /opt && \ diff --git a/docker/dicompot/Dockerfile b/docker/dicompot/Dockerfile index acdd9030..9665d02f 100644 --- a/docker/dicompot/Dockerfile +++ b/docker/dicompot/Dockerfile @@ -1,10 +1,13 @@ -FROM alpine:3.17 +FROM alpine:3.19 +# +# Include dist +COPY dist/ /root/dist/ # # Setup apk RUN apk -U add --no-cache \ - build-base \ - git \ - g++ && \ + build-base \ + git \ + g++ && \ apk -U add --no-cache go --repository http://dl-3.alpinelinux.org/alpine/edge/community && \ # # Setup go, build dicompot @@ -20,6 +23,7 @@ RUN apk -U add --no-cache \ # Setup dicompot mkdir -p /opt/dicompot/images && \ cp /opt/go/bin/server /opt/dicompot && \ + cp -R /root/dist/dcm_pts/P1/ /opt/dicompot/images && \ # # Setup user, groups and configs addgroup -g 2000 dicompot && \ diff --git a/docker/dicompot/dist/dcm_pts/P1/series100001-Body/img0001-58.7145.dcm b/docker/dicompot/dist/dcm_pts/P1/series100001-Body/img0001-58.7145.dcm new file mode 100644 index 00000000..15e4da53 Binary files /dev/null and b/docker/dicompot/dist/dcm_pts/P1/series100001-Body/img0001-58.7145.dcm differ diff --git a/docker/dicompot/dist/dcm_pts/P1/series102001-Body/img0001-58.7145.dcm b/docker/dicompot/dist/dcm_pts/P1/series102001-Body/img0001-58.7145.dcm new file mode 100644 index 00000000..4866bc8c Binary files /dev/null and b/docker/dicompot/dist/dcm_pts/P1/series102001-Body/img0001-58.7145.dcm differ diff --git a/docker/dicompot/dist/dcm_pts/P1/series103001-Body/img0001-58.7145.dcm b/docker/dicompot/dist/dcm_pts/P1/series103001-Body/img0001-58.7145.dcm new file mode 100644 index 00000000..ef72ac67 Binary files /dev/null and b/docker/dicompot/dist/dcm_pts/P1/series103001-Body/img0001-58.7145.dcm differ diff --git a/docker/dicompot/dist/dcm_pts/P1/series105001-Body/img0001-58.7145.dcm b/docker/dicompot/dist/dcm_pts/P1/series105001-Body/img0001-58.7145.dcm new file mode 100644 index 00000000..9c7d5224 Binary files /dev/null and b/docker/dicompot/dist/dcm_pts/P1/series105001-Body/img0001-58.7145.dcm differ diff --git a/docker/dicompot/dist/dcm_pts/P1/series106001-Body/img0001-58.7145.dcm b/docker/dicompot/dist/dcm_pts/P1/series106001-Body/img0001-58.7145.dcm new file mode 100644 index 00000000..62e9b1b2 Binary files /dev/null and b/docker/dicompot/dist/dcm_pts/P1/series106001-Body/img0001-58.7145.dcm differ diff --git a/docker/dicompot/dist/dcm_pts/P1/series107001-Body/img0001-58.7145.dcm b/docker/dicompot/dist/dcm_pts/P1/series107001-Body/img0001-58.7145.dcm new file mode 100644 index 00000000..35590be2 Binary files /dev/null and b/docker/dicompot/dist/dcm_pts/P1/series107001-Body/img0001-58.7145.dcm differ diff --git a/docker/dicompot/dist/dcm_pts/P1/series108001-Body/img0001-58.7145.dcm b/docker/dicompot/dist/dcm_pts/P1/series108001-Body/img0001-58.7145.dcm new file mode 100644 index 00000000..01b1fd79 Binary files /dev/null and b/docker/dicompot/dist/dcm_pts/P1/series108001-Body/img0001-58.7145.dcm differ diff --git a/docker/dicompot/dist/dcm_pts/P1/series109001-Body/img0001-58.7145.dcm b/docker/dicompot/dist/dcm_pts/P1/series109001-Body/img0001-58.7145.dcm new file mode 100644 index 00000000..002c08b2 Binary files /dev/null and b/docker/dicompot/dist/dcm_pts/P1/series109001-Body/img0001-58.7145.dcm differ diff --git a/docker/dicompot/dist/dcm_pts/P1/series110001-Body/img0001-58.7145.dcm b/docker/dicompot/dist/dcm_pts/P1/series110001-Body/img0001-58.7145.dcm new file mode 100644 index 00000000..4c55be30 Binary files /dev/null and b/docker/dicompot/dist/dcm_pts/P1/series110001-Body/img0001-58.7145.dcm differ diff --git a/docker/dicompot/dist/dcm_pts/P1/series111001-Body/img0001-58.7145.dcm b/docker/dicompot/dist/dcm_pts/P1/series111001-Body/img0001-58.7145.dcm new file mode 100644 index 00000000..12a74d53 Binary files /dev/null and b/docker/dicompot/dist/dcm_pts/P1/series111001-Body/img0001-58.7145.dcm differ diff --git a/docker/dicompot/dist/dcm_pts/P1/series112001-Body/img0001-58.7145.dcm b/docker/dicompot/dist/dcm_pts/P1/series112001-Body/img0001-58.7145.dcm new file mode 100644 index 00000000..6eae84f2 Binary files /dev/null and b/docker/dicompot/dist/dcm_pts/P1/series112001-Body/img0001-58.7145.dcm differ diff --git a/docker/dicompot/dist/dcm_pts/P1/series114001-Body/img0001-58.7145.dcm b/docker/dicompot/dist/dcm_pts/P1/series114001-Body/img0001-58.7145.dcm new file mode 100644 index 00000000..dbc940ba Binary files /dev/null and b/docker/dicompot/dist/dcm_pts/P1/series114001-Body/img0001-58.7145.dcm differ diff --git a/docker/dicompot/dist/dcm_pts/P1/series115001-Body/img0001-58.7145.dcm b/docker/dicompot/dist/dcm_pts/P1/series115001-Body/img0001-58.7145.dcm new file mode 100644 index 00000000..b70d900f Binary files /dev/null and b/docker/dicompot/dist/dcm_pts/P1/series115001-Body/img0001-58.7145.dcm differ diff --git a/docker/dicompot/dist/dcm_pts/P1/series117001-Body/img0001-58.7145.dcm b/docker/dicompot/dist/dcm_pts/P1/series117001-Body/img0001-58.7145.dcm new file mode 100644 index 00000000..bb176596 Binary files /dev/null and b/docker/dicompot/dist/dcm_pts/P1/series117001-Body/img0001-58.7145.dcm differ diff --git a/docker/dicompot/dist/dcm_pts/P1/series37001-Body/img0001-58.7145.dcm b/docker/dicompot/dist/dcm_pts/P1/series37001-Body/img0001-58.7145.dcm new file mode 100644 index 00000000..3402b3c5 Binary files /dev/null and b/docker/dicompot/dist/dcm_pts/P1/series37001-Body/img0001-58.7145.dcm differ diff --git a/docker/dicompot/dist/dcm_pts/P1/series37001-Body/img0002-58.7145.dcm b/docker/dicompot/dist/dcm_pts/P1/series37001-Body/img0002-58.7145.dcm new file mode 100644 index 00000000..cae4dd22 Binary files /dev/null and b/docker/dicompot/dist/dcm_pts/P1/series37001-Body/img0002-58.7145.dcm differ diff --git a/docker/dicompot/dist/dcm_pts/P1/series37001-Body/img0003-58.7145.dcm b/docker/dicompot/dist/dcm_pts/P1/series37001-Body/img0003-58.7145.dcm new file mode 100644 index 00000000..62a6d4c1 Binary files /dev/null and b/docker/dicompot/dist/dcm_pts/P1/series37001-Body/img0003-58.7145.dcm differ diff --git a/docker/dicompot/dist/dcm_pts/P1/series37001-Body/img0004-58.7145.dcm b/docker/dicompot/dist/dcm_pts/P1/series37001-Body/img0004-58.7145.dcm new file mode 100644 index 00000000..a9df9c15 Binary files /dev/null and b/docker/dicompot/dist/dcm_pts/P1/series37001-Body/img0004-58.7145.dcm differ diff --git a/docker/dicompot/dist/dcm_pts/P1/series37001-Body/img0005-58.7145.dcm b/docker/dicompot/dist/dcm_pts/P1/series37001-Body/img0005-58.7145.dcm new file mode 100644 index 00000000..4cb394bf Binary files /dev/null and b/docker/dicompot/dist/dcm_pts/P1/series37001-Body/img0005-58.7145.dcm differ diff --git a/docker/dicompot/dist/dcm_pts/P1/series37001-Body/img0006-58.7145.dcm b/docker/dicompot/dist/dcm_pts/P1/series37001-Body/img0006-58.7145.dcm new file mode 100644 index 00000000..414d1170 Binary files /dev/null and b/docker/dicompot/dist/dcm_pts/P1/series37001-Body/img0006-58.7145.dcm differ diff --git a/docker/dicompot/dist/dcm_pts/P1/series37001-Body/img0007-58.7145.dcm b/docker/dicompot/dist/dcm_pts/P1/series37001-Body/img0007-58.7145.dcm new file mode 100644 index 00000000..050efb5c Binary files /dev/null and b/docker/dicompot/dist/dcm_pts/P1/series37001-Body/img0007-58.7145.dcm differ diff --git a/docker/dicompot/dist/dcm_pts/P1/series37001-Body/img0008-58.7145.dcm b/docker/dicompot/dist/dcm_pts/P1/series37001-Body/img0008-58.7145.dcm new file mode 100644 index 00000000..b68db23f Binary files /dev/null and b/docker/dicompot/dist/dcm_pts/P1/series37001-Body/img0008-58.7145.dcm differ diff --git a/docker/dicompot/dist/dcm_pts/P1/series37001-Body/img0009-58.7145.dcm b/docker/dicompot/dist/dcm_pts/P1/series37001-Body/img0009-58.7145.dcm new file mode 100644 index 00000000..7a3322d1 Binary files /dev/null and b/docker/dicompot/dist/dcm_pts/P1/series37001-Body/img0009-58.7145.dcm differ diff --git a/docker/dicompot/dist/dcm_pts/P1/series37001-Body/img0010-58.7145.dcm b/docker/dicompot/dist/dcm_pts/P1/series37001-Body/img0010-58.7145.dcm new file mode 100644 index 00000000..c9ad6894 Binary files /dev/null and b/docker/dicompot/dist/dcm_pts/P1/series37001-Body/img0010-58.7145.dcm differ diff --git a/docker/dicompot/dist/dcm_pts/P1/series37001-Body/img0011-58.7145.dcm b/docker/dicompot/dist/dcm_pts/P1/series37001-Body/img0011-58.7145.dcm new file mode 100644 index 00000000..5752a255 Binary files /dev/null and b/docker/dicompot/dist/dcm_pts/P1/series37001-Body/img0011-58.7145.dcm differ diff --git a/docker/dicompot/dist/dcm_pts/P1/series37001-Body/img0012-58.7145.dcm b/docker/dicompot/dist/dcm_pts/P1/series37001-Body/img0012-58.7145.dcm new file mode 100644 index 00000000..01c68720 Binary files /dev/null and b/docker/dicompot/dist/dcm_pts/P1/series37001-Body/img0012-58.7145.dcm differ diff --git a/docker/dicompot/dist/dcm_pts/P1/series37001-Body/img0013-58.7145.dcm b/docker/dicompot/dist/dcm_pts/P1/series37001-Body/img0013-58.7145.dcm new file mode 100644 index 00000000..4355fcfa Binary files /dev/null and b/docker/dicompot/dist/dcm_pts/P1/series37001-Body/img0013-58.7145.dcm differ diff --git a/docker/dicompot/dist/dcm_pts/P1/series37001-Body/img0014-58.7145.dcm b/docker/dicompot/dist/dcm_pts/P1/series37001-Body/img0014-58.7145.dcm new file mode 100644 index 00000000..9739f236 Binary files /dev/null and b/docker/dicompot/dist/dcm_pts/P1/series37001-Body/img0014-58.7145.dcm differ diff --git a/docker/dicompot/dist/dcm_pts/P1/series37001-Body/img0015-58.7145.dcm b/docker/dicompot/dist/dcm_pts/P1/series37001-Body/img0015-58.7145.dcm new file mode 100644 index 00000000..7c31d5a4 Binary files /dev/null and b/docker/dicompot/dist/dcm_pts/P1/series37001-Body/img0015-58.7145.dcm differ diff --git a/docker/dicompot/dist/dcm_pts/P1/series37001-Body/img0016-58.7145.dcm b/docker/dicompot/dist/dcm_pts/P1/series37001-Body/img0016-58.7145.dcm new file mode 100644 index 00000000..bc4428c3 Binary files /dev/null and b/docker/dicompot/dist/dcm_pts/P1/series37001-Body/img0016-58.7145.dcm differ diff --git a/docker/dicompot/dist/dcm_pts/P1/series37001-Body/img0017-58.7145.dcm b/docker/dicompot/dist/dcm_pts/P1/series37001-Body/img0017-58.7145.dcm new file mode 100644 index 00000000..494dfb41 Binary files /dev/null and b/docker/dicompot/dist/dcm_pts/P1/series37001-Body/img0017-58.7145.dcm differ diff --git a/docker/dicompot/dist/dcm_pts/P1/series37001-Body/img0018-58.7145.dcm b/docker/dicompot/dist/dcm_pts/P1/series37001-Body/img0018-58.7145.dcm new file mode 100644 index 00000000..92d45cc8 Binary files /dev/null and b/docker/dicompot/dist/dcm_pts/P1/series37001-Body/img0018-58.7145.dcm differ diff --git a/docker/dicompot/dist/dcm_pts/P1/series37001-Body/img0019-58.7145.dcm b/docker/dicompot/dist/dcm_pts/P1/series37001-Body/img0019-58.7145.dcm new file mode 100644 index 00000000..281febb6 Binary files /dev/null and b/docker/dicompot/dist/dcm_pts/P1/series37001-Body/img0019-58.7145.dcm differ diff --git a/docker/dicompot/dist/dcm_pts/P1/series37001-Body/img0020-58.7145.dcm b/docker/dicompot/dist/dcm_pts/P1/series37001-Body/img0020-58.7145.dcm new file mode 100644 index 00000000..a781414e Binary files /dev/null and b/docker/dicompot/dist/dcm_pts/P1/series37001-Body/img0020-58.7145.dcm differ diff --git a/docker/dicompot/dist/dcm_pts/P1/series37001-Body/img0021-58.7145.dcm b/docker/dicompot/dist/dcm_pts/P1/series37001-Body/img0021-58.7145.dcm new file mode 100644 index 00000000..3d0e2074 Binary files /dev/null and b/docker/dicompot/dist/dcm_pts/P1/series37001-Body/img0021-58.7145.dcm differ diff --git a/docker/dicompot/dist/dcm_pts/P1/series37001-Body/img0022-58.7145.dcm b/docker/dicompot/dist/dcm_pts/P1/series37001-Body/img0022-58.7145.dcm new file mode 100644 index 00000000..5ce3680b Binary files /dev/null and b/docker/dicompot/dist/dcm_pts/P1/series37001-Body/img0022-58.7145.dcm differ diff --git a/docker/dicompot/dist/dcm_pts/P1/series37001-Body/img0023-58.7145.dcm b/docker/dicompot/dist/dcm_pts/P1/series37001-Body/img0023-58.7145.dcm new file mode 100644 index 00000000..18176d30 Binary files /dev/null and b/docker/dicompot/dist/dcm_pts/P1/series37001-Body/img0023-58.7145.dcm differ diff --git a/docker/dicompot/dist/dcm_pts/P1/series37001-Body/img0024-58.7145.dcm b/docker/dicompot/dist/dcm_pts/P1/series37001-Body/img0024-58.7145.dcm new file mode 100644 index 00000000..738f1032 Binary files /dev/null and b/docker/dicompot/dist/dcm_pts/P1/series37001-Body/img0024-58.7145.dcm differ diff --git a/docker/dicompot/dist/dcm_pts/P1/series37001-Body/img0025-58.7145.dcm b/docker/dicompot/dist/dcm_pts/P1/series37001-Body/img0025-58.7145.dcm new file mode 100644 index 00000000..4490a217 Binary files /dev/null and b/docker/dicompot/dist/dcm_pts/P1/series37001-Body/img0025-58.7145.dcm differ diff --git a/docker/dicompot/dist/dcm_pts/P1/series38001-Body/img0001-58.7145.dcm b/docker/dicompot/dist/dcm_pts/P1/series38001-Body/img0001-58.7145.dcm new file mode 100644 index 00000000..d9cd4c8d Binary files /dev/null and b/docker/dicompot/dist/dcm_pts/P1/series38001-Body/img0001-58.7145.dcm differ diff --git a/docker/dicompot/dist/dcm_pts/P1/series38001-Body/img0002-58.7145.dcm b/docker/dicompot/dist/dcm_pts/P1/series38001-Body/img0002-58.7145.dcm new file mode 100644 index 00000000..d3635439 Binary files /dev/null and b/docker/dicompot/dist/dcm_pts/P1/series38001-Body/img0002-58.7145.dcm differ diff --git a/docker/dicompot/dist/dcm_pts/P1/series38001-Body/img0003-58.7145.dcm b/docker/dicompot/dist/dcm_pts/P1/series38001-Body/img0003-58.7145.dcm new file mode 100644 index 00000000..ef9fc3d2 Binary files /dev/null and b/docker/dicompot/dist/dcm_pts/P1/series38001-Body/img0003-58.7145.dcm differ diff --git a/docker/dicompot/dist/dcm_pts/P1/series38001-Body/img0004-58.7145.dcm b/docker/dicompot/dist/dcm_pts/P1/series38001-Body/img0004-58.7145.dcm new file mode 100644 index 00000000..a95c6121 Binary files /dev/null and b/docker/dicompot/dist/dcm_pts/P1/series38001-Body/img0004-58.7145.dcm differ diff --git a/docker/dicompot/dist/dcm_pts/P1/series38001-Body/img0005-58.7145.dcm b/docker/dicompot/dist/dcm_pts/P1/series38001-Body/img0005-58.7145.dcm new file mode 100644 index 00000000..1cab395e Binary files /dev/null and b/docker/dicompot/dist/dcm_pts/P1/series38001-Body/img0005-58.7145.dcm differ diff --git a/docker/dicompot/dist/dcm_pts/P1/series38001-Body/img0006-58.7145.dcm b/docker/dicompot/dist/dcm_pts/P1/series38001-Body/img0006-58.7145.dcm new file mode 100644 index 00000000..8b446946 Binary files /dev/null and b/docker/dicompot/dist/dcm_pts/P1/series38001-Body/img0006-58.7145.dcm differ diff --git a/docker/dicompot/dist/dcm_pts/P1/series38001-Body/img0007-58.7145.dcm b/docker/dicompot/dist/dcm_pts/P1/series38001-Body/img0007-58.7145.dcm new file mode 100644 index 00000000..d73c9ba8 Binary files /dev/null and b/docker/dicompot/dist/dcm_pts/P1/series38001-Body/img0007-58.7145.dcm differ diff --git a/docker/dicompot/dist/dcm_pts/P1/series38001-Body/img0008-58.7145.dcm b/docker/dicompot/dist/dcm_pts/P1/series38001-Body/img0008-58.7145.dcm new file mode 100644 index 00000000..e205b2af Binary files /dev/null and b/docker/dicompot/dist/dcm_pts/P1/series38001-Body/img0008-58.7145.dcm differ diff --git a/docker/dicompot/dist/dcm_pts/P1/series38001-Body/img0009-58.7145.dcm b/docker/dicompot/dist/dcm_pts/P1/series38001-Body/img0009-58.7145.dcm new file mode 100644 index 00000000..c78fe3b7 Binary files /dev/null and b/docker/dicompot/dist/dcm_pts/P1/series38001-Body/img0009-58.7145.dcm differ diff --git a/docker/dicompot/dist/dcm_pts/P1/series38001-Body/img0010-58.7145.dcm b/docker/dicompot/dist/dcm_pts/P1/series38001-Body/img0010-58.7145.dcm new file mode 100644 index 00000000..03bfacf8 Binary files /dev/null and b/docker/dicompot/dist/dcm_pts/P1/series38001-Body/img0010-58.7145.dcm differ diff --git a/docker/dicompot/dist/dcm_pts/P1/series38001-Body/img0011-58.7145.dcm b/docker/dicompot/dist/dcm_pts/P1/series38001-Body/img0011-58.7145.dcm new file mode 100644 index 00000000..1820a855 Binary files /dev/null and b/docker/dicompot/dist/dcm_pts/P1/series38001-Body/img0011-58.7145.dcm differ diff --git a/docker/dicompot/docker-compose.yml b/docker/dicompot/docker-compose.yml index 4abd8f24..6272502c 100644 --- a/docker/dicompot/docker-compose.yml +++ b/docker/dicompot/docker-compose.yml @@ -7,7 +7,7 @@ services: # Dicompot service # Get the Horos Client for testing: https://horosproject.org/ -# Get Dicom images (CC BY 3.0): https://www.cancerimagingarchive.net/collections/ +# Get Dicom images (CC BY 3.0): https://dataverse.harvard.edu/dataverse/harvard/?q=dicom # Put images (which must be in Dicom DCM format or it will not work!) into /data/dicompot/images dicompot: build: . @@ -22,5 +22,5 @@ services: image: "dtagdevsec/dicompot:alpha" read_only: true volumes: - - /data/dicompot/log:/var/log/dicompot -# - /data/dicompot/images:/opt/dicompot/images + - $HOME/tpotce/data/dicompot/log:/var/log/dicompot +# - $HOME/tpotce/data/dicompot/images:/opt/dicompot/images diff --git a/docker/dionaea/Dockerfile b/docker/dionaea/Dockerfile index 074a2008..78e9cf79 100644 --- a/docker/dionaea/Dockerfile +++ b/docker/dionaea/Dockerfile @@ -17,36 +17,37 @@ RUN ARCH=$(arch) && \ apt install ./libemu2_0.2.0+git20120122-1.2+b1_$ARCH.deb \ ./libemu-dev_0.2.0+git20120122-1.2+b1_$ARCH.deb -y && \ apt-get install -y --no-install-recommends \ - build-essential \ - ca-certificates \ - check \ - cmake \ - cython3 \ - git \ - libcap2-bin \ - libcurl4-openssl-dev \ - libev-dev \ - libglib2.0-dev \ - libloudmouth1-dev \ - libnetfilter-queue-dev \ - libnl-3-dev \ - libpcap-dev \ - libssl-dev \ - libtool \ - libudns-dev \ - procps \ - python3 \ - python3-dev \ - python3-boto3 \ - python3-bson \ - python3-yaml \ - fonts-liberation && \ + build-essential \ + ca-certificates \ + check \ + cmake \ + cython3 \ + git \ + libcap2-bin \ + libcurl4-openssl-dev \ + libev-dev \ + libglib2.0-dev \ + libloudmouth1-dev \ + libnetfilter-queue-dev \ + libnl-3-dev \ + libpcap-dev \ + libssl-dev \ + libtool \ + libudns-dev \ + procps \ + python3 \ + python3-dev \ + python3-boto3 \ + python3-bson \ + python3-yaml \ + python3-psutil \ + fonts-liberation && \ # # Get and install dionaea - # Latest master is unstable, SIP causes crashing - git clone --depth=1 https://github.com/dinotools/dionaea -b 0.11.0 /root/dionaea/ && \ + # git clone --depth=1 https://github.com/dinotools/dionaea -b 0.11.0 /root/dionaea/ && \ + git clone --depth=1 https://github.com/dinotools/dionaea /root/dionaea/ && \ cd /root/dionaea && \ - #git checkout 1426750b9fd09c5bfeae74d506237333cd8505e2 && \ + git checkout 4e459f1b672a5b4c1e8335c0bff1b93738019215 && \ mkdir build && \ cd build && \ cmake -DCMAKE_INSTALL_PREFIX:PATH=/opt/dionaea .. && \ @@ -62,6 +63,7 @@ RUN ARCH=$(arch) && \ chown -R dionaea:dionaea /opt/dionaea/var && \ rm -rf /opt/dionaea/etc/dionaea/* && \ mv /root/dist/etc/* /opt/dionaea/etc/dionaea/ && \ + cp /root/dist/cpu_check.py / && \ # # Setup runtime and clean up apt-get purge -y \ @@ -88,7 +90,7 @@ RUN ARCH=$(arch) && \ python3-bson \ python3-yaml \ wget && \ - +# apt-get install -y \ ca-certificates \ python3 \ @@ -111,7 +113,8 @@ RUN ARCH=$(arch) && \ # # Start dionaea STOPSIGNAL SIGINT -# Dionaea sometimes hangs at 100% CPU usage, if detected process will be killed and container restarts per docker-compose settings -HEALTHCHECK CMD if [ $(ps -C mpv -p 1 -o %cpu | tail -n 1 | cut -f 1 -d ".") -gt 75 ]; then kill -2 1; else exit 0; fi +# +# Dionaea sometimes hangs at 100% CPU usage, if detected container will become unhealthy and restarted by tpotinit +HEALTHCHECK --interval=5m --timeout=30s --retries=3 CMD python3 /cpu_check.py $(pgrep -of dionaea) 99 USER dionaea:dionaea CMD ["/opt/dionaea/bin/dionaea", "-u", "dionaea", "-g", "dionaea", "-c", "/opt/dionaea/etc/dionaea/dionaea.cfg"] diff --git a/docker/dionaea/dist/cpu_check.py b/docker/dionaea/dist/cpu_check.py new file mode 100644 index 00000000..13245287 --- /dev/null +++ b/docker/dionaea/dist/cpu_check.py @@ -0,0 +1,42 @@ +import psutil +import sys +import time + +if len(sys.argv) != 3: + print("Usage: script.py <PID> <CPU_USAGE_THRESHOLD>") + sys.exit(1) + +try: + pid = int(sys.argv[1]) +except ValueError: + print("Please provide a valid integer value for the PID.") + sys.exit(1) + +try: + cpu_threshold = float(sys.argv[2]) +except ValueError: + print("Please provide a valid number for the CPU usage threshold.") + sys.exit(1) + +try: + target_process = psutil.Process(pid) +except psutil.NoSuchProcess: + print(f"No process with the PID {pid} was found.") + sys.exit(1) + +# Prepare to calculate the average CPU usage over 3 intervals of 1 second each +cpu_usages = [] +for _ in range(3): + cpu_usages.append(target_process.cpu_percent(interval=1)) + +# Calculate the average CPU usage +average_cpu_usage = sum(cpu_usages) / len(cpu_usages) +print(f"Average CPU Usage of PID {pid} over 3 seconds: {average_cpu_usage}%") + +# Check average CPU usage against the threshold +if average_cpu_usage >= cpu_threshold: + print(f"Average CPU usage of PID {pid} is above or equal to the threshold of {cpu_threshold}%.") + sys.exit(1) +else: + print(f"Average CPU usage of PID {pid} is below the threshold of {cpu_threshold}%. Exiting with code 0.") + sys.exit(0) diff --git a/docker/dionaea/docker-compose.yml b/docker/dionaea/docker-compose.yml index de273d5b..6be5e834 100644 --- a/docker/dionaea/docker-compose.yml +++ b/docker/dionaea/docker-compose.yml @@ -36,12 +36,12 @@ services: image: "dtagdevsec/dionaea:alpha" read_only: true volumes: - - /data/dionaea/roots/ftp:/opt/dionaea/var/dionaea/roots/ftp - - /data/dionaea/roots/tftp:/opt/dionaea/var/dionaea/roots/tftp - - /data/dionaea/roots/www:/opt/dionaea/var/dionaea/roots/www - - /data/dionaea/roots/upnp:/opt/dionaea/var/dionaea/roots/upnp - - /data/dionaea:/opt/dionaea/var/dionaea - - /data/dionaea/binaries:/opt/dionaea/var/dionaea/binaries - - /data/dionaea/log:/opt/dionaea/var/log - - /data/dionaea/rtp:/opt/dionaea/var/dionaea/rtp + - $HOME/tpotce/data/dionaea/roots/ftp:/opt/dionaea/var/dionaea/roots/ftp + - $HOME/tpotce/data/dionaea/roots/tftp:/opt/dionaea/var/dionaea/roots/tftp + - $HOME/tpotce/data/dionaea/roots/www:/opt/dionaea/var/dionaea/roots/www + - $HOME/tpotce/data/dionaea/roots/upnp:/opt/dionaea/var/dionaea/roots/upnp + - $HOME/tpotce/data/dionaea:/opt/dionaea/var/dionaea + - $HOME/tpotce/data/dionaea/binaries:/opt/dionaea/var/dionaea/binaries + - $HOME/tpotce/data/dionaea/log:/opt/dionaea/var/log + - $HOME/tpotce/data/dionaea/rtp:/opt/dionaea/var/dionaea/rtp diff --git a/docker/elasticpot/Dockerfile b/docker/elasticpot/Dockerfile index 1e1284e8..597b0a95 100644 --- a/docker/elasticpot/Dockerfile +++ b/docker/elasticpot/Dockerfile @@ -1,40 +1,40 @@ -FROM alpine:3.17 +FROM alpine:3.19 # # Include dist COPY dist/ /root/dist/ # # Install packages RUN apk -U --no-cache add \ - build-base \ - ca-certificates \ - git \ - libffi-dev \ - openssl \ - openssl-dev \ - postgresql-dev \ - py3-cryptography \ - py3-elasticsearch \ - py3-geoip2 \ - py3-maxminddb \ - py3-mysqlclient \ - py3-packaging \ - py3-psycopg2 \ - py3-redis \ - py3-requests \ - py3-service_identity \ - py3-setuptools \ - py3-pip \ - py3-twisted \ - py3-wheel \ - python3 \ - python3-dev && \ + build-base \ + ca-certificates \ + git \ + libffi-dev \ + openssl \ + openssl-dev \ + postgresql-dev \ + py3-cryptography \ + py3-elasticsearch \ + py3-geoip2 \ + py3-maxminddb \ + py3-mysqlclient \ + py3-packaging \ + py3-psycopg2 \ + py3-redis \ + py3-requests \ + py3-service_identity \ + py3-setuptools \ + py3-pip \ + py3-twisted \ + py3-wheel \ + python3 \ + python3-dev && \ mkdir -p /opt && \ cd /opt/ && \ git clone https://gitlab.com/bontchev/elasticpot.git/ && \ cd elasticpot && \ git checkout d12649730d819bd78ea622361b6c65120173ad45 && \ cp /root/dist/requirements.txt . && \ - pip3 install -r requirements.txt && \ + pip3 install --break-system-packages -r requirements.txt && \ # # Setup user, groups and configs addgroup -g 2000 elasticpot && \ @@ -43,11 +43,11 @@ RUN apk -U --no-cache add \ # # Clean up apk del --purge build-base \ - git \ - libffi-dev \ - openssl-dev \ - postgresql-dev \ - python3-dev && \ + git \ + libffi-dev \ + openssl-dev \ + postgresql-dev \ + python3-dev && \ rm -rf /root/* && \ rm -rf /var/cache/apk/* /opt/elasticpot/.git # diff --git a/docker/elasticpot/docker-compose.yml b/docker/elasticpot/docker-compose.yml index 4aab24f2..e8f0530a 100644 --- a/docker/elasticpot/docker-compose.yml +++ b/docker/elasticpot/docker-compose.yml @@ -19,4 +19,4 @@ services: image: "dtagdevsec/elasticpot:alpha" read_only: true volumes: - - /data/elasticpot/log:/opt/elasticpot/log + - $HOME/tpotce/data/elasticpot/log:/opt/elasticpot/log diff --git a/docker/endlessh/Dockerfile b/docker/endlessh/Dockerfile index b45d5067..3a576074 100644 --- a/docker/endlessh/Dockerfile +++ b/docker/endlessh/Dockerfile @@ -1,13 +1,13 @@ -FROM alpine:3.13 as builder +FROM alpine:3.16 as builder # # Include dist ADD dist/ /root/dist/ # # Install packages RUN apk -U add --no-cache \ - build-base \ - git \ - libcap && \ + build-base \ + git \ + libcap && \ # # Install endlessh from git git clone https://github.com/skeeto/endlessh /opt/endlessh && \ @@ -16,13 +16,13 @@ RUN apk -U add --no-cache \ make && \ mv /opt/endlessh/endlessh /root/dist # -FROM alpine:3.17 +FROM alpine:3.19 # COPY --from=builder /root/dist/* /opt/endlessh/ # # Install packages RUN apk -U add --no-cache \ - libcap && \ + libcap && \ # # Setup user, groups and configs mkdir -p /var/log/endlessh && \ diff --git a/docker/heralding/Dockerfile b/docker/heralding/Dockerfile index 4290ce96..c4b46cc5 100644 --- a/docker/heralding/Dockerfile +++ b/docker/heralding/Dockerfile @@ -1,31 +1,31 @@ -FROM alpine:3.18 +FROM alpine:3.19 # # Include dist COPY dist/ /root/dist/ # # Install packages RUN apk -U --no-cache add \ - build-base \ - git \ - libcap \ - libffi-dev \ - openssl-dev \ - py3-pyzmq \ - postgresql-dev \ - py3-attrs \ - py3-mysqlclient \ - py3-nose \ - py3-pip \ - py3-psycopg2 \ - py3-pycryptodome \ - py3-pyzmq \ - py3-requests \ - py3-rsa \ - py3-typing-extensions \ - py3-wheel \ - py3-yaml \ - python3 \ - python3-dev && \ + build-base \ + git \ + libcap \ + libffi-dev \ + openssl-dev \ + py3-pyzmq \ + postgresql-dev \ + py3-attrs \ + py3-mysqlclient \ + py3-nose \ + py3-pip \ + py3-psycopg2 \ + py3-pycryptodome \ + py3-pyzmq \ + py3-requests \ + py3-rsa \ + py3-typing-extensions \ + py3-wheel \ + py3-yaml \ + python3 \ + python3-dev && \ # # Setup heralding mkdir -p /opt && \ @@ -33,32 +33,32 @@ RUN apk -U --no-cache add \ # git clone https://github.com/johnnykv/heralding && \ git clone https://github.com/t3chn0m4g3/heralding && \ cd heralding && \ - git checkout 319065810d6e8ba62fb696a96584ac7500752380 && \ + git checkout e863c8aa4cee6dd6308ccb20b2d6c816a0fda2a5 && \ cp /root/dist/requirements.txt . && \ - pip3 install --upgrade pip && \ - pip3 install --no-cache-dir -r requirements.txt && \ - pip3 install --no-cache-dir . && \ + pip3 install --break-system-packages --upgrade pip && \ + pip3 install --break-system-packages --no-cache-dir -r requirements.txt && \ + pip3 install --break-system-packages --no-cache-dir . && \ # # Setup user, groups and configs addgroup -g 2000 heralding && \ adduser -S -H -s /bin/ash -u 2000 -D -g 2000 heralding && \ mkdir -p /var/log/heralding/ /etc/heralding && \ mv /root/dist/heralding.yml /etc/heralding/ && \ - setcap cap_net_bind_service=+ep /usr/bin/python3.11 && \ + setcap cap_net_bind_service=+ep $(readlink -f $(type -P python3)) && \ chown -R heralding:heralding /var/log/heralding && \ # # Clean up apk del --purge \ - build-base \ - git \ - libcap \ - libffi-dev \ - openssl-dev \ - postgresql-dev \ - python3-dev && \ + build-base \ + git \ + libcap \ + libffi-dev \ + openssl-dev \ + postgresql-dev \ + python3-dev && \ rm -rf /root/* \ - /var/cache/apk/* \ - /opt/heralding + /var/cache/apk/* \ + /opt/heralding # # Start Heralding STOPSIGNAL SIGINT diff --git a/docker/tpotinit/Dockerfile b/docker/tpotinit/Dockerfile index 2b505ea2..c62374aa 100644 --- a/docker/tpotinit/Dockerfile +++ b/docker/tpotinit/Dockerfile @@ -41,6 +41,6 @@ RUN apk --no-cache -U add \ # # Run tpotinit WORKDIR /opt/tpot -HEALTHCHECK --interval=5s CMD pgrep -f autoheal || exit 1 +HEALTHCHECK --interval=5m --timeout=30s --retries=3 CMD pgrep -f autoheal || exit 1 STOPSIGNAL SIGKILL CMD ["/opt/tpot/entrypoint.sh"] diff --git a/docker/tpotinit/dist/entrypoint.sh b/docker/tpotinit/dist/entrypoint.sh index dd5099b4..761489d9 100755 --- a/docker/tpotinit/dist/entrypoint.sh +++ b/docker/tpotinit/dist/entrypoint.sh @@ -305,7 +305,7 @@ echo # Start autoheal if running on a supported os if [ "${myOSTYPE}" != "linuxkit" ]; then - sleep 1 + sleep 60 echo "# Dropping UDP connection tables to improve visibility of true source IPs." /usr/sbin/conntrack -D -p udp # Starting container health monitoring