Tiny Core Linux
Tiny Core Extensions => TCE Talk => Topic started by: ovacikar on October 03, 2024, 06:00:05 PM
-
Hello,
I need to connect to a specific WIFI AP where all nearby APs have the same name, but many of them have poor quality, depending of the floor I am on, it may change.
I see wifi.sh scans the AP and creates a database file , how can I modify it to store Mac address and display it as well when using -p option?
It is also confusing that iwlist displays Cell number and MAC address on the same line
Cell 27 - Address: XX:XX:XX:XX:XX:XX
Channel:YY
rsort(qual,sid,enc,chan,type, NR)
system ("busybox clear")
printf "\n%s\n\n", title
printf " %-20s\t%5s\t%s\t%s\t%s\t%s\n", "ESSID", "Enc", "Qual", "Channel Type"
for (l=1; l<15; l++) {
++j
if ( j <= i ) printf "%2d. %-20s\t %4s\t %2d\t %2d\t%s\n", j, sid[j], enc[j], qual[j], chan[j], type[j]
}
printf "\nEnter selection ( 1 - %s ) or (q)uit", i
-
Well just added some code without giving too much thought and it worked great:
tc@box:~$ diff /usr/local/bin/wifi.sh wifi.sh
--- /usr/local/bin/wifi.sh
+++ wifi.sh
@@ -173,6 +173,9 @@
{
if ($1 ~ /Cell/)
if ( i == 0 || sid[i] != "" ) i++
+ if ($1 ~ /Address/) {
+ macap[i] = $2$3$4$5$6$7
+ }
if ($1 ~ /Frequency/) {
split($2,c," ")
chan[i] = c[4]
@@ -223,10 +226,10 @@
rsort(qual,sid,enc,chan,type, NR)
system ("busybox clear")
printf "\n%s\n\n", title
- printf " %-20s\t%5s\t%s\t%s\t%s\t%s\n", "ESSID", "Enc", "Qual", "Channel Type"
+ printf " %-20s\t%5s\t%s\t%s\t%s\t%s\t%20s\n", "ESSID", "Enc", "Qual", "Channel Type", "MAC Address"
for (l=1; l<15; l++) {
++j
- if ( j <= i ) printf "%2d. %-20s\t %4s\t %2d\t %2d\t%s\n", j, sid[j], enc[j], qual[j], chan[j], type[j]
+ if ( j <= i ) printf "%2d. %-20s\t %4s\t %2d\t %2d\t%s\t%-20s\n", j, sid[j], enc[j], qual[j], chan[j], type[j], macap[j]
}
printf "\nEnter selection ( 1 - %s ) or (q)uit", i
if ( i > 15 ) printf ", (n)ext, (p)revious: "