Metadata-Version: 2.4
Name: atwa-nh
Version: 0.2.0
Summary: ATWA-NG for NetHunter: lightweight CLI-only WiFi test suite for Kali NetHunter
Author: KiMiGuel
License-Expression: MIT
Keywords: nethunter,wifi,80211,atwa-ng
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Information Technology
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Security
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: dpkt>=1.9
Requires-Dist: pyroute2>=0.9
Dynamic: license-file

<p align="center">
  <img src="https://raw.githubusercontent.com/KiMiGuel/ATWA-NH/main/docs/assets/kali-nethunter-logo.svg" alt="Kali NetHunter" width="150">
  <img src="https://raw.githubusercontent.com/KiMiGuel/ATWA-NH/main/docs/assets/atwa-ng-logo.png" alt="ATWA-NG" width="110">
</p>

# ATWA-NH — ATWA-NG for NetHunter

[![PyPI](https://img.shields.io/pypi/v/atwa-nh.svg)](https://pypi.org/project/atwa-nh/)
[![Python](https://img.shields.io/pypi/pyversions/atwa-nh.svg)](https://pypi.org/project/atwa-nh/)
[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
[![CI](https://github.com/KiMiGuel/ATWA-NH/actions/workflows/workflow.yml/badge.svg)](https://github.com/KiMiGuel/ATWA-NH/actions/workflows/workflow.yml)

A lightweight, CLI-only port of [ATWA-NG](https://github.com/KiMiGuel/ATWA-NG)
for Kali NetHunter. It runs inside the ARM64 Kali chroot from NetHunter
Terminal, uses a detected monitor-capable USB adapter, and leaves Android Wi-Fi
(`wlan0`) and its vendor supplicant untouched.

No GUI. No password cracking. No vendored x86 binaries.

> [!WARNING]
> By default ATWA-NH refuses the conventional Android STA interface (`wlan0`)
> and does not run `airmon-ng check kill`, `svc wifi disable`, or change the
> global regulatory domain. `--allow-sta` overrides that protection, but the
> interface must still support monitor mode.

## Quick start

**1. Install inside the Kali chroot**

```sh
python3 -m pip install atwa-nh
```

This creates the `atwa-nh` command and installs `dpkt` (radiotap / 802.11
decoding) and `pyroute2` (interface discovery and monitor-mode control over
nl80211). Capture and injection use raw `AF_PACKET` sockets from the standard
library; `iw`/`ip` remain as a fallback if pyroute2 is unavailable. To install
from source instead:

```sh
git clone https://github.com/KiMiGuel/ATWA-NH.git
cd ATWA-NH
sh install.sh
```

The source installer copies `atwa_nh` into the chroot's site-packages. It needs
`dpkt` and `pyroute2` installed first and writes nothing to `/system` or
`/sdcard`.

**2. Check it works**

```sh
atwa-nh --help
```

**3. Run it**

```sh
atwa-nh              # interface chooser, then numbered menu (needs a terminal)
atwa-nh scan --iface wlan1
```

On launch the menu first probes `iw dev` / `iw list` and shows an **interface
selection** screen: every wireless adapter with its PHY, current mode and
capabilities (monitor / injection / bands). Pick the number of your USB adapter
and ATWA-NH brings it up in monitor mode before showing the seven commands.
`a` toggles the protected STA interface, `r` rescans, `q` quits. Only adapters
whose PHY supports monitor mode can be selected; the Android STA `wlan0` stays
hidden until you press `a`.

The menu lists the seven commands, `i) Change interface` and `0) Exit`. Every
command uses the adapter you picked at startup — there is no per-command
`iface` prompt — and asks only for the values the command actually needs. Set
`NO_COLOR` or pipe the output to get plain text.

## NetHunter Custom Command

In the NetHunter app, add a **Custom Command** with the absolute module path —
the app does not inherit the chroot's `PATH`:

```sh
/usr/bin/python3 -m atwa_nh scan --iface wlan1
```

Replace `wlan1` with the adapter reported by the capability probe. See
[docs/nethunter.md](docs/nethunter.md) for the full steps.

## Commands

| Command | What it does | Main options |
|---|---|---|
| `scan` | Discover access points | `--iface`, `--duration`, `--managed` |
| `wps-recon` | Filter APs advertising WPS | `--iface`, `--duration`, `--managed` |
| `eapol-hunt` | Collect EAPOL frames in monitor mode | `--iface`, `--duration` |
| `handshake` | Capture a 4-way handshake | `--iface`, `--duration` |
| `pmkid` | Capture PMKIDs | `--iface`, `--duration` |
| `deauth` | Inject deauthentication frames | `--iface`, `--bssid`, `--client`, `--count` |
| `verify-capture` | Check a capture for EAPOL traffic | `--iface`, `--file` |

In the menu, `scan` and `wps-recon` print access points live while hopping the
adapter's supported channels. There is no duration prompt: the scan runs up to
60 seconds, and pressing **Enter** stops it early. ATWA-NH then lists the APs
found so far, sorted by signal strength (strongest first) — pick one and its
BSSID is prefilled for `deauth` and its channel is selected for `handshake` /
`pmkid`. On a terminal the live view is redrawn in the same order.

Every on-air command accepts `--iface` and `--allow-sta`. Interface names vary
between devices, so selection is based on the PHY's monitor capability, not a
hardcoded name. The conventional STA name is protected by default;
`--allow-sta` opts out deliberately. `scan` and `wps-recon` use
`iw dev <iface> scan` automatically when the adapter is in managed mode, and
`--managed` forces it.

> [!NOTE]
> `deauth` reports `verified=False` until delivery is confirmed by ACK counters,
> TX status, or a second sniffer. The raw socket accepting a frame is not proof
> of injection. Treat it as unproven on-air until verified.

## Adapters

| Adapter | Status |
|---|---|
| AR9271 (`ath9k_htc`) | Reference adapter — managed scan, monitor, `frame` TX status |
| MT7610U (`mt76`) | Validated dual-band — managed scan, monitor, `frame` |
| RTL8814AU | Experimental — capability-probed at runtime |
| RTL8811AU | Retired — managed scan reboots the kernel |

Injection is gated on the adapter's `frame` nl80211 command. Captures land in
`/sdcard/nh_files/atwa-ng` when available, otherwise `$HOME/.atwa-nh` in the
chroot.

## Tests

```sh
PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 python3 -m pytest tests/ -q
```

The environment variable avoids a broken host-level `logfire` pytest plugin;
it is not needed inside the clean chroot.

## Provenance

ATWA-NH is a separate, reduced port of ATWA-NG et.

NetHunter is a Kali Linux project; the NetHunter logo is used to identify the
platform. The ATWA-NG mark comes from the ATWA-NG project.

## License

MIT — see [LICENSE](LICENSE).
