Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grep for frequencies does not accomodate my adapter's output #12

Open
Mauville opened this issue Jun 18, 2024 · 4 comments
Open

Grep for frequencies does not accomodate my adapter's output #12

Mauville opened this issue Jun 18, 2024 · 4 comments

Comments

@Mauville
Copy link

Hello,
I'm using an RT5572 adapter, and when I run the command

iw phy phy0 info

I get the following frequencies

Frequencies:
                        * 2412.0 MHz [1] (20.0 dBm)
                        * 2417.0 MHz [2] (20.0 dBm)
                        * 2422.0 MHz [3] (20.0 dBm)
                        * 2427.0 MHz [4] (20.0 dBm)
                        * 2432.0 MHz [5] (20.0 dBm)
                        * 2437.0 MHz [6] (20.0 dBm)
                        * 2442.0 MHz [7] (20.0 dBm)
                        * 2447.0 MHz [8] (20.0 dBm)
                        * 2452.0 MHz [9] (20.0 dBm)
                        * 2457.0 MHz [10] (20.0 dBm)
                        * 2462.0 MHz [11] (20.0 dBm)
                        * 2467.0 MHz [12] (20.0 dBm) (no IR)
                        * 2472.0 MHz [13] (20.0 dBm) (no IR)
                        * 2484.0 MHz [14] (20.0 dBm) (no IR)

The grep part of the can_transmit_to_channel() function currently tries to find the string with:
CHANNEL_INFO=$(get_adapter_info ${IFACE} | grep " 24[0-9][0-9] MHz \[${CHANNEL_NUM}\]")

This pattern does not match frequencies listed in a float format (e.g., 2412.0 MHz).

I am not aware if this is a general change in iw behavior or just an issue with my card.

I've changed the code of the script to accommodate for my version like follows, but I do not know if this is something worth incorporating into the codebase.
CHANNEL_INFO=$(get_adapter_info ${IFACE} | grep "24[0-9][0-9]\(\.[0-9]\)\? MHz 8" \[${CHANNEL_NUM}\]")

@Mauville
Copy link
Author

Mauville commented Jun 18, 2024

I don't have much time to debug it, but berate_ap also detects my card as not virtual interface compatible, but commenting out the checks allows me to run the program perfectly.
Fluxion works flawlessly too, if that sheds any light as to why

$ sudo berate_ap wlan0 eth0 FreeWifi
=====Bypassed virtual check adapter code====
Config dir: /tmp/create_ap.wlan0.conf.X18tdL2y
PID: 5783
Creating a virtual WiFi interface... ap0 created.
conf 2412.0 MHz [1] (20.0 dBm)
Network Manager found, set ap0 as unmanaged device... DONE
Sharing Internet using method: nat
hostapd command-line interface: hostapd_cli -p /tmp/create_ap.wlan0.conf.X18tdL2y/hostapd_ctrl
Configuration file: /tmp/create_ap.wlan0.conf.X18tdL2y/hostapd.conf
rfkill: Cannot open RFKILL control device
Using interface ap0 with hwaddr 00:1c:50:0e:43:4a and ssid "FreeWifi"
Low entropy detected, starting haveged
haveged: command socket is listening at fd 4
ap0: interface state UNINITIALIZED->ENABLED
ap0: AP-ENABLED
ap0: STA d2:d0:c EEE 802.11: authenticated
ap0: STA d2:d0:c  IEEE 802.11: associated (aid 1)

Here's the output of the modes

        Supported interface modes:
                 * IBSS
                 * managed
                 * AP
                 * AP/VLAN
                 * monitor

@cablethief
Copy link
Member

Thanks so much for debugging, I think Ill keep this open incase others have similar issues. Ill investigate when I have some time in the future.

@weige288
Copy link

weige288 commented Aug 6, 2024

┌──(root㉿kali)-[/home/kali/Desktop]
└─# berate_ap --no-virt --mana-wpa --mana-wpaout wpa.cap -n wlan0mon weige 'Weige2024!Secure'

Config dir: /tmp/create_ap.wlan0mon.conf.slKGUVpV
PID: 78962

ERROR: Your adapter can not transmit to channel 1, frequency band 2.4GHz.

Doing cleanup.. done

┌──(root㉿kali)-[/home/kali/Desktop]
└─# sudo systemctl stop NetworkManager

┌──(root㉿kali)-[/home/kali/Desktop]
└─# berate_ap --no-virt --mana-wpa --mana-wpaout wpa.cap -n wlan0mon weige 'Weige2024!Secure'

Config dir: /tmp/create_ap.wlan0mon.conf.r1XqRsYZ
PID: 79506

ERROR: Your adapter can not transmit to channel 1, frequency band 2.4GHz.

Doing cleanup.. done

┌──(root㉿kali)-[/home/kali/Desktop]
└─#

@realalexandergeorgiev
Copy link

realalexandergeorgiev commented Sep 25, 2024

Same. Had to edit the file at line 1855 and comment it out/remove it.

  1. Open file vim /usr/bin/berate_ap
  2. Search for the line /can not tr
  3. Delete it dd
  4. Write changes and exit :wq

Offensive line 1855
can_transmit_to_channel ${WIFI_IFACE} ${CHANNEL} || die "Your adapter can not transmit to channel ${CHANNEL}, frequency band ${FREQ_BAND}GHz."

Update: Found the issue and created a PR #14

realalexandergeorgiev added a commit to realalexandergeorgiev/berate_ap that referenced this issue Sep 25, 2024
fix for "ERROR: Your adapter can not transmit to channel 1, frequency band 2.4GHz." - see sensepost#12

iw list now seems to add ".0" to the frequency, which causes parsing to fail. may be similar for 5ghz, not tested due to lack of hardware.

```
10:44 root@kali /alex $ iw list | egrep " MHz "                
			* 2412.0 MHz [1] (20.0 dBm)
			* 2417.0 MHz [2] (20.0 dBm)
			* 2422.0 MHz [3] (20.0 dBm)
			* 2427.0 MHz [4] (20.0 dBm)
			* 2432.0 MHz [5] (20.0 dBm)
			* 2437.0 MHz [6] (20.0 dBm)
			* 2442.0 MHz [7] (20.0 dBm)
			* 2447.0 MHz [8] (20.0 dBm)
			* 2452.0 MHz [9] (20.0 dBm)
			* 2457.0 MHz [10] (20.0 dBm)
			* 2462.0 MHz [11] (20.0 dBm)
			* 2467.0 MHz [12] (20.0 dBm)
			* 2472.0 MHz [13] (20.0 dBm)
			* 2484.0 MHz [14] (disabled)
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants