From 066abc4aa47438227d39c672b0c81cc237658232 Mon Sep 17 00:00:00 2001 From: morrownr Date: Sun, 5 Dec 2021 12:10:43 -0600 Subject: [PATCH] various updates --- 88x2bu.conf | 14 +- README.md | 53 +++---- docs/Monitor_Mode.md | 334 ------------------------------------------ start-mon.sh | 336 ------------------------------------------- 4 files changed, 33 insertions(+), 704 deletions(-) delete mode 100644 docs/Monitor_Mode.md delete mode 100755 start-mon.sh diff --git a/88x2bu.conf b/88x2bu.conf index f11ff08..dffcc88 100644 --- a/88x2bu.conf +++ b/88x2bu.conf @@ -3,7 +3,7 @@ # Purpose: Allow easy access to specific driver options. # # Edit the following line to change, add or delete options: -options 88x2bu rtw_drv_log_level=0 rtw_led_ctrl=1 rtw_vht_enable=1 rtw_power_mgnt=1 rtw_beamform_cap=0 rtw_dfs_region_domain=0 rtw_switch_usb_mode=2 +options 88x2bu rtw_drv_log_level=0 rtw_led_ctrl=1 rtw_vht_enable=1 rtw_power_mgnt=1 rtw_beamform_cap=10 rtw_dfs_region_domain=0 rtw_sel_p2p_iface=1 rtw_switch_usb_mode=2 # # After editing is complete, save this file (if using nano: Ctrl+X, Y, Enter) # and reboot to activate the changes. @@ -62,11 +62,11 @@ options 88x2bu rtw_drv_log_level=0 rtw_led_ctrl=1 rtw_vht_enable=1 rtw_power_mgn # # Beamforming options: ( rtw_beamform_cap ) # -# 0 = Disable (default) (recommended for AP mode) +# 0 = Disable # 1 = SU Beamformer # 2 = SU Beamformee # 3 = SU Beamformer and SU Beamformee -# 10= SU Beamformee and MU Beamformee +# 10= SU Beamformee and MU Beamformee (default) # 11= SU Beamformer and SU Beamformee and MU Beamformee # # Note: MU Beamformer not supported. @@ -88,6 +88,13 @@ options 88x2bu rtw_drv_log_level=0 rtw_led_ctrl=1 rtw_vht_enable=1 rtw_power_mgn # # ----- # +# Select P2P interface in concurrent mode: ( rtw_sel_p2p_iface ) +# +# 0 = Sets interface 0 to be p2p interface +# 1 = Sets interface 1 to be p2p interface (default) +# +# ----- +# # USB options: ( rtw_switch_usb_mode ) # # 0 = No switch @@ -116,6 +123,7 @@ options 88x2bu rtw_drv_log_level=0 rtw_led_ctrl=1 rtw_vht_enable=1 rtw_power_mgn # ----- # # hostapd setup information for rtl88x2bu +# Note: The best settings can vary but the following may be a good place to start. # # /etc/modprobe.d/88x2bu.conf # options 88x2bu rtw_drv_log_level=0 rtw_led_ctrl=0 rtw_vht_enable=2 rtw_power_mgnt=1 rtw_beamform_cap=0 rtw_dfs_region_domain=1 rtw_switch_usb_mode=1 diff --git a/README.md b/README.md index 1fe7c9f..5a47573 100644 --- a/README.md +++ b/README.md @@ -16,18 +16,18 @@ $ sudo uname -a && mokutil --sb-state && lsusb && rfkill list all && dkms status ----- -## 88x2bu ( 88x2bu.ko ) :rocket: +### 88x2bu ( 88x2bu.ko ) :rocket: -## Linux Driver for USB WiFi Adapters that are based on the RTL8812BU and RTL8822BU Chipsets +### Linux Driver for USB WiFi Adapters that are based on the RTL8812BU and RTL8822BU Chipsets - v5.13.1 (Realtek) (20210702) - Plus updates from the Linux community -## Features +### Features - IEEE 802.11 b/g/n/ac WiFi compliant - 802.1x, WEP, WPA TKIP and WPA2 AES/Mixed mode for PSK and TLS (Radius) -- WPA3 (see issue with title `How to Enable WPA3 support`) +- WPA3 (see pinned issue with title `How to Enable WPA3 support`) - IEEE 802.11b/g/n/ac Client mode * Supports wireless security for WEP, WPA TKIP and WPA2 AES PSK * Supports site survey scan and manual connect @@ -42,8 +42,8 @@ $ sudo uname -a && mokutil --sb-state && lsusb && rfkill list all && dkms status - Supported interface modes * IBSS * Managed + * Monitor * AP (see `Bridged_Wireless_Access_Point.md` the `docs` folder.) - * Monitor (see `Monitor_Mode.md` in the `docs` folder.) * P2P-client * P2P-GO * Concurrent (see `Concurrent_Mode.md` in the `docs` folder.) @@ -56,18 +56,18 @@ $ sudo uname -a && mokutil --sb-state && lsusb && rfkill list all && dkms status - AP mode DFS channel control - USB mode control -## Compatible CPUs +### Compatible CPUs - x86, amd64 - ARM, ARM64 - MIPS -## Compatible Kernels +### Compatible Kernels - Kernels: 3.8 - 5.11 (Realtek) - Kernels: 5.12 - 5.16 (community support) -## Tested Linux Distributions +### Tested Linux Distributions - Arch Linux (kernels 5.4 and 5.11) @@ -91,7 +91,7 @@ $ sudo uname -a && mokutil --sb-state && lsusb && rfkill list all && dkms status - Ubuntu 20.xx (kernels 5.4 and 5.8) and 21.xx (kernels 5.11 and 5.13) -## Download Locations for Tested Linux Distributions +### Download Locations for Tested Linux Distributions - [Arch Linux](https://www.archlinux.org) - [Debian](https://www.debian.org/) @@ -103,14 +103,14 @@ $ sudo uname -a && mokutil --sb-state && lsusb && rfkill list all && dkms status - [RHEL](https://www.redhat.com) - [Ubuntu](https://www.ubuntu.com) -## Tested Hardware +### Tested Hardware - [EDUP EP-AC1605GS WiFi Adapter 1300Mbps USB 3.0 High Gain Wireless Adapter](https://www.amazon.com/gp/product/B07Q56K68T) - [FIDECO 6B21-AC1200M WiFi Adapter - AC1200 Dual Band](https://www.amazon.co.uk/gp/product/B08523KPP9) - [Cudy WU1400 AC 1300Mbps USB 3.0 WiFi Adapter](https://www.amazon.com/Cudy-WU1200-AC1200Mbps-Wireless-Compatible/dp/B07Q9KY4NT) - [jjPlus WMU6202 miniPCIe - USB - WIFI2.4/5.0GHz Bluetooth (RTL8822BU)](https://techship.com/products/jjplus-wmu6202-mpcie-usb-wifi24-50ghz-bluetooth/) -## Compatible Devices +### Compatible Devices * [ALFA AWUS036ACU](https://store.rokland.com/collections/wi-fi-usb-adapters/products/alfa-awus036acu-802-11ac-ac1200-dual-band-wifi-usb-dongle-rp-sma-antennas) * ASUS AC1300 USB-AC55 B1 @@ -129,7 +129,7 @@ $ sudo uname -a && mokutil --sb-state && lsusb && rfkill list all && dkms status Note: Please read "supported-device-IDs" for information about how to confirm the correct driver for your adapter. -## Installation Information +### Installation Information The installation instructions are for the novice user. Experienced users are welcome to alter the installation to meet their needs. @@ -147,7 +147,7 @@ It is recommended that you do not delete the driver directory after installation There is no need to disable Secure Mode to install this driver. If Secure Mode is properly setup on your system, this installation will support it. -## Installation Steps +### Installation Steps #### Step 1: Open a terminal (e.g. Ctrl+Alt+T) @@ -284,7 +284,7 @@ Note: If you elect to skip the reboot at the end of the installation script, the driver may not load immediately and the driver options will not be applied. Rebooting is strongly recommended. -## Driver Options +### Driver Options A file called `88x2bu.conf` will be installed in `/etc/modprobe.d` by default. @@ -302,7 +302,7 @@ sudo ./edit-options.sh Note: Documentation for Driver Options is included in the file `88x2bu.conf`. -## Removal of the Driver +### Removal of the Driver Note: This script should be used in the following situations: @@ -331,7 +331,7 @@ cd ~/src/88x2bu-20210702 sudo ./remove-driver.sh ``` -## Recommended WiFi Router/ Access Point Settings +### Recommended WiFi Router/ Access Point Settings Note: These are general recommendations, some of which may not apply to your specific situation. @@ -354,7 +354,7 @@ Note: These are general recommendations, some of which may not apply to your spe After making and saving changes, reboot the router. -## Set regulatory domain to correct setting in OS +### Set regulatory domain to correct setting in OS Check the current setting @@ -386,7 +386,7 @@ Change the last line to read: REGDOMAIN=US ``` -## Recommendations regarding USB +### Recommendations regarding USB - Moving your USB WiFi adapter to a different USB port has been known to fix a variety of problems. @@ -401,7 +401,7 @@ REGDOMAIN=US - Some USB WiFi adapters require considerable electrical current and push the capabilities of the power available via USB port. One example is adapters that use the Realtek 8814au chipset. Using a powered multiport USB extension can be a good idea in cases like this. -## How to disable onboard WiFi on Raspberry Pi 3B, 3B+, 3A+, 4B and Zero W +### How to disable onboard WiFi on Raspberry Pi 3B, 3B+, 3A+, 4B and Zero W Add the following line to /boot/config.txt @@ -409,12 +409,7 @@ Add the following line to /boot/config.txt dtoverlay=disable-wifi ``` -## How to disable WiFi on most systems - -The `rfkill` utility can disable WiFi and Bluetooth (internal or external) on several systems, including but not limited to the Raspberry Pi. - - -## How to forget a saved WiFi network on a Raspberry Pi +### How to forget a saved WiFi network on a Raspberry Pi #### Step 1: Edit wpa_supplicant.conf @@ -430,7 +425,7 @@ sudo nano /etc/wpa_supplicant/wpa_supplicant.conf ----- -## FAQ: +### FAQ: Question: Is WPA3 supported? @@ -463,10 +458,6 @@ Answer: Yes. Post a message in `Issues` or `Discussions` if interested. Question: I am having problems with my adapter and I use Virtualbox? -Answer: The following article may help: - -``` -https://null-byte.wonderhowto.com/forum/wifi-hacking-attach-usb-wireless-adapter-with-virtual-box-0324433/ -``` +Answer: This [article](https://null-byte.wonderhowto.com/forum/wifi-hacking-attach-usb-wireless-adapter-with-virtual-box-0324433/) may help: ----- diff --git a/docs/Monitor_Mode.md b/docs/Monitor_Mode.md deleted file mode 100644 index 2cdf678..0000000 --- a/docs/Monitor_Mode.md +++ /dev/null @@ -1,334 +0,0 @@ -## Monitor Mode - -Purpose: Provide information and tools for testing and using monitor mode. - -Monitor mode, or RFMON (Radio Frequency MONitor) mode, allows a computer with a -wireless network interface controller (WNIC) to monitor all traffic received on -a wireless channel. Monitor mode allows packets to be captured without having to -associate with an access point or ad hoc network first. Monitor mode only -applies to wireless networks, while promiscuous mode can be used on both wired -and wireless networks. Monitor mode is one of the eight modes that 802.11 -wireless cards and adapters can operate in: Master (acting as an access point), -Managed (client, also known as station), Ad hoc, Repeater, Mesh, Wi-Fi Direct, -TDLS and Monitor mode. - -Note: This document and the start-mon.sh script have been tested on the following: -``` -Kali Linux -Raspberry Pi OS -Linux Mint -Ubuntu -``` ------ - -## Steps to test monitor mode - - -#### Update system -``` -sudo apt update -``` -``` -sudo apt full-upgrade -``` - ------ - -#### Ensure WiFi radio is not blocked -``` -sudo rfkill unblock wlan -``` - ------ - -#### Install the aircrack-ng and wireshark packages -``` -sudo apt install aircrack-ng wireshark -``` - ------ -#### Check wifi interface information -``` -iw dev -``` - ------ - -#### Information - -The wifi interface name ```wlan0``` is used in this document but you will need -to substitute the name of your wifi interface while using this document. - ------ - -#### Disable interfering processes - -Option 1 -``` -sudo airmon-ng check kill -``` - -Option 2, another way that works for me on Linux Mint: - -Note: I use multiple wifi adapters in my systems and I need to stay connected -to the internet while testing. This option works well for me and allows -me to stay connected by allowing Network Manager to continue managing interfaces -that are not marked as unmanaged. - -Ensure Network Manager doesn't cause problems -``` -sudo nano /etc/NetworkManager/NetworkManager.conf -``` -add -``` -[keyfile] -unmanaged-devices=interface-name:;interface-name:wlan0mon -``` - -Note: The above tells Network Manager to leave the specified interfaces alone. -Remember to replace `````` with the name of the wifi interface that you -intend to use in monitor mode. - -``` -sudo reboot -``` - ------ - -#### Change to monitor mode - -Option 1 - -Note: This option may not work with some driver/adapter combinations. If not, -press on with ```start-mon.sh``` or option 2. -``` -sudo airmon-ng start -``` - -Note: I have provided a script called ```start-mon.sh``` to automate most -of the following option. Please give it a try and make suggestions to improve it. -``` -Usage: $ sudo ./start-mon.sh -``` - -Option 2 - -Check the wifi interface name and mode -``` -iw dev -``` - -Take the interface down -``` -sudo ip link set down -``` - -Set monitor mode -``` -sudo iw set monitor control -``` - -Bring the interface up -``` -sudo ip link set up -``` - -Verify the mode has changed -``` -iw dev -``` - ------ - -### Test injection - -Option for 5 GHz and 2.4 GHz -``` -sudo airodump-ng --band ag -``` -Option for 5 GHz only -``` -sudo airodump-ng --band a -``` -Option for 2.4 GHz only -``` -sudo airodump-ng --band g -``` -Set the channel of your choice -``` -sudo iw dev set channel [NOHT|HT20] -``` -``` -sudo aireplay-ng --test -``` - ------ - -### Test deauth - -Option for 5 GHz and 2.4 GHz -``` -sudo airodump-ng --band ag -``` -Option for 5 GHz only -``` -sudo airodump-ng --band a -``` -Option for 2.4 GHz only -``` -sudo airodump-ng --band g -``` -``` -sudo airodump-ng --bssid --channel -``` -Option for 5 GHz: -``` -sudo aireplay-ng --deauth 0 -c -a -D -``` -Option for 2.4 GHz: -``` -sudo aireplay-ng --deauth 0 -c -a -``` - ------ - -### Revert to Managed Mode - -Check the wifi interface name and mode -``` -iw dev -``` - -Take the wifi interface down -``` -sudo ip link set down -``` - -Set managed mode -``` -sudo iw set type managed -``` - -Bring the wifi interface up -``` -sudo ip link set up -``` - -Verify the wifi interface name and mode has changed -``` -iw dev -``` - ------ - -### Change the MAC Address before entering Monitor Mode - -Check the wifi interface name, MAC address and mode -``` -iw dev -``` - -Take the wifi interface down -``` -sudo ip link set dev down -``` - -Change the MAC address -``` -sudo ip link set dev address -``` - -Set monitor mode -``` -sudo iw set monitor control -``` - -Bring the wifi interface up -``` -sudo ip link set dev up -``` - -Verify the wifi interface name, MAC address and mode has changed -``` -iw dev -``` - ------ - -### Change txpower -``` -sudo iw dev set txpower fixed 1600 -``` - -Note: 1600 = 16 dBm - ------ - -### airodump-ng can receive and interpret key strokes while running. -``` - -The following list describes the currently assigned keys and supported actions: - - -a - -Select active areas by cycling through these display options: - AP+STA; AP+STA+ACK; AP only; STA only - - -d - -Reset sorting to defaults (Power) - - -i - -Invert sorting algorithm - - -m - -Mark the selected AP or cycle through different colors if the selected AP is -already marked - - -o - -Enable colored display of APs and their stations. - - -p - -Disable colored display. - - -q - -Quit program. - - -r - -(De-)Activate realtime sorting - - applies sorting algorithm every time the display will be redrawn - - -s - -Change column to sort by, which currently includes: - - BSSID; - PWR level; - Beacons; - Data packets; - Packet rate; - Channel; - Max. data rate; - Encryption; - Strongest Ciphersuite; - Strongest Authentication; - ESSID -``` - ------ - diff --git a/start-mon.sh b/start-mon.sh deleted file mode 100755 index 612f475..0000000 --- a/start-mon.sh +++ /dev/null @@ -1,336 +0,0 @@ -#!/bin/bash - -SCRIPT_NAME="start-mon.sh" -SCRIPT_VERSION="20211118" - -# Purpose: Start and test monitor mode on the provided wlan interface -# -# Usage: $ sudo ./start-mon.sh [interface:wlan0] -# -# Status: This script is a work in progress. Please feel free to help -# make it better. -# -# Information: -# -# Some parts of this script require the installation of the following: -# aircrack-ng -# wireshark -# -# $ sudo apt install -y aircrack-ng wireshark -# -# Interfering processes must be disabled prior to running this script: -# -# Option 1 -#``` -# $ sudo airmon-ng check kill -#``` -# -# Option 2, another way that works for me on Linux Mint: -# -# Note: I use multiple wifi adapters in my systems and I need to stay -# connected to the internet while testing. This option works well for -# me and allows me to stay connected by allowing Network Manager to -# continue managing interfaces that are not marked as unmanaged. -# -# Note: Tells Network Manager to leave the specified interfaces alone. -#``` -# $ sudo nano /etc/NetworkManager/NetworkManager.conf -#``` -# add -#``` -# [keyfile] -# unmanaged-devices=interface-name:;interface-name:wlan0mon -#``` -# Note: Option 2 may not be enough and needs testing. - - -# Set color definitions (https://en.wikipedia.org/wiki/ANSI_escape_code) -RED='\033[1;31m' -YELLOW='\033[0;33;1m' -GREEN='\033[1;32m' -CYAN='\033[1;36m' -NoColor='\033[0m' - - -# Check that sudo was used to start the script -if [[ $EUID -ne 0 ]] -then - echo "You must run this script with superuser (root) privileges." - echo "Try: \"sudo ./${SCRIPT_NAME}\"" - exit 1 -fi - - -# Assign default monitor mode interface name -iface0mon='wlan0mon' - - -# Activate option to set automatic or manual interface mode -# -# Option 1: if you only have one wlan interface (automatic detection) -#iface0=`iw dev | grep 'Interface' | sed 's/Interface //'` -# -# Option 2: if you have more than one wlan interface (default wlan0) -iface0=${1:-wlan0} - - -# Set iface0 down -ip link set $iface0 down -# Check if iface0 exists and continue if true -if [ $? -eq 0 ] -then -# Display interface settings - clear - echo -e "${GREEN}" - echo ' --------------------------------' - echo -e " ${SCRIPT_NAME} ${SCRIPT_VERSION}" - echo - echo ' WiFi Interface:' - echo ' '$iface0 - echo ' --------------------------------' -# iface_name=$(iw $iface0 info | grep 'Interface' | sed 's/Interface //' | sed -e 's/^[ \t]*//') -# echo ' name - ' $iface_name -# iface_type=$(iw $iface0 info | grep 'type' | sed 's/type //' | sed -e 's/^[ \t]*//') -# echo ' type - ' $iface_type - iface_addr=$(iw $iface0 info | grep 'addr' | sed 's/addr //' | sed -e 's/^[ \t]*//') - echo ' addr - ' $iface_addr - iface_state=$(ip addr show $iface0 | grep 'state' | sed 's/.*state \([^ ]*\)[ ]*.*/\1/') - echo ' state - ' $iface_state - echo ' --------------------------------' - echo -e "${NoColor}" - -# Set addr - read -p " Do you want to set a new addr? [y/N] " -n 1 -r - if [[ $REPLY =~ ^[Yy]$ ]] - then - iface_addr_orig=$iface_addr - echo - read -p " What addr do you want? ( 12:34:56:78:90:ab ) " iface_addr -# ip link set dev $iface0 up - ip link set dev $iface0 address $iface_addr -# ip link set dev $iface0 down - fi - -# Rename the interface -# echo -# read -p " Do you want to rename $iface0 to wlan0mon? [y/N] " -n 1 -r -# echo -# if [[ $REPLY =~ ^[Yy]$ ]] -# then - ip link set $iface0 name $iface0mon -# else -# iface0mon=$iface0 -# fi - -# Set monitor mode -# iw dev set monitor -# Valid monitor flags are: -# none: no special flags -# fcsfail: show frames with FCS errors -# control: show control frames -# otherbss: show frames from other BSSes -# cook: use cooked mode -# active: use active mode (ACK incoming unicast packets) -# mumimo-groupid : use MUMIMO according to a group id -# mumimo-follow-mac : use MUMIMO according to a MAC address - iw dev $iface0mon set monitor control -# Set iface0mon up - ip link set $iface0mon up -# Display interface settings - clear - echo -e "${GREEN}" - echo ' --------------------------------' - echo -e " ${SCRIPT_NAME} ${SCRIPT_VERSION}" - echo - echo ' WiFi Interface:' - echo ' '$iface0 - echo ' --------------------------------' - iface_name=$(iw $iface0mon info | grep 'Interface' | sed 's/Interface //' | sed -e 's/^[ \t]*//') - echo ' name - ' $iface_name - iface_type=$(iw $iface0mon info | grep 'type' | sed 's/type //' | sed -e 's/^[ \t]*//') - echo ' type - ' $iface_type - iface_addr=$(iw $iface0mon info | grep 'addr' | sed 's/addr //' | sed -e 's/^[ \t]*//') - echo ' addr - ' $iface_addr - iface_state=$(ip addr show $iface0mon | grep 'state' | sed 's/.*state \([^ ]*\)[ ]*.*/\1/') - echo ' state - ' $iface_state - echo ' --------------------------------' - echo -e "${NoColor}" - - -# Run airodump-ng -# airodump-ng will display a list of detected access points and clients -# https://www.aircrack-ng.org/doku.php?id=airodump-ng -# https://en.wikipedia.org/wiki/Regular_expression - echo -e " airodump-ng can receive and interpret key strokes while running..." - echo - echo -e " a - select active area" - echo -e " i - invert sorting order" - echo -e " s - change sort column" - echo -e " q - quit" - echo ' --------------------------------' - echo - read -p " Do you want to run airodump-ng to display a list of detected access points and clients? [y/N] " -n 1 -r - if [[ $REPLY =~ ^[Yy]$ ]] - then -# usage: airodump-ng [,,...] -# -# -c : Capture on specific channels -# -a : Filter unassociated clients -# --ignore-negative-one : Removes the message that says fixed channel : -1 -# --essid-regex : Filter APs by ESSID using a regular expression -# -# Select option -# -# 1) shows hidden ESSIDs -# airodump-ng -c 1-165 -a --ignore-negative-one $iface0mon -# -# 2) does not show hidden ESSIDs - airodump-ng -c 1-165 -a --ignore-negative-one --essid-regex '^(?=.)^(?!.*CoxWiFi)' $iface0mon - fi - -# Set channel -# Default - chan=6 -# read -p " Do you want to set the channel? [y/N] " -n 1 -r -# if [[ $REPLY =~ ^[Yy]$ ]] -# then -# echo - read -p " What channel do you want to set? " chan -# fi -# ip link set dev $iface0mon down -# iw dev $iface0mon set channel $chan - iw $iface0mon set channel $chan -# ip link set dev $iface0mon up -# Display interface settings - clear - echo -e "${GREEN}" - echo ' --------------------------------' - echo -e " ${SCRIPT_NAME} ${SCRIPT_VERSION}" - echo - echo ' WiFi Interface:' - echo ' '$iface0 - echo ' --------------------------------' - iface_name=$(iw $iface0mon info | grep 'Interface' | sed 's/Interface //' | sed -e 's/^[ \t]*//') - echo ' name - ' $iface_name - iface_type=$(iw $iface0mon info | grep 'type' | sed 's/type //' | sed -e 's/^[ \t]*//') - echo ' type - ' $iface_type - iface_addr=$(iw $iface0mon info | grep 'addr' | sed 's/addr //' | sed -e 's/^[ \t]*//') - echo ' addr - ' $iface_addr -# bug - Realtek drivers don't show the right channel after it is set but the channel that was set does work - iface_chan=$(iw $iface0mon info | grep 'channel' | sed 's/channel //' | sed -e 's/^[ \t]*//') - echo ' chan - ' $chan - iface_txpw=$(iw $iface0mon info | grep 'txpower' | sed 's/txpower //' | sed -e 's/^[ \t]*//') - echo ' txpw - ' $iface_txpw - iface_state=$(ip addr show $iface0mon | grep 'state' | sed 's/.*state \([^ ]*\)[ ]*.*/\1/') - echo ' state - ' $iface_state - echo ' --------------------------------' - echo -e "${NoColor}" - -# Set txpw - read -p " Do you want to attempt to set the txpower? [y/N] " -n 1 -r - if [[ $REPLY =~ ^[Yy]$ ]] - then - echo - read -p " What txpw setting do you want? ( 2300 = 23 dBm ) " iface_txpw -# ip link set dev $iface0mon down -# iw dev $iface0mon set txpower fixed $iface_txpw - iw $iface0mon set txpower fixed $iface_txpw -# ip link set dev $iface0mon up -# Display interface settings - clear - echo -e "${GREEN}" - echo ' --------------------------------' - echo -e " ${SCRIPT_NAME} ${SCRIPT_VERSION}" - echo - echo ' WiFi Interface:' - echo ' '$iface0 - echo ' --------------------------------' - iface_name=$(iw $iface0mon info | grep 'Interface' | sed 's/Interface //' | sed -e 's/^[ \t]*//') - echo ' name - ' $iface_name - iface_type=$(iw $iface0mon info | grep 'type' | sed 's/type //' | sed -e 's/^[ \t]*//') - echo ' type - ' $iface_type - iface_addr=$(iw $iface0mon info | grep 'addr' | sed 's/addr //' | sed -e 's/^[ \t]*//') - echo ' addr - ' $iface_addr -# bug - Realtek drivers don't show the right channel after it is set but the channel that was set does work - iface_chan=$(iw $iface0mon info | grep 'channel' | sed 's/channel //' | sed -e 's/^[ \t]*//') - echo ' chan - ' $chan - iface_txpw=$(iw $iface0mon info | grep 'txpower' | sed 's/txpower //' | sed -e 's/^[ \t]*//') - echo ' txpw - ' $iface_txpw - iface_state=$(ip addr show $iface0mon | grep 'state' | sed 's/.*state \([^ ]*\)[ ]*.*/\1/') - echo ' state - ' $iface_state - echo ' --------------------------------' - echo -e "${NoColor}" - fi - -# Test injection capability with aireplay-ng - read -p " Do you want to test injection capability? [y/N] " -n 1 -r - if [[ $REPLY =~ ^[Yy]$ ]] - then - echo - aireplay-ng --test $iface0mon - fi - -# Start wireshark - read -p " Do you want to start Wireshark? [y/N] " -n 1 -r - if [[ $REPLY =~ ^[Yy]$ ]] - then - wireshark --interface wlan0mon -# filter: wlan.fc.type_subtype == 29 - fi - -# Return the adapter to original settings - read -p " Do you want to return the adapter to original settings? [Y/n] " -n 1 -r - if [[ $REPLY =~ ^[Yy]$ ]] - then -# Display interface settings - clear - echo -e "${GREEN}" - echo ' --------------------------------' - echo -e " ${SCRIPT_NAME} ${SCRIPT_VERSION}" - echo - echo ' WiFi Interface:' - echo ' '$iface0 - echo ' --------------------------------' - iface_name=$(iw $iface0mon info | grep 'Interface' | sed 's/Interface //' | sed -e 's/^[ \t]*//') - echo ' name - ' $iface_name - iface_type=$(iw $iface0mon info | grep 'type' | sed 's/type //' | sed -e 's/^[ \t]*//') - echo ' type - ' $iface_type - iface_addr=$(iw $iface0mon info | grep 'addr' | sed 's/addr //' | sed -e 's/^[ \t]*//') - echo ' addr - ' $iface_addr - iface_state=$(ip addr show $iface0mon | grep 'state' | sed 's/.*state \([^ ]*\)[ ]*.*/\1/') - echo ' state - ' $iface_state - echo ' --------------------------------' - echo -e "${NoColor}" - else - ip link set $iface0mon down - ip link set $iface0mon name $iface0 - iw $iface0 set type managed - ip link set dev $iface0 address $iface_addr_orig -# ip link set $iface0 up -# Display interface settings - clear - echo -e "${GREEN}" - echo ' --------------------------------' - echo -e " ${SCRIPT_NAME} ${SCRIPT_VERSION}" - echo - echo ' WiFi Interface:' - echo ' '$iface0 - echo ' --------------------------------' - iface_name=$(iw $iface0 info | grep 'Interface' | sed 's/Interface //' | sed -e 's/^[ \t]*//') - echo ' name - ' $iface_name - iface_type=$(iw $iface0 info | grep 'type' | sed 's/type //' | sed -e 's/^[ \t]*//') - echo ' type - ' $iface_type - iface_addr=$(iw $iface0 info | grep 'addr' | sed 's/addr //' | sed -e 's/^[ \t]*//') - echo ' addr - ' $iface_addr - iface_state=$(ip addr show $iface0 | grep 'state' | sed 's/.*state \([^ ]*\)[ ]*.*/\1/') - echo ' state - ' $iface_state - echo ' --------------------------------' - echo -e "${NoColor}" - fi - exit 0 -else - echo -e "${YELLOW}ERROR: Please provide an existing interface as parameter! ${NoColor}" - echo -e "${NoColor}Usage: $ ${CYAN}sudo ./start-mon.sh [interface:wlan0] ${NoColor}" - echo -e "${NoColor}Tip: $ ${CYAN}iw dev ${NoColor}(displays available interfaces)" - exit 1 -fi