Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Irkam authored Feb 1, 2021
0 parents commit 6d4807a
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 0 deletions.
31 changes: 31 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
FROM fedora
#FROM docker.pkg.github.com/checkmarx-ts/cxcli-docker/cxcli:2020.4.4

RUN yum install -y zip unzip java-latest-openjdk

RUN adduser -d /home/cxjadx cxjadx


# Get CxCLI from Checkmarx
ADD https://download.checkmarx.com/9.0.0/Plugins/CxConsolePlugin-2021.1.1.zip /tmp/cxcli.zip
RUN unzip /tmp/cxcli.zip -d /opt/cxcli
RUN rm /tmp/cxcli.zip

# Get Jadx
ADD https://github.com/skylot/jadx/releases/download/v1.2.0/jadx-1.2.0.zip /tmp/jadx.zip
RUN unzip /tmp/jadx.zip -d /opt/jadx
RUN rm /tmp/jadx.zip

# Create environment
RUN mkdir apk
VOLUME ["/home/cxjadx/apk"]
RUN chown -R cxjadx:cxjadx /home/cxjadx/apk

ADD run.sh /home/cxjadx/run.sh
RUN chown cxjadx:cxjadx /home/cxjadx/run.sh
RUN chmod a+x /home/cxjadx/run.sh

WORKDIR /home/cxjadx
USER cxjadx

CMD ./run.sh
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
APK2Checkmarx
=============

Usage
-----

git clone <repo>
cd apk2cx
mkdir apk
docker build -t apk2cx .
docker run --rm -v /path/to/your/target.apk:/home/cxjadx/apk \
-e APKPATH="apk/target.apk" \
-e CX_SERVER="https://checkmarx.local/" \
-e CX_USER="foobar" \
-e CX_PASSWORD="FOOBAR" \
-e CX_TEAM="CxServer\\SP\\Foobar\\Baz" \
-e CX_PROJECTNAME="FooProject-branch" \
apk2cx:latest

21 changes: 21 additions & 0 deletions run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#/bin/bash

export JAVA_HOME="/etc/alternatives/jre"
EXCLUDE="!**/META-INF, !**/assets, !**/lib, !**/res, !**/junit, !**/java/android/*, !**/java/androidx, !**/java/kotlin, !**/java/kotlinx, !**/java/google, !**java/com/google, *.dex"
tmpdir=$(mktemp -d)
echo "INFO - Decompiling $APKPATH to $tmpdir"
echo "INFO - Excluding $EXCLUDE"

/opt/jadx/bin/jadx --deobf --no-res -e -j 10 --output-dir "$tmpdir" $APKPATH

echo "INFO - Checkmarx Scanning project $CX_TEAM\\$CX_PROJECTNAME on host $CX_USER@$CX_SERVER"
java -Xmx2048m -jar /opt/cxcli/CxConsolePlugin-CLI-2021.1.1.jar Scan \
-CxServer $CX_SERVER \
-CxUser $CX_USER \
-CxPassword $CX_PASSWORD \
-ProjectName "$CX_TEAM\\$CX_PROJECTNAME" \
-IncludeExcludePattern "$EXCLUDE" \
-LocationType folder \
-LocationPath $tmpdir/src \
-Comment "$CX_COMMENT" -verbose

0 comments on commit 6d4807a

Please sign in to comment.