Full Code of xiv3r/Kali-Linux-Termux for AI

main 091750f8e7d2 cached
4 files
14.2 KB
4.5k tokens
1 requests
Download .txt
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
================================================
# <h1 align="center">$${\color{red}Kali-Nethunter-Termux}$$
 </h1>
 
<p align="center">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.</p>

<img width="auto" height="auto" src="https://github.com/xiv3r/Kali-Linux-Termux/blob/main/kali_nethunter/NHGui.jpg">

<br></br>

# $${\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)
<br></br>

# $${\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 & )
```
<details><summary></summary>
<img width="auto" height="auto" src="https://github.com/xiv3r/Kali-Linux-Termux/blob/main/kali_nethunter/vncsetup.png">
</details>

> - Next Open the VNC client and add the address `127.0.0.1:5901` and type `kali` as username and your vnc `password`
<br></br>

# $${\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`
<details><summary></summary> 
<img width="auto" height="auto" src="https://github.com/xiv3r/Kali-Linux-Termux/blob/main/kali_nethunter/nhterm.png">
</details>

<details><summary>

## $${\color{magenta}Disable-VNC-Phantom-Process-Killer}$$
</summary>
 
> " 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
```
</details>


================================================
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 </dev/null
    starting_kex=1
    return 0
}

function stop-kex() {
    vncserver -kill :1 | sed s/"Xtigervnc"/"NetHunter KeX"/
    vncserver -kill :2 | sed s/"Xtigervnc"/"NetHunter KeX"/
    return 0
}

function passwd-kex() {
    vncpasswd
    return 0
}

function status-kex() {
    sessions=$(vncserver -list | sed s/"TigerVNC"/"NetHunter KeX"/)
    if [[ $sessions == *"590"* ]]; then
        printf "\n${sessions}\n"
        printf "\nYou can use the VNC client to connect to any of these displays.\n\n"
    else
        if [ ! -z $starting_kex ]; then
            printf '\nError starting the VNC server.\nPlease try "kali vnc kill" or restart your termux session and try again.\n\n'
        fi
    fi
    return 0
}

function kill-kex() {
    pkill Xtigervnc
    return $?
}

case $1 in
    start)
        start-kex
        ;;
    stop)
        stop-kex
        ;;
    status)
        status-kex
        ;;
    passwd)
        passwd-kex
        ;;
    kill)
        kill-kex
        ;;
    *)
        stop-kex
        start-kex
        status-kex
        ;;
esac
Download .txt
gitextract_yjqhy41o/

├── .github/
│   └── workflows/
│       └── kali.yml
├── README.md
└── kali_nethunter/
    ├── install.sh
    └── vnc
Condensed preview — 4 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (16K chars).
[
  {
    "path": ".github/workflows/kali.yml",
    "chars": 4731,
    "preview": "name: Kali Linux\n\non:\n  schedule:\n    - cron: '0 5 * * *'\n  workflow_dispatch:\n\njobs:\n  download-and-release:\n    runs-o"
  },
  {
    "path": "README.md",
    "chars": 3033,
    "preview": "# <h1 align=\"center\">$${\\color{red}Kali-Nethunter-Termux}$$\n </h1>\n \n<p align=\"center\">Termux Kali Linux NetHunter is a "
  },
  {
    "path": "kali_nethunter/install.sh",
    "chars": 5331,
    "preview": "#!/data/data/com.termux/files/usr/bin/bash\n\ncd \"$HOME\"\n\n# Install required packages\npkg install proot bsdtar libxml2 axe"
  },
  {
    "path": "kali_nethunter/vnc",
    "chars": 1443,
    "preview": "#!/bin/bash\n\nfunction start-kex() {\n    if [ ! -f ~/.vnc/passwd ]; then\n        passwd-kex\n    fi\n    USR=$(whoami)\n    "
  }
]

About this extraction

This page contains the full source code of the xiv3r/Kali-Linux-Termux GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 4 files (14.2 KB), approximately 4.5k tokens. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!