You are not logged in.
Pages: 1
My wifi script is now a C program. It was a way to practice C for a course.
The biggest caveat is there's no config right now. That means, you'll have to rebuild it if your wireless card identifies as anything other than wlan0. Not sure if it would be better to rebuild for a different wireless interface, pass it as an argument, what the standard is for C config files, etc.
Anyways.
Love it. Hate it. Give valuable critique about it.
Offline
Love it
^ This. Thanks for sharing
I can't get it to work in my Debian buster box though.
I edited config.h and substituted wlp4s0 in place of wlan0 then ran
make clean
make
# make install
And tried to run it as root with
E485:~# wefe scan
Incorrect network interface: No such device
E485:~1#
What am I missing here? Does it matter that I'm using systemd?
critique
It is considered bad practice to run the make command as root, I would prefer to build the package under my normal user and only invoke root privileges to actually install the package (as demonstrated above).
The wpa_supplicant(8) command can be passed a list of potential drivers so your utility can be made to support older devices OOTB by changing the relevant line in config.h to
"-B -Dnl80211,wext", // wpasupplicant options
The iwconfig(8) command is now considered obsolete so you could replace that with iw(8) instead: https://wireless.wiki.kernel.org/en/use … e-iwconfig
"/sbin/iw %s connect %s",
And finally the wpa_passphrase(8) command generates a configuration file that contains a (commented-out) line with the password in plain text so perhaps it would be best to delete that line. Not sure if your utility already does this though, my C skills are nearly non-existent and I can't try it out for myself at the moment.
HTH
Brianna Ghey — Rest In Power
Offline
Thanks, I'm glad you like it And thanks for the feedback. Here's some followup:
I edited config.h and substituted wlp4s0 in place of wlan0 then ran...
That one's on me. The scanner library wasn't accepting the data type for the def.iface. To test, I just dropped "wlan0" directly in that function. Then I forgot to remove it. That should be fixed now.
I also modified the wpasupplicant driver list (idk what others are popular and might be in there as well), and changed iwconfig -> iw ^_^
It is considered bad practice to run the make command as root, I would prefer to build the package under my normal user and only invoke root privileges to actually install the package (as demonstrated above).
Is the suggestion to prevent root from running anything other than make install? I'm confused.
Finally, the removal-of-plaintext-password idea is legit. Not sure how this will look in C, but I went ahead and added a config option in the meantime, just as a reminder.
Last edited by siva (2020-05-24 22:36:54)
Offline
Is the suggestion to prevent root from running anything other than make install? I'm confused.
Sorry, no, I was just commenting on the README.md which says to run all three steps as root.
Btw you seem to have broken your Makefile the last commit by adding spaces around the = in the PREFIX, FOLDER & CONFIG lines.
An uninstall target in the Makefile would also be nice even though it's only a folder and a single binary.
Another error with the new version:
E485:~# wefe add '1337 h4x0r'
sh: 1: cannot create /etc/wefe/wefe-sup/1337: Directory nonexistent
Errors occurred while adding 1337 h4x0r.Done.
E485:~#
And yes, I do have a space in my SSID
I created /etc/wefe/wefe-sup manually and tried again:
E485:~# wefe add '1337 h4x0r'
Errors occurred while adding 1337 h4x0r.Done.
E485:~#
A file was created at /etc/wefe/wefe-sup/1337 (so perhaps the space was the issue), the content was:
Passphrase must be 8..63 characters
I didn't see my passphrase as I typed it in, not sure if that is intended (I can see it when I use wpa_passphrase(8) manually).
Sorry to be a pain here, I'm sure I'm doing something wrong.
Brianna Ghey — Rest In Power
Offline
...the README.md which says to run all three steps as root.
Fixed.
Btw you seem to have broken your Makefile the last commit by adding spaces around the = in the PREFIX, FOLDER & CONFIG lines.
An uninstall target in the Makefile would also be nice even though it's only a folder and a single binary.
Fixed.
Another error with the new version...space in my SSID
Definitely fixed. (It wasn't pointing to the def.config_file path.)
Sorry to be a pain here, I'm sure I'm doing something wrong.
You're not --- the code was the pain ^_^
Offline
It all works now, posting this connected via wefe
If deleting the plain-text password line in /etc/wefe/saved/* is too much trouble then perhaps consider using chmod 600 to prevent non-root users from reading the file.
I also modified the wpasupplicant driver list (idk what others are popular and might be in there as well)
There are only two drivers for wpa_supplicant(8).
Brianna Ghey — Rest In Power
Offline
Pages: 1