Multi-Wifi-Interface scan and connect "Wifi-Scanner-2"

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Message
Author
stemsee

#21 Post by stemsee »

This is my main wifi ap connection tool. It is now faster than previously. There are also un-stated options; for example closing the gui using the 'x' in the top right corner causes immediate rescan and gui display reopen. Using 'close' ends all scanning. Using 'ok' with a selected ap causes connection, without selected ap causes immediate rescan. Leaving alone cause timed close and rescan.

stemsee

#22 Post by stemsee »

I had not been able to connect to an android wpa-psk secure hotspot until today!

I spent hours searching for the reason. Finally using wpa_supplicant without the -B but option revealed a list of errors which I researched online. Finally I found that the command without the -D driver specification is the only one that works... eureka!

Code: Select all

wpa_supplicant -B -i $int -c /tmp/netsel.conf

is all that is required having first generated the .conf using

Code: Select all

wpa_passphrase "$ssid" "$password" > /tmp/netsel.conf
So I see just how frustrating using my Wifi-Scanner-2 must have been for anything other than open networks and those with 2nd stage security protocols such as eduroam.

one problem solved!

EDIT: Actually the reason seems more to do with the broadcom chipset or driver! As using all plugin cards work fine with wext.
Last edited by stemsee on Tue 14 Nov 2017, 20:14, edited 1 time in total.

stemsee

#23 Post by stemsee »

see update

stemsee

#24 Post by stemsee »

Update provides: psk correctly implemented.
used interface eliminated from continued scan option.
while loops have sleep to stop uncontrolled cpu use.
a pop-up gui input box which lets the user specify driver + options for wpa_supplicant connection.
It is an extended password and id box which greys out unused selections.

It is much faster now too. The fastest wifi and wired connection utility on the planet!!!

Still to do: remove sed commands. add wps. add auto connect. add use saved profiles.
Attachments
Wifi-Scanner-2.fake.gz
(24.73 KiB) Downloaded 127 times
xscreenshot-20171114T193453.png
(26.08 KiB) Downloaded 336 times
xscreenshot-20171114T193733.png
(24.85 KiB) Downloaded 338 times
Last edited by stemsee on Mon 20 Nov 2017, 22:20, edited 1 time in total.

stemsee

#25 Post by stemsee »

Added autoconnect/no-auto feature which starts wifi connection with a default profile. The script is /etc/xdg/Startup/autocon.

Also corrected udhcpc hook default.script location to /usr/share/udhcpc/default.script in fatdog anyhow. Dhcpcd is still available if 'busybox which udhcpc' returns empty.

stemsee

#26 Post by stemsee »

I have tidied up the formatting within the script - no more long lines!

wpa_cli option in menu with interface selection available. So wps is available for those who know how to

Code: Select all

wpa_pin/wpa_pbs
see further on for script
Last edited by stemsee on Mon 20 Nov 2017, 21:43, edited 1 time in total.

User avatar
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

#27 Post by MochiMoppel »

Code: Select all

	#make sure associate interface variables
	int1=${int1}
	int2=${int2} 
	int3=${int3} 
	int4=${int4} 
	int5=${int5} 
	int6=${int6} 
	int7=${int7}
	int8=${int8}
What is the purpose of this exercise?

stemsee

#28 Post by stemsee »

@MochiMoppel

The purpose was at one point to make sure that after $int was used in a connection the other wireless interfaces '$inters' selected for scanning would fully occupy the variables with '$int' removed from scanning interfaces, as it should be connected. For me it was a temporary measure that I forgot about even though it no longer made any difference. Now removed.

Sed statements have also been reduced.

now I cannot yet get the saved profilesfn selected profile to connect.
Last edited by stemsee on Wed 22 Nov 2017, 14:42, edited 1 time in total.

User avatar
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

#29 Post by MochiMoppel »

stemsee wrote:Sed statements have also been reduced.
Not much. All these piped seds cost you performance.

Instead of 12 seds per scan ...

Code: Select all

[[ ! -z "${int1}" ]] && ecann1=`iwlist ${int1} scan | grep -e 'ESSID' \ 
-e 'Quality' -e 'Address' -e 'key' | sed -e 's/  \+/ /g' | sed 's/Quality=/  /g' | sed 's/level=/    /g' | sed 's/ESSID://g' | \ 
sed 's/key:on/~on~/g' | sed 's/key:off/~off~/g' | sed 's/Encryption//g' | sed 's/ Signal//g' | \ 
sed 's/- Address: / /g' | sed 's|Cell ...|\n|g' | sed 's/ - //g' | sed "s/^[ \t]*//" | tac 
.
.
.
[[ ! -z "${int2}" ]] && ecann2=`iwlist ${int2} scan | grep -e 'ESSID' \ 
-e 'Quality' -e 'Address' -e 'key' | sed -e's/  */ /g' | sed 's/Quality=/  /g' | sed 's/level=/    /g' | sed 's/ESSID://g' | \ 
sed 's/key:on/~on~/g' | sed 's/key:off/~off~/g' | sed 's/Encryption//g' | sed 's/ Signal//g' | \ 
sed 's/- Address: / /g' | sed 's|Cell ...|\n|g' | sed 's/ - //g' | sed "s/^[ \t]*//" | tac
you need only 1 sed statement. If you put the pattern into a variable you also don't need to repeat the pattern for each scan:

Code: Select all

PATTERN='
s/^.*Address: ([0-9A-Z:]*)/\n\1/p
s/^.*Quality=([^ ]*).*Signal level=(.*)/\1 \2/p
s/^.*key:([onf]*)/~\1~/p
s/^.*ESSID://p'

[[ $int1 ]] && ecann1=`iwlist ${int1} scan | sed -rn "$PATTERN" | tac 
.
.
.
[[ $int2 ]] && ecann2=`iwlist ${int2} scan | sed -rn "$PATTERN" | tac 
Also note that [[ ! -z "${int1}" ]] is the same as [[ -n "${int1}" ]] and [[ "${int1}" ]] and [[ "$int1" ]] and [[ $int1 ]] ..take your pick.


With your previous sample data the result looks like this:

Code: Select all

"BTWifi-X" 
~on~ 
35/70 -75 dBm  
52:8A:AE:8C:5E:7E 

"BTWifi-with-FON" 
~off~ 
31/70 -79 dBm  
32:8A:AE:8C:5E:7E 

stemsee

#30 Post by stemsee »

Thank you! :D

stemsee

#31 Post by stemsee »

Added gpl 3.0 license notice and an about option in menu.
Disconnect interface function added to the menu.
Saved Profiles now connect.
Attachments
Wifi-Scanner-2.fake.gz
(20.74 KiB) Downloaded 152 times

stemsee

#32 Post by stemsee »

Added basic HotSpot to menu. Depends on Create_ap-master, dnsmasq, masquerade, nat, hostapd.

Added ssid editor section in password dialogue in case of hidden ssid.
Attachments
Wifi-Scanner-2.fake.gz
(25.37 KiB) Downloaded 154 times

stemsee

#33 Post by stemsee »

HA! I realised that --config /etc/create_ap.conf is the only option needed.

So HotSpot has more options.

Main gui and yad notifications, now have --no-focus set.
Attachments
xscreenshot-20171206T122853.png
(50.97 KiB) Downloaded 218 times
Wifi-Scanner-2.fake.gz
(28.97 KiB) Downloaded 153 times

stemsee

#34 Post by stemsee »

Added check box for saving AP.
Added option to connect with saved profile if available at entering password gui.
Attachments
xscreenshot-20180108T224236.png
(23.42 KiB) Downloaded 171 times
xscreenshot-20180108T224304.png
(23.77 KiB) Downloaded 163 times
xscreenshot-20180108T224442.png
(23.76 KiB) Downloaded 162 times

step
Posts: 1349
Joined: Fri 04 May 2012, 11:20

#35 Post by step »

Where's the updated script?
[url=http://murga-linux.com/puppy/viewtopic.php?t=117546]Fatdog64-810[/url]|[url=http://goo.gl/hqZtiB]+Packages[/url]|[url=http://goo.gl/6dbEzT]Kodi[/url]|[url=http://goo.gl/JQC4Vz]gtkmenuplus[/url]

stemsee

#36 Post by stemsee »

Ok here is the latest iteration. The hotspot function is not the full featured one, just the simpler one.

Work in progress.
Attachments
Wifi-Scanner-2.fake.gz
(27.21 KiB) Downloaded 151 times

Post Reply