Skip to content

Commit f9c5d90

Browse files
committed
release: update KernelSU version, internal refactoring
1 parent 0813c1a commit f9c5d90

33 files changed

+570
-495
lines changed

.dockerignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
.vscode
33
**/__pycache__
44

5-
# git subrepos (==submodules)
5+
# git subrepos
66
android_*
77
*_kernel_*
88
clang*

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
**/__pycache__
44
.mypy_cache
55

6-
# git subrepos (==submodules)
6+
# git subrepos
77
/android_*
88
/*_kernel_*
99
/clang*
@@ -18,4 +18,4 @@
1818
/source
1919
/bundle
2020
/localversion
21-
/multi-build
21+
/multi-build

Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ FROM python:3.12-slim-bookworm AS base
44
ARG WDIR=/zero_build
55
ENV CONAN_UPLOAD_CUSTOM 0
66

7-
# place sources from host to container
7+
# transfer sources from host to container
88
COPY . ${WDIR}
99
WORKDIR ${WDIR}
1010

@@ -16,6 +16,7 @@ RUN \
1616
apt-get install -y \
1717
neovim \
1818
curl \
19+
wget \
1920
git \
2021
gcc \
2122
g++ \

README.md

Lines changed: 38 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ An Android kernel with Kali NetHunter functionality.
77
- [zero\_kernel](#zero_kernel)
88
- [Contents](#contents)
99
- [**Disclaimer**](#disclaimer)
10+
- [Description](#description)
1011
- [Kernel Features](#kernel-features)
1112
- [Supported ROMs](#supported-roms)
12-
- [Important Note](#important-note)
13+
- [ROM Artifacts in Releases](#rom-artifacts-in-releases)
1314
- [Usage](#usage)
1415
- [Prerequisites](#prerequisites)
1516
- [Kernel](#kernel)
@@ -27,6 +28,14 @@ An Android kernel with Kali NetHunter functionality.
2728

2829
**Anything you do with this kernel you do at your own risk. By using it, you take the responsibility upon yourself and in case of any issue you are not to blame me or other related contributors.**
2930

31+
## Description
32+
33+
Technically speaking, the codebase of this project is an extensive wrapper automating the entire Android kernel build process, starting from kernel source collection and ending with artifact packaging.
34+
35+
The key goal is to modify the kernel in such a way that enables unique features of [Kali NetHunter](https://www.kali.org/docs/nethunter) — a ROM layer designed to add extended functionality for penetration testing in a mobile form factor.
36+
37+
The architecture of this wrapper is ~~trying to be~~ as modular as possible, making it a little easier to add support for new devices.
38+
3039
## Kernel Features
3140

3241
The kernel has the following features:
@@ -38,7 +47,7 @@ The kernel has the following features:
3847

3948
## Supported ROMs
4049

41-
For OnePlus 5/T devices:
50+
For **OnePlus 5/T** devices:
4251

4352
- 4.4 Linux kernel version:
4453
- LineageOS;
@@ -52,11 +61,11 @@ For OnePlus 5/T devices:
5261

5362
\** -- this, **in theory**, is relevant to all 4.14-based ROMs for this device in existence.
5463

55-
## Important Note
64+
## ROM Artifacts in Releases
5665

5766
The contents of each release include ROM builds compatible with corresponding kernel builds. These ROM files are **unmodified and mirrored from official sources**.
5867

59-
This can be verified with the checksums, which should be identical to the ones presented on the ROM project's official web page.
68+
This can be verified via the checksums, which should be identical to the ones presented on the ROM project's official web page.
6069

6170
You can always download the same ROM file from official sources if you'd like. The mirroring in this repository is done due to the fact that some ROM projects remove their older builds once they become too outdated.
6271

@@ -97,11 +106,10 @@ To run this tool in a `local` environment, you will need:
97106
You will also need a few Python packages. To install them, use:
98107

99108
```sh
109+
python3 -m pip install poetry
100110
python3 -m poetry install --no-root
101111
```
102112

103-
To install `poetry`, use `python3 -m pip install poetry`.
104-
105113
### Kernel
106114

107115
Kernel build process can be launched by using the `python3 wrapper kernel <arguments>` command.
@@ -110,14 +118,14 @@ For more options you can refer to the help message below.
110118

111119
```help
112120
$ python3 wrapper kernel --help
113-
usage: wrapper kernel [-h] --buildenv {local,docker,podman} --base
121+
usage: wrapper kernel [-h] --build-env {local,docker,podman} --base
114122
{los,pa,x,aosp} --codename CODENAME --lkv LKV [-c]
115123
[--clean-image] [--log-level {normal,verbose,quiet}]
116124
[-o OUTLOG] [--ksu]
117125
118126
options:
119127
-h, --help show this help message and exit
120-
--buildenv {local,docker,podman}
128+
--build-env {local,docker,podman}
121129
select build environment
122130
--base {los,pa,x,aosp}
123131
select a kernel base for the build
@@ -131,6 +139,7 @@ options:
131139
-o OUTLOG, --output OUTLOG
132140
save logs to a file
133141
--ksu add KernelSU support
142+
134143
```
135144

136145
### Assets
@@ -139,14 +148,14 @@ As mentioned, there is also an asset downloader, which can collect latest versio
139148

140149
```help
141150
$ python3 wrapper assets --help
142-
usage: wrapper assets [-h] --buildenv {local,docker,podman} --base
151+
usage: wrapper assets [-h] --build-env {local,docker,podman} --base
143152
{los,pa,x,aosp} --codename CODENAME --chroot
144153
{full,minimal} [--rom-only] [--clean-image] [--clean]
145154
[--log-level {normal,verbose,quiet}] [-o OUTLOG] [--ksu]
146155
147156
options:
148157
-h, --help show this help message and exit
149-
--buildenv {local,docker,podman}
158+
--build-env {local,docker,podman}
150159
select build environment
151160
--base {los,pa,x,aosp}
152161
select a kernel base for the build
@@ -184,15 +193,15 @@ An option named `slim` is a much lighter version of `full` packaging, as only th
184193

185194
```help
186195
$ python3 wrapper bundle --help
187-
usage: wrapper bundle [-h] --buildenv {local,docker,podman} --base
196+
usage: wrapper bundle [-h] --build-env {local,docker,podman} --base
188197
{los,pa,x,aosp} --codename CODENAME --lkv LKV
189198
--package-type {conan,slim,full} [--conan-upload]
190199
[--clean-image] [--log-level {normal,verbose,quiet}]
191200
[-o OUTLOG] [--ksu]
192201
193202
options:
194203
-h, --help show this help message and exit
195-
--buildenv {local,docker,podman}
204+
--build-env {local,docker,podman}
196205
select build environment
197206
--base {los,pa,x,aosp}
198207
select a kernel base for the build
@@ -214,12 +223,23 @@ options:
214223

215224
Here are some examples of commands:
216225

217-
- **(Recommended)** Build kernel and collect ROM via Docker:
218-
- `python3 wrapper bundle --buildenv=docker --base=los --codename=dumpling --lkv=4.4 --package-type=slim`;
219-
- Build kernel locally:
220-
- `python3 wrapper kernel --buildenv=local --base=los --codename=dumpling --lkv=4.4`;
221-
- Collect all the assets locally:
222-
- `python3 wrapper assets --buildenv=local --base=los --codename=dumpling --package-type=full`.
226+
**(Recommended)** Build kernel and collect ROM via Docker:
227+
228+
```sh
229+
python3 wrapper bundle --build-env=docker --base=los --codename=dumpling --lkv=4.4 --package-type=slim
230+
```
231+
232+
Build kernel locally:
233+
234+
```sh
235+
python3 wrapper kernel --build-env=local --base=los --codename=dumpling --lkv=4.4
236+
```
237+
238+
Collect all of the assets locally:
239+
240+
```sh
241+
python3 wrapper assets --build-env=local --base=los --codename=dumpling --package-type=full
242+
```
223243

224244
## Credits
225245

conanfile.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
from conans import ConanFile
22

33

4-
class ZeroConan(ConanFile):
4+
class ZeroKernelConan(ConanFile):
55
name = "zero"
6-
version = "0.4.0"
6+
version = "0.4.1"
77
author = "seppzer0"
88
url = "https://gitlab.com/api/v4/projects/40803264/packages/conan"
99
description = "An Android kernel with Kali NetHunter functionality."
10-
topics = ("zero_kernel", "kali-nethunter")
10+
topics = ("zero_kernel", "kali-nethunter", "nethunter")
1111
settings = None
1212
options = {
1313
"base": ("los", "pa", "x", "aosp"),
@@ -19,13 +19,15 @@ def export_sources(self):
1919
self.copy("*", src="source", dst=".")
2020

2121
def build(self):
22-
cmd = "python3 wrapper kernel local {0} {1} &&"\
23-
"python3 wrapper assets local {0} {1} {2} --clean"\
24-
.format(
25-
self.options.rom,
26-
self.options.codename,
27-
self.options.chroot
28-
)
22+
shared_args = "--build-env=local --base={} --codename={} --chroot={}"\
23+
.format(
24+
self.options.base,
25+
self.options.codename,
26+
self.options.chroot
27+
)
28+
cmd = "python3 wrapper kernel {0} &&"\
29+
"python3 wrapper assets {0} --clean"\
30+
.format(shared_args)
2931
print(f"[cmd] {cmd}")
3032
self.run(cmd)
3133

docs/FAQ.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This page contains answers to popular questions in relation to this kernel.
44

55
## Q: How to TURN ON monitor mode on internal Wi-Fi card?
66

7-
There are two options to switch internal Wi-Fi card to monitor mode:
7+
**A:** There are two options to switch internal Wi-Fi card to monitor mode:
88

99
- in Kali chroot environment, launch `airmon-ng start wlan0`;
1010
- in NetHunter app, navigate to the `Custom Commands` menu and launch the `Start wlan0 in monitor mode`.
@@ -13,14 +13,14 @@ Be aware that while in monitor mode, you won't be able to connect to a Wi-Fi net
1313

1414
## Q: How to TURN OFF monitor mode on internal Wi-Fi card?
1515

16-
Similarly, depending on which approach you chose to turn on the monitor mode, there are two options:
16+
**A:** Similarly, depending on which approach you chose to turn on the monitor mode, there are two options:
1717

1818
- in Kali chroot environment -> `airmon-ng stop wlan0`;
1919
- in NetHunter app -> `Custom Commands` -> `Stop wlan0 in monitor mode`.
2020

2121
## Q: Why is there an unused wlan1 interface?
2222

23-
**TL;DR**: Because it's a ~~bug~~ feature of Android 13.
23+
**A:** Because it's a ~~bug~~ feature of Android 13.
2424

2525
Initially, when launching `airmon-ng` in Kali chroot environment without any of the interfaces in monitor mode and no external adapters plugged in, you will see two wlan interfaces: `wlan0` and `wlan1`.
2626

@@ -30,4 +30,8 @@ Switching `wlan0` to monitor mode disables `wlan1` completely. However, when res
3030

3131
## Q: How to TURN ON and OFF monitor mode on external Wi-Fi card?
3232

33-
For an external card, you would have to use `airmon-ng start <interface>` and `airmon-ng stop <interface>` commands.
33+
**A:** For an external card, you would have to use `airmon-ng start <interface>` and `airmon-ng stop <interface>` commands.
34+
35+
## Q: How do I switch from standard partition ROM to retrofit dynamic partition ROM and vice versa?
36+
37+
**A:** Refer to these [instructions](https://gist.github.com/nkeor/d71b7884ee951de669b0d4baeacc58ba).

docs/FLASHING.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Listed below files are required:
2323
- compiled kernel, obviously;
2424
- ROM;
2525
- Magisk or KernelSU;
26-
- TWRP, the unofficial 3.7.0 version (supports operations with encrypted and dynamic partitions);
26+
- TWRP, the special [build](https://sourceforge.net/projects/op5-5t/files/Android-12/TWRP/twrp-3.7.0_12-5-dyn-cheeseburger_dumpling.img/download) by faoliveira78 (supports operations with encrypted and dynamic partitions);
2727
- DM-Verity and Force Encrypt disabler;
2828
- Kali NetHunter + Kali NetHunter Terminal apps;
2929
- Kali NetHunter Chroot (you can do this later, but it would be easier to download this beforehand);
@@ -50,8 +50,9 @@ Before doing anything, please ensure that you have:
5050
- wipe your phone via `Wipe -> Advanced Wipe` menu, check all the shown boxes;
5151
- wipe your device again via `Wipe -> Format Data` menu (this will remove any encryption that is present on your device);
5252
- reboot into TWRP via `Reboot -> Recovery`;
53-
- flash ROM;
54-
- flash kernel;
53+
- if using a Retrofit Dynamic Partitions ROM such as ParanoidAndoid -> untoggle `Unmount System before installing a ZIP` in the Settings;
54+
- flash the ROM;
55+
- flash the kernel;
5556
- **if using Magisk** --> flash root manager (Magisk; you must change the `.apk` extension into `.zip` for this);
5657
- flash DM-Verity and Force Encrypt disabler zip;
5758
- reboot into system via `Reboot -> System` .

docs/TODO.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,15 @@
2626
- [x] add proper OS detection for preventing local builds in unsupported systems;
2727
- [x] add static analysis for the wrapper;
2828
- [x] add a single-point manifest with main info on the tool;
29-
- [ ] add release body when creating a release via CI/CD;
30-
- [ ] add static analysis report to release body;
3129
- [x] improve documentation;
3230
- [x] apply OOP paradigm;
3331
- [ ] add tests (unit/integration/etc);
3432
- [x] switch to Poetry for dependency management;
3533
- [ ] create a commit-based lockfile system for reproducible kernel builds;
36-
- [ ] implement generators;
3734
- [x] switch to `pathlib`;
3835
- [ ] switch to `raise` instead of `sys.exit`;
3936
- [ ] use `pydantic`;
4037
- [x] add a FAQ page;
41-
- [ ] add wiki;
4238
- [x] refactor Docker/Podman command formation;
4339
- [ ] refactor logging mechanism;
4440
- [x] fix Podman usage (.dockerignore);
@@ -55,4 +51,5 @@
5551
- [x] add a new argument responsible for Linux kernel version selection;
5652
- [x] add 4.14 Linux kernel version builds;
5753
- [ ] decompose `run` methods into separate functions as much as possible;
58-
- [ ] new device support: OP9.
54+
- [ ] new device support: OP9;
55+
- [ ] add type checks with pyright.

0 commit comments

Comments
 (0)