Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: dwisiswant0/apkleaks
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v2.5.0
Choose a base ref
...
head repository: dwisiswant0/apkleaks
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref

Commits on Mar 31, 2021

  1. fix issue #40

    This update can fix issue #40 on windows
    Ch3nYe authored Mar 31, 2021
    Copy the full SHA
    233f170 View commit details

Commits on Apr 3, 2021

  1. Merge pull request #45 from Ch3nYe/master

    fix issue #40
    dwisiswant0 authored Apr 3, 2021
    Copy the full SHA
    04ad2c9 View commit details

Commits on Jun 16, 2021

  1. Bump to patch

    dwisiswant0 committed Jun 16, 2021
    Copy the full SHA
    4e59715 View commit details
  2. Copy the full SHA
    c28cf36 View commit details
  3. Copy the full SHA
    9221d16 View commit details
  4. Copy the full SHA
    2e15354 View commit details

Commits on Jun 27, 2021

  1. Copy the full SHA
    a902ce4 View commit details
  2. Copy the full SHA
    651cae5 View commit details
  3. Copy the full SHA
    143eb6b View commit details
  4. Bump to patch

    dwisiswant0 committed Jun 27, 2021
    Copy the full SHA
    61746a7 View commit details
  5. Merge pull request #50 from dwisiswant0/dev

    Prep v2.5.2
    dwisiswant0 authored Jun 27, 2021
    Copy the full SHA
    6ee5a80 View commit details

Commits on Aug 9, 2021

  1. Add patterns:

    - GitHub Access Token
    - Discord BOT Token
    - JSON Web Token
    - DEF CON CTF Flag
    - HackerOne CTF Flag
    - TryHackMe CTF Flag
    - HackTheBox CTF Flag
    - MAC Address
    dwisiswant0 committed Aug 9, 2021
    Copy the full SHA
    77a3fa4 View commit details
  2. Reorder regexes

    dwisiswant0 committed Aug 9, 2021
    Copy the full SHA
    183fc32 View commit details
  3. Bump to v2.6.0

    dwisiswant0 committed Aug 9, 2021
    Copy the full SHA
    f7f0a2d View commit details

Commits on Aug 10, 2021

  1. Remove trailing comma

    dwisiswant0 committed Aug 10, 2021
    Copy the full SHA
    35d4fac View commit details
  2. Bump to v2.6.1

    dwisiswant0 committed Aug 10, 2021
    Copy the full SHA
    089adfa View commit details

Commits on Oct 20, 2021

  1. Copy the full SHA
    5077dd4 View commit details

Commits on Jan 7, 2022

  1. Merge pull request #57 from pad0van/master

    🐛 Fix can't work in kali using relative path
    dwisiswant0 authored Jan 7, 2022
    Copy the full SHA
    7139b69 View commit details

Commits on Mar 2, 2022

  1. Update funding

    dwisiswant0 committed Mar 2, 2022
    Copy the full SHA
    9cf27d6 View commit details

Commits on Feb 10, 2023

  1. misc: update funding

    dwisiswant0 committed Feb 10, 2023
    Copy the full SHA
    d542624 View commit details
  2. docs: update readme

    dwisiswant0 committed Feb 10, 2023
    Copy the full SHA
    1fd6f3c View commit details
  3. Copy the full SHA
    9dfd143 View commit details

Commits on Nov 17, 2023

  1. docs: update blockquote notes

    (adapt https://github.com/orgs/community/discussions/16925)
    
    Signed-off-by: Dwi Siswanto <me@dw1.io>
    dwisiswant0 committed Nov 17, 2023
    Copy the full SHA
    44d28b3 View commit details

Commits on Feb 24, 2024

  1. chore: add tea.yaml

    dwisiswant0 authored Feb 24, 2024
    Copy the full SHA
    c7b510c View commit details

Commits on May 17, 2024

  1. Copy the full SHA
    ada51e4 View commit details
  2. chore: update copyright year

    Signed-off-by: Dwi Siswanto <git@dw1.io>
    dwisiswant0 committed May 17, 2024
    Copy the full SHA
    e4dbe0c View commit details
  3. build: bump to 2.6.2

    Signed-off-by: Dwi Siswanto <git@dw1.io>
    dwisiswant0 committed May 17, 2024
    Copy the full SHA
    183e407 View commit details
  4. build: update Dockerfile

    includes:
    
    * use major version of Python
    * remove openjdk image as base
    
    Signed-off-by: Dwi Siswanto <git@dw1.io>
    dwisiswant0 committed May 17, 2024
    Copy the full SHA
    77d32f8 View commit details
  5. chore: add Makefile

    Signed-off-by: Dwi Siswanto <git@dw1.io>
    dwisiswant0 committed May 17, 2024
    Copy the full SHA
    e0b2eea View commit details
  6. chore: add virtual env to .gitignore

    Signed-off-by: Dwi Siswanto <git@dw1.io>
    dwisiswant0 committed May 17, 2024
    Copy the full SHA
    3202df9 View commit details

Commits on Oct 21, 2024

  1. fix: replace pipes for python 3.13 (#92)

    * fix: replace pipes for python 3.13
    
    * build: migrate to pyproject.toml
    branchvincent authored Oct 21, 2024
    Copy the full SHA
    1abc5d6 View commit details
  2. chore: bump version

    Signed-off-by: Dwi Siswanto <git@dw1.io>
    dwisiswant0 committed Oct 21, 2024
    Copy the full SHA
    05a83a1 View commit details

Commits on Mar 26, 2025

  1. Added Java & jadx to Image (#97)

    Co-authored-by: m.mou <mehdi.moussaif@evina.com>
    mohaidoss and m.mou authored Mar 26, 2025
    Copy the full SHA
    335ce85 View commit details
Showing with 185 additions and 110 deletions.
  1. +1 −2 .github/FUNDING.yml
  2. +8 −12 .github/workflows/publish.yaml
  3. +2 −1 .gitignore
  4. +17 −7 Dockerfile
  5. +1 −1 LICENSE
  6. +0 −5 MANIFEST.in
  7. +54 −0 Makefile
  8. +13 −10 README.md
  9. +1 −1 VERSION
  10. +9 −6 apkleaks/apkleaks.py
  11. +9 −6 apkleaks/cli.py
  12. +30 −23 config/regexes.json
  13. +34 −0 pyproject.toml
  14. +0 −36 setup.py
  15. +6 −0 tea.yaml
3 changes: 1 addition & 2 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
ko_fi: dwisiswant0
custom: ["https://paypal.me/dw1s", "https://saweria.co/dwisiswant0"]
github: ["dwisiswant0"]
20 changes: 8 additions & 12 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -5,36 +5,32 @@ on:
- v*

jobs:
release:
publish:
name: "Publish to DockerHub"
runs-on: ubuntu-latest
steps:
- name: "Check out code"
uses: actions/checkout@v2

- name: "Set variables"
id: vars
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/}
uses: actions/checkout@v3

- name: "Set up QEMU"
uses: docker/setup-qemu-action@v1.0.1
uses: docker/setup-qemu-action@v2.1.0

- name: "Set up Docker Buildx"
uses: docker/setup-buildx-action@v1.1.1
uses: docker/setup-buildx-action@v2.4.1

- name: "Login to DockerHub"
uses: docker/login-action@v1.8.0
uses: docker/login-action@v2.1.0
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}

- name: "Build and push"
id: docker_build
uses: docker/build-push-action@v2.3.0
uses: docker/build-push-action@v4.0.0
with:
push: true
build-args: "VERSION=${{ steps.vars.outputs.tag }}"
tags: "${{ github.repository }}:latest,${{ github.repository }}:${{ steps.vars.outputs.tag }}"
build-args: "VERSION=${{ github.ref_name }}"
tags: "${{ github.repository }}:latest,${{ github.repository }}:${{ github.ref_name }}"

- name: "Image digest"
run: echo ${{ steps.docker_build.outputs.digest }}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -2,4 +2,5 @@ jadx/
*.pyc
*.egg-info/
build/
dist/
dist/
venv/
24 changes: 17 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@
FROM python:3.8-slim-buster as build
FROM python:3-slim

LABEL description="Scanning APK file for URIs, endpoints & secrets."
LABEL repository="https://github.com/dwisiswant0/apkleaks"
LABEL maintainer="dwisiswant0"

RUN apt-get update && \
apt-get install -y openjdk-17-jre-headless && \
apt-get install -y unzip && \
rm -rf /var/lib/apt/lists/*

# Instal jadx 1.2.0
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 && \
rm /tmp/jadx.zip && \
ln -s /opt/jadx/bin/jadx /usr/local/bin/jadx

WORKDIR /app
COPY requirements.txt requirements.txt
RUN pip3 install -r requirements.txt
COPY . .

FROM openjdk:slim-buster
COPY requirements.txt .
RUN python -m ensurepip
RUN pip install -r requirements.txt
COPY . .

COPY --from=build / /
ENTRYPOINT ["/app/apkleaks.py"]
ENTRYPOINT ["python", "/app/apkleaks.py"]
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright 2020-2021 dwisiswant0
Copyright 2020-2024 dwisiswant0

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
5 changes: 0 additions & 5 deletions MANIFEST.in

This file was deleted.

54 changes: 54 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
AUTHOR := dwisiswant0
APP := apkleaks
IMAGE := $(AUTHOR)/$(APP)
VERSION := $(shell cat VERSION | tr -d '\n')
PACKAGE := $(APP)-$(shell echo $(VERSION) | cut -c 2-)

VENV := venv
PYTHON := python3
# PIP := pip3

ifneq ($(wildcard $(VENV)),)
PYTHON = $(VENV)/bin/python3
# PIP = $(VENV)/bin/pip3
endif

venv:
python3 -m venv $(VENV)

setup:
$(PYTHON) -m pip install -r requirements.txt
$(PYTHON) -m pip install build twine

setup-venv: venv
setup-venv: PYTHON = $(VENV)/bin/python3
setup-venv: setup

build-package:
@$(PYTHON) -m build

check-package:
@$(PYTHON) -m twine check dist/$(PACKAGE)*

upload-package:
@$(PYTHON) -m twine upload dist/$(PACKAGE)*

pypi: check-package build-package

build-images:
@docker build -t $(IMAGE):latest .
@docker tag $(IMAGE):latest $(IMAGE):$(VERSION)

upload-images:
@docker push $(IMAGE):latest
@docker push $(IMAGE):$(VERSION)

docker: build-images

build-all: build-package build-images

upload-all: upload-package upload-images

clean:
@rm -rfv dist/ venv/
@docker image rm -f dwisiswant0/apkleaks
23 changes: 13 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -14,8 +14,7 @@ Scanning APK file for URIs, endpoints & secrets.
- [Options](#options)
- [Output](#output)
- [Pattern](#pattern)
- [Pattern](#pattern)
- [Arguments (disassembler)](#arguments-disassembler)
- [Arguments (for disassembler)](#arguments-for-disassembler)
- [License](#license)
- [Acknowledments](#acknowledments)

@@ -51,7 +50,7 @@ $ docker pull dwisiswant0/apkleaks:latest

### Dependencies

APKLeaks using [jadx](https://github.com/skylot/jadx) disassembler to decompile APK file. If it doesn't exist in your environment, it'll ask you to download.
The APKLeaks utilizes the [jadx](https://github.com/skylot/jadx) disassembler to decompile APK files. If jadx is not present in your system, it will prompt you to download it.

## Usage

@@ -75,29 +74,32 @@ Here are all the options it supports.
| -o, --output | Write to file results _(random if not set)_ | `apkleaks -f file.apk -o results.txt` |
| -p, --pattern | Path to custom patterns JSON | `apkleaks -f file.apk -p custom-rules.json` |
| -a, --args | Disassembler arguments | `apkleaks -f file.apk --args="--deobf --log-level DEBUG"` |
| --json | Save as JSON format | `apkleaks -f file.apk -o results.json --json` |
| --json | Save as JSON format | `apkleaks -f file.apk -o results.json --json` |

### Output

In general, if you don't provide `-o` argument, then it will generate results file automatically.

**NOTE:** By default it will also save the results in text format, use `--json` argument if you want JSON output format.
> [!TIP]
> By default it will also save the results in text format, use `--json` argument if you want JSON output format.
### Pattern

Custom patterns can be added with the following argument to provide sensitive _search rules_ in the JSON file format: `--pattern /path/to/custom-rules.json`. If not set, it'll use default patterns from [regexes.json](https://github.com/dwisiswant0/apkleaks/blob/master/config/regexes.json) file.
Custom patterns can be added with the following argument to provide sensitive _search rules_ in the JSON file format: `--pattern /path/to/custom-rules.json`. If no file is set, the tool will use the default patterns found in [regexes.json](https://github.com/dwisiswant0/apkleaks/blob/master/config/regexes.json) file.

Example patterns file:
Here's an example of what a custom pattern file could look like:

```json
// custom-rules.json
{
"Amazon AWS Access Key ID": "AKIA[0-9A-Z]{16}",
...
// ...
}
```

```
To run the tool using these custom rules, use the following command:

```bash
$ apkleaks -f /path/to/file.apk -p rules.json -o ~/Documents/apkleaks-results.txt
```

@@ -109,7 +111,8 @@ We give user complete discretion to pass the disassembler arguments. For example
$ apkleaks -f /path/to/file.apk -a "--deobf --log-level DEBUG"
```

**NOTE:** Please pay attention to the default disassembler arguments we use to prevent collisions.
> [!WARNING]
> Please pay attention to the default disassembler arguments we use to prevent collisions.
## License

2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v2.5.0
v2.6.3
15 changes: 9 additions & 6 deletions apkleaks/apkleaks.py
Original file line number Diff line number Diff line change
@@ -10,9 +10,9 @@
import threading

from contextlib import closing
from distutils.spawn import find_executable
from shutil import which
from pathlib import Path
from pipes import quote
from shlex import quote
from urllib.request import urlopen
from zipfile import ZipFile

@@ -24,7 +24,7 @@
class APKLeaks:
def __init__(self, args):
self.apk = None
self.file = args.file
self.file = os.path.realpath(args.file)
self.json = args.json
self.disarg = args.args
self.prefix = "apkleaks-"
@@ -33,7 +33,7 @@ def __init__(self, args):
self.output = tempfile.mkstemp(suffix=".%s" % ("json" if self.json else "txt"), prefix=self.prefix)[1] if args.output is None else args.output
self.fileout = open(self.output, "%s" % ("w" if self.json else "a"))
self.pattern = os.path.join(str(Path(self.main_dir).parent), "config", "regexes.json") if args.pattern is None else args.pattern
self.jadx = find_executable("jadx") if find_executable("jadx") is not None else os.path.join(str(Path(self.main_dir).parent), "jadx", "bin", "jadx%s" % (".bat" if os.name == "nt" else ""))
self.jadx = which("jadx") if which("jadx") is not None else os.path.join(str(Path(self.main_dir).parent), "jadx", "bin", "jadx%s" % (".bat" if os.name == "nt" else "")).replace("\\","/")
self.out_json = {}
self.scanned = False
logging.config.dictConfig({"version": 1, "disable_existing_loggers": True})
@@ -94,6 +94,7 @@ def decompile(self):
except Exception:
pass
comm = "%s" % (" ".join(quote(arg) for arg in args))
comm = comm.replace("\'","\"")
os.system(comm)

def extract(self, name, matches):
@@ -102,8 +103,10 @@ def extract(self, name, matches):
util.writeln("\n" + stdout, col.OKGREEN)
self.fileout.write("%s" % (stdout + "\n" if self.json is False else ""))
for secret in matches:
if name == "LinkFinder" and re.match(r"^.(L[a-z]|application|audio|fonts|image|layout|multipart|plain|text|video).*\/.+", secret) is not None:
continue
if name == "LinkFinder":
if re.match(r"^.(L[a-z]|application|audio|fonts|image|kotlin|layout|multipart|plain|text|video).*\/.+", secret) is not None:
continue
secret = secret[len("'"):-len("'")]
stdout = ("- %s" % (secret))
print(stdout)
self.fileout.write("%s" % (stdout + "\n" if self.json is False else ""))
15 changes: 9 additions & 6 deletions apkleaks/cli.py
Original file line number Diff line number Diff line change
@@ -4,17 +4,20 @@
import sys
from pathlib import Path

import pkg_resources

from apkleaks.apkleaks import APKLeaks
from apkleaks.colors import color as col

def header():
try:
VERSION = "v" + pkg_resources.require("apkleaks")[0].version
except Exception:
VERSION = open(os.path.join(str(Path(__file__).parent.parent), "VERSION"), "r").read().strip()
print(col.HEADER + " _ ____ _ ___ _ \n / \\ | _ \\| |/ / | ___ __ _| | _____ \n / _ \\ | |_) | ' /| | / _ \\/ _` | |/ / __|\n / ___ \\| __/| . \\| |__| __/ (_| | <\\__ \\\n /_/ \\_\\_| |_|\\_\\_____\\___|\\__,_|_|\\_\\___/\n {}\n --\n Scanning APK file for URIs, endpoints & secrets\n (c) 2020-2021, dwisiswant0\n".format(VERSION) + col.ENDC, file=sys.stderr)
from importlib import metadata
VERSION = "v" + metadata.version("apkleaks")
except ImportError:
try:
import pkg_resources
VERSION = "v" + pkg_resources.require("apkleaks")[0].version
except Exception:
VERSION = open(os.path.join(str(Path(__file__).parent.parent), "VERSION"), "r").read().strip()
print(col.HEADER + " _ ____ _ ___ _ \n / \\ | _ \\| |/ / | ___ __ _| | _____ \n / _ \\ | |_) | ' /| | / _ \\/ _` | |/ / __|\n / ___ \\| __/| . \\| |__| __/ (_| | <\\__ \\\n /_/ \\_\\_| |_|\\_\\_____\\___|\\__,_|_|\\_\\___/\n {}\n --\n Scanning APK file for URIs, endpoints & secrets\n (c) 2020-2024, dwisiswant0\n".format(VERSION) + col.ENDC, file=sys.stderr)

def argument():
parser = argparse.ArgumentParser()
Loading