openwrt prevent device from connecting to certain open wifi?

1

I am working on a small project with my Tp-Link MR3040 using barrier breaker.

I am using the command iw wlan0 connect any which will connect to any open WiFi network.

Where I currently live, Time Warner Cable has its open WiFi across town and I don't want my device connecting since it does not provide internet (sites I go to are forbidden 403) is there a way to "blacklist" that ssid?

andyADD

Posted 2014-05-22T01:21:18.210

Reputation: 111

Answers

0

You can scan, and choose which one to connect to by yourself Get scan results with signal strength and mac using

iw dev wlan0 scan

Parse it in a script and select which one to join manually. iw scan results would contain "RSN:" or "WPA:" or "WEP:" if they are not open. So you can wee out encrypted networks, and select one which is open, maybe with best signal strength "signal: -45.00 dBm".

Since its openwrt you can do it in a Lua script maybe.

buf = output from iw scan
buf = '\n'..buf..'\nBSS'     -- .. is concatenate in lua

Use this regex to match a single block (in Lua or anything else):

"[^A-Za-z%d]BSS"  -- %d is all digits in lua, maybe 0-9 otherwise

Within each block grep SSID, signal, and check if "[^A-Za-z%d]+RSN:", "[^A-Za-z%d]+WPA:", "[^A-Za-z%d]+WEP:" have any match, ignore the blocks which do, and ignore the ones with the SSID in your blacklist.

tavish

Posted 2014-05-22T01:21:18.210

Reputation: 1