Repository: xiv3r/Kali-Linux-Termux
Branch: main
Commit: 091750f8e7d2
Files: 4
Total size: 14.2 KB
Directory structure:
gitextract_yjqhy41o/
├── .github/
│ └── workflows/
│ └── kali.yml
├── README.md
└── kali_nethunter/
├── install.sh
└── vnc
================================================
FILE CONTENTS
================================================
================================================
FILE: .github/workflows/kali.yml
================================================
name: Kali Linux
on:
schedule:
- cron: '0 5 * * *'
workflow_dispatch:
jobs:
download-and-release:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Downloading Kali Linux
run: |
# Download daily builds
wget https://image-nethunter.kali.org/nethunter-fs/kali-daily/kali-nethunter-daily-dev-rootfs-minimal-arm64.tar.xz || true
wget https://image-nethunter.kali.org/nethunter-fs/kali-daily/kali-nethunter-daily-dev-rootfs-nano-arm64.tar.xz || true
wget https://image-nethunter.kali.org/nethunter-fs/kali-daily/kali-nethunter-daily-dev-rootfs-minimal-armhf.tar.xz || true
wget https://image-nethunter.kali.org/nethunter-fs/kali-daily/kali-nethunter-daily-dev-rootfs-nano-armhf.tar.xz || true
# Download current stable builds
wget https://kali.download/nethunter-images/current/rootfs/kali-nethunter-rootfs-minimal-arm64.tar.xz || true
wget https://kali.download/nethunter-images/current/rootfs/kali-nethunter-rootfs-nano-arm64.tar.xz || true
wget https://kali.download/nethunter-images/current/rootfs/kali-nethunter-rootfs-minimal-armhf.tar.xz || true
wget https://kali.download/nethunter-images/current/rootfs/kali-nethunter-rootfs-nano-armhf.tar.xz || true
- name: Install GitHub CLI
run: |
# Install GitHub CLI using the official method
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo gpg --dearmor -o /usr/share/keyrings/githubcli-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
sudo apt update
sudo apt install -y gh
- name: Create DETAILS.md with release notes
run: |
cat > DETAILS.md << 'EOF'
## Termux app
- **App**: https://github.com/termux/termux-app/releases/download/v0.118.3/termux-app_v0.118.3+github-debug_universal.apk
- **Release**: https://github.com/termux/termux-app/releases
## Nethunter vnc
- **App**: https://store.nethunter.com/repo/com.offsec.nethunter.kex_11525001.apk
- **Release**: https://store.nethunter.com/packages/com.offsec.nethunter.kex
## Architectures
- **Arm64**: 64-bit ARM devices
- **Armhf**: 32-bit ARM devices
## Variants
- **Full**: Full installation includes vnc desktop server
- **Minimal**: Minimal installation with essential tools
- **Nano**: Even more minimal footprint
EOF
echo -e "\n## Checksums" >> DETAILS.md
echo '```' >> DETAILS.md
for file in kali-nethunter-*.tar.xz; do
if [ -f "$file" ]; then
size=$(du -h "$file" | cut -f1)
checksum=$(sha256sum "$file" | cut -d' ' -f1)
echo "$file - Size: $size - SHA256: $checksum" >> DETAILS.md
fi
done
echo '```' >> DETAILS.md
- name: Delete existing assets from release
run: |
# Only delete if release exists
if gh release view "kali-latest" > /dev/null 2>&1; then
# Get list of existing assets and delete them
gh release delete-asset "kali-latest" kali-nethunter-*.tar.xz --yes || true
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload assets to existing release
run: |
# Check if any files were downloaded
if ls kali-nethunter-*.tar.xz 1> /dev/null 2>&1; then
# Check if release exists, create if it doesn't
if ! gh release view "kali-latest" > /dev/null 2>&1; then
gh release create "kali-latest" \
--title "Kali Linux Latest Release: $(date +'%Y-%m-%d')" \
--notes-file DETAILS.md \
--draft=false \
--prerelease=false
else
# Update existing release with new notes
gh release edit "kali-latest" \
--title "Kali Linux Latest Release: $(date +'%Y-%m-%d')" \
--notes-file DETAILS.md
fi
# Upload all rootfs files that exist
for file in kali-nethunter-*.tar.xz; do
if [ -f "$file" ]; then
echo "Uploading $file"
gh release upload "kali-latest" "$file" --clobber
fi
done
else
echo "No Kali NetHunter files were downloaded. Skipping release upload."
exit 1
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
================================================
FILE: README.md
================================================
#
$${\color{red}Kali-Nethunter-Termux}$$
Termux Kali Linux NetHunter is a powerful tool for security professionals and enthusiasts. It allows users to perform a variety of security assessments on their Android devices without rooting them.
# $${\color{magenta}Requirements}$$
- 15GB Storage
- [Termux app](https://f-droid.org/repo/com.termux_1002.apk)
- [Nethunter VNC](https://store.nethunter.com/repo/com.offsec.nethunter.kex_11525001.apk)
# $${\color{magenta}Auto-Install}$$
```diff
-; apt update && pkg install wget -y && pkg upgrade -y -o Dpkg::Options::="--force-confnew" && clear && wget -qO install.sh https://raw.githubusercontent.com/xiv3r/Kali-Linux-Termux/refs/heads/main/kali_nethunter/install.sh && chmod +x install.sh && bash install.sh
```
### $${\color{magenta}Setup-VNC}$$
> - Setup for Kali Nethunter Full
> - After the installation type the following command in the termux terminal (not the kali)
> - Setup VNC password
```
kali vnc passwd
```
### $${\color{magenta}Run-VNC}$$
> - `127.0.0.1:5901`
```
( kali vnc & )
```
> - Next Open the VNC client and add the address `127.0.0.1:5901` and type `kali` as username and your vnc `password`
# $${\color{magenta}Usage}$$
- $${\color{magenta}Login-User}$$
```
kali
```
- $${\color{magenta}Login-Root}$$
```
kali -r
```
- $${\color{magenta}Logout}$$
```
exit
```
- $${\color{magenta}Kill-VNC-service}$$
```
kali kill vnc
```
- $${\color{magenta}Uninstall}$$
```
kali-uninstall
```
# $${\color{magenta}Terminal}$$
> Password: `kali`
## $${\color{magenta}Disable-VNC-Phantom-Process-Killer}$$
> " Process completed (signal 9) - press Enter "
>
- Download [Shizuku](https://github.com/RikkaApps/Shizuku/releases) and [Ashell](https://github.com/DP-Hridayan/aShellYou/releases) then enable developer options wireless debugging mode through shizuku and pair the key from the notification
- Permit ashell from shizuku settings
- Paste the adb commands below on ashell
- Execute the commands below, These commands will disable the phantom process killer:
```
adb shell /system/bin/device_config set_sync_disabled_for_tests persistent
```
```
adb shell /system/bin/device_config put activity_manager max_phantom_processes 2147483647
```
```
adb shell settings put global settings_enable_monitor_phantom_procs false
```
- To verify:
```
adb shell /system/bin/dumpsys activity settings | grep max_phantom_processes
```
```
adb shell /system/bin/device_config get activity_manager max_phantom_processes
```
================================================
FILE: kali_nethunter/install.sh
================================================
#!/data/data/com.termux/files/usr/bin/bash
cd "$HOME"
# Install required packages
pkg install proot bsdtar libxml2 axel fastfetch -y
clear
# Display system info
fastfetch --logo kali
# Start-up
sed -i '/termux-wake-lock/d' "$PREFIX/etc/bash.bashrc"
sed -i '/clear/d' "$PREFIX/etc/bash.bashrc"
sed -i '/kali -r/d' "$PREFIX/etc/bash.bashrc"
cat >> "$PREFIX/etc/bash.bashrc" << EOF
termux-wake-lock
clear
kali -r
EOF
# Get device architecture
case $(getprop ro.product.cpu.abi) in
arm64-v8a)
SYS_ARCH=arm64
;;
armeabi|armeabi-v7a)
SYS_ARCH=armhf
;;
*)
echo "[*] Unsupported Architecture!"
exit 1
;;
esac
# Set image strings
echo && echo ""
if [[ ${SYS_ARCH} == "arm64" ]]; then
echo "[1] Kali NetHunter ARM64 Full"
echo "[2] Kali NetHunter ARM64 Minimal"
echo "[3] Kali NetHunter ARM64 Nano"
read -rp "Select the number to install: " wimg
echo " "
case $wimg in
1) wimg="full" ;;
2) wimg="minimal" ;;
3) wimg="nano" ;;
*) wimg="minimal" ;;
esac
elif [[ ${SYS_ARCH} == "armhf" ]]; then
echo "[1] Kali NetHunter ARMhf Full"
echo "[2] Kali NetHunter ARMhf Minimal"
echo "[3] Kali NetHunter ARMhf Nano"
read -rp "Select the number to install: " wimg
echo " "
case $wimg in
1) wimg="full" ;;
2) wimg="minimal" ;;
3) wimg="nano" ;;
*) wimg="minimal" ;;
esac
fi
####
DIR="kali-${SYS_ARCH}"
IMAGE_NAME="kali-nethunter-rootfs-${wimg}-${SYS_ARCH}.tar.xz"
NM="kali"
# Download Kali rootfs
axel -o "$IMAGE_NAME" "https://kali.download/nethunter-images/current/rootfs/$IMAGE_NAME"
# Check file integrity
echo " "
echo "[*] Checking $NM Linux File Integrity...!!!"
echo " "
echo "[*] MD5"
md5sum "$IMAGE_NAME"
echo " "
echo "[*] SHA256"
sha256sum "$IMAGE_NAME"
echo " "
echo "[*] SHA512"
sha512sum "$IMAGE_NAME"
# Extract rootfs
echo " "
echo "[*] Extracting $IMAGE_NAME, Please wait...!!!"
proot --link2symlink bsdtar -xpJf "$IMAGE_NAME" >/dev/null 2>&1
# Adding shortcut file
cat > "$PREFIX/bin/$NM" <<- EOF
#!/data/data/com.termux/files/usr/bin/bash
cd "$HOME"
## termux-exec sets LD_PRELOAD so let's unset it before continuing
unset LD_PRELOAD
## Workaround for Libreoffice, also needs to bind a fake /proc/version
if [ ! -f $DIR/root/.version ]; then
touch $DIR/root/.version
fi
## Default user is "kali"
user="$NM"
home="/home/\$user"
start="sudo -u kali /bin/bash"
## NH can be launched as root with the "-r" cmd attribute
## Also check if user kali exists, if not start as root
if grep -q "kali" ${DIR}/etc/passwd; then
KALIUSR="1";
else
KALIUSR="0";
fi
if [[ \$KALIUSR == "0" || ("\$#" != "0" && ("\$1" == "-r" || "\$1" == "-R")) ]];then
user="root"
home="/\$user"
start="/bin/bash --login"
if [[ "\$#" != "0" && ("\$1" == "-r" || "\$1" == "-R") ]];then
shift
fi
fi
cmdline="proot \\
--link2symlink -p \\
-0 \\
-r $DIR \\
-b /dev \\
-b /proc \\
-b /sdcard \\
-b $DIR\$home:/dev/shm \\
-w \$home \\
/usr/bin/env -i \\
HOME=\$home \\
PATH=/usr/local/sbin:/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin \\
TERM=\$TERM \\
LANG=C.UTF-8 \\
\$start"
cmd="\$@"
if [ "\$#" == "0" ];then
exec \$cmdline
else
\$cmdline -c "\$cmd"
fi
EOF
chmod 755 "$PREFIX/bin/$NM"
# Download and configure vnc
wget -qO "$DIR/bin/vnc" "https://raw.githubusercontent.com/xiv3r/Kali-Linux-Termux/refs/heads/main/kali_nethunter/vnc"
chmod 755 "$DIR/bin/vnc"
# Add VNC autostart for full installation
if [ "$wimg" = "full" ]; then
echo "( kali vnc & )" >> "$PREFIX/etc/bash.bashrc"
fi
# Add uninstallation config file
cat > "$PREFIX/bin/$NM-uninstall" << EOF
#!/data/data/com.termux/files/usr/bin/bash
rm -rf "$HOME/$DIR"
rm -f "$PREFIX/bin/$NM"
sed -i '/termux-wake-lock/d' "$PREFIX/etc/bash.bashrc"
sed -i '/clear/d' "$PREFIX/etc/bash.bashrc"
sed -i '/$NM -r/d' "$PREFIX/etc/bash.bashrc"
sed -i '/( kali vnc & )/d' "$PREFIX/etc/bash.bashrc"
rm -f "$PREFIX/bin/$NM-uninstall"
EOF
chmod 755 "$PREFIX/bin/$NM-uninstall"
# Modify .bash_profile
sed -i '/if/,/fi/d' "$DIR/root/.bash_profile"
# Set SUID for sudo and su
chmod +s "$DIR/usr/bin/sudo"
chmod +s "$DIR/usr/bin/su"
# Fix DNS resolver
cat > "$DIR/etc/resolv.conf" << EOF
nameserver 9.9.9.10
nameserver 8.8.8.8
nameserver 1.1.1.1
EOF
# Fix Repo
cat > "$DIR/etc/apt/sources.list" << EOF
deb http://kali.download/kali kali-rolling main contrib non-free non-free-firmware
EOF
# Fix sudoer file
cat > "$DIR/etc/sudoers.d/$NM" << EOF
$NM ALL=(ALL:ALL) ALL
EOF
# Fastfetch
sed -i '/fastfetch/d' "$DIR/etc/bash.bashrc"
cat >> "$DIR/etc/bash.bashrc" << EOF
sudo apt update
sudo apt install fastfetch -y
sed -i '/sudo apt update/d' "/etc/bash.bashrc"
sed -i '/sudo apt install fastfetch -y/d' "/etc/bash.bashrc"
fastfetch
EOF
# Configure sudo.conf
cat > "$DIR/etc/sudo.conf" << EOF
Set disable_coredump false
EOF
# Modify user and group IDs
USRID=$(id -u)
GRPID=$(id -g)
"$NM" -r usermod -u "$USRID" "$NM" >/dev/null 2>&1
"$NM" -r groupmod -g "$GRPID" "$NM" >/dev/null 2>&1
# Delete Tarball
rm -f "$IMAGE_NAME"
rm -f install.sh
# Display success message
cat << EOF
[*] To Login Kali Nethunter Type: $NM
EOF
bash kali -r
================================================
FILE: kali_nethunter/vnc
================================================
#!/bin/bash
function start-kex() {
if [ ! -f ~/.vnc/passwd ]; then
passwd-kex
fi
USR=$(whoami)
if [ $USR == "root" ]; then
SCREEN=":2"
else
SCREEN=":1"
fi
export MOZ_FAKE_NO_SANDBOX=1; export HOME=${HOME}; export USER=${USR}; LD_PRELOAD=/usr/lib/aarch64-linux-gnu/libgcc_s.so.1 nohup vncserver $SCREEN >/dev/null 2>&1