-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Irkam
authored
Feb 1, 2021
0 parents
commit 6d4807a
Showing
3 changed files
with
71 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|