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

Update berate_ap #14

Closed

Conversation

realalexandergeorgiev
Copy link

fix for "ERROR: Your adapter can not transmit to channel 1, frequency band 2.4GHz." - see #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)

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)
```
@cablethief
Copy link
Member

Im looking at the linux-router project (The successor to create_ap), and seeing how they addressed this. What are your thoughts on https://github.com/garywill/linux-router/blob/master/lnxrouter#L624-L641.

@cablethief
Copy link
Member

As an additional note, your regex does not escape the .. This solution also has the effect of killing previous iw outputs so it will kill backwards compatibility.

@realalexandergeorgiev
Copy link
Author

Yes,true. Feel free to add the [], but I strongly believe whoever uses kali has it up2date anyway ;)

@no0be
Copy link

no0be commented Dec 16, 2024

I faced the same issue for both 2.4 GHz and 5 GHz. Fixed it by simply adapting the grep to match the frequency in float format:

    if [[ $USE_IWCONFIG -eq 0 ]]; then
        if [[ $FREQ_BAND == 2.4 ]]; then
            CHANNEL_INFO=$(get_adapter_info ${IFACE} | grep " 24[0-9][0-9]\.0 MHz \[${CHANNEL_NUM}\]")
        else
            CHANNEL_INFO=$(get_adapter_info ${IFACE} | grep " \(49[0-9][0-9]\|5[0-9]\{3\}\)\.0 MHz \[${CHANNEL_NUM}\]")
        fi

@cablethief
Copy link
Member

Thank you, I took the code from Linux-router and applied it.

@cablethief cablethief closed this Feb 3, 2025
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

Successfully merging this pull request may close these issues.

3 participants