Skip to content

Commit

Permalink
skip malware scan on java 8-16
Browse files Browse the repository at this point in the history
  • Loading branch information
0x7d8 committed Oct 24, 2024
1 parent 0559f87 commit b43e5d0
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 18 deletions.
6 changes: 0 additions & 6 deletions java/11/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,6 @@ RUN rm -rf /usr/bin/dd \
&& rm -rf /usr/bin/truncate \
&& rm -rf /usr/bin/xfs_mkfile

RUN apt-get update -y \
&& apt-get install -y curl

RUN curl -sSL https://github.com/OpticFusion1/MCAntiMalware/releases/latest/download/MCAntiMalware.jar \
-o /MCAntiMalware.jar

RUN apt-get install -y jq lsof ca-certificates openssl git tar sqlite3 fontconfig libfreetype6 tzdata iproute2 libstdc++6 \
&& useradd -d /home/container -m container

Expand Down
6 changes: 0 additions & 6 deletions java/16/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,6 @@ RUN rm -rf /usr/bin/dd \
&& rm -rf /usr/bin/truncate \
&& rm -rf /usr/bin/xfs_mkfile

RUN apt-get update -y \
&& apt-get install -y curl

RUN curl -sSL https://github.com/OpticFusion1/MCAntiMalware/releases/latest/download/MCAntiMalware.jar \
-o /MCAntiMalware.jar

RUN apt-get install -y jq lsof ca-certificates openssl git tar sqlite3 fontconfig libfreetype6 tzdata iproute2 libstdc++6 \
&& useradd -d /home/container -m container

Expand Down
6 changes: 0 additions & 6 deletions java/8/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,6 @@ RUN rm -rf /usr/bin/dd \
&& rm -rf /usr/bin/truncate \
&& rm -rf /usr/bin/xfs_mkfile

RUN apt-get update -y \
&& apt-get install -y curl

RUN curl -sSL https://github.com/OpticFusion1/MCAntiMalware/releases/latest/download/MCAntiMalware.jar \
-o /MCAntiMalware.jar

RUN apt-get install -y jq lsof ca-certificates openssl git tar sqlite3 fontconfig libfreetype6 tzdata iproute2 libstdc++6 \
&& useradd -d /home/container -m container

Expand Down
6 changes: 6 additions & 0 deletions java/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ java -version
JAVA_MAJOR_VERSION=$(java -version 2>&1 | awk -F '"' '/version/ {print $2}' | awk -F '.' '{print $1}')

if [[ "$MALWARE_SCAN" == "1" ]]; then
# check if java version is lower than 17
if [[ "$JAVA_MAJOR_VERSION" -lt 17 ]]; then
echo -e "${LOG_PREFIX} Malware scanning is only available for Java 17 and above, skipping..."
MALWARE_SCAN=0
fi

echo -e "${LOG_PREFIX} Scanning for malware... (This may take a while)"

java -jar /MCAntiMalware.jar --scanDirectory . --singleScan true --disableAutoUpdate true
Expand Down

0 comments on commit b43e5d0

Please sign in to comment.