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

[Feature] Add support for parsing WiFi from NetworkManager #428

Open
Stetsed opened this issue Jun 22, 2023 · 9 comments
Open

[Feature] Add support for parsing WiFi from NetworkManager #428

Stetsed opened this issue Jun 22, 2023 · 9 comments
Labels

Comments

@Stetsed
Copy link

Stetsed commented Jun 22, 2023

So, currently if you want to use jc to get your connections you can only do it with connections that have already been made. I want to be able to implement it so I can get a list of all WiFi networks and then select from that list.You can get the data for all available networks with the "nmcli -t device wifi list" command which will output it in lines like the one below with the * meaning it's in use, next being the MAC, after that being Network Name, Mode, Channel, Rate, Signal, Bars, and security. And it's split by the : charachters where \ is used to escape for the MAC adress I hope this can be implemented as it would be useful.

* :AA\:AA\:AA\:AA\:AA\:AA:go_away:Infra:40:270 Mbit/s:25:▂___:WPA2
@Stetsed
Copy link
Author

Stetsed commented Jun 22, 2023

(I will also look into submitting a pull request if I can get a good enough understanding of the code)

@kellyjonbrazil
Copy link
Owner

Right on - this sounds like a good addition! Let me know if you need any help.

@Stetsed
Copy link
Author

Stetsed commented Jun 22, 2023

@kellyjonbrazil thanks for the belief but honestly this code is going straight over my head so I don’t think I will be able to do it I do apologize. I will just wait until hopefully it’s implemented.(I might try another day again but I just spent 30 min on it and I have deleted my stuff 5 times now)

@kellyjonbrazil kellyjonbrazil added the good first issue Good for newcomers label Jun 22, 2023
@kellyjonbrazil
Copy link
Owner

kellyjonbrazil commented Jun 22, 2023

I don't mind helping out on this - I think this could be a really good starter project for you.

  1. Create a fork of the dev branch.
  2. Add the parser name to the jc/lib.py file
  3. Next, copy and rename this template file to the jc/parsers folder: https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/foo.py
  4. Use that template file as a guide and give it your best shot. Maybe try using split() on colons.
  5. Create a Pull Request and I'll check out the code and help you out even if your code is not working.

Since this is a fairly easy parser it could be a fun project and I'll make sure you get it working.

@Stetsed
Copy link
Author

Stetsed commented Jun 22, 2023

Thanks, I’ll try it within the next few days. I’m not really used to Python so that’s why I’m stumbling but I’ll definetley try :D

@Stetsed
Copy link
Author

Stetsed commented Jun 23, 2023

@kellyjonbrazil Your saying make a new parser but I see there is already a parser for nmcli, shouldn't I add it to that instead of starting from scratch? Or should I make one like nmcli-wifi or something similar

@kellyjonbrazil
Copy link
Owner

Ah yes, you are right. Basically we would create a new function to parse this output within the existing parser. Then in the parse() function create a way to detect the output and call the new function.

@Stetsed
Copy link
Author

Stetsed commented Jul 2, 2023

@kellyjonbrazil I do apologize that I haven't updated this in a while I have had some stuff due to studying and now graduation. I hope to be able to atleast create a draft this week for you to look at. Apologies for taking so long.

@r-darwish
Copy link
Contributor

I might be able to help but I don't have any Linux installation that uses network manager, so I'll need some examples for output

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants