Python Module Networking | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Python Module Networking

Hello and Happy New Year to everyone!!! I would like to ask, if there is a python module that finds the name of wireless (and wired if possible) interfaces in a Linux distro, and if possible to add to a string

1st Jan 2019, 4:27 PM
Dimitris K
Dimitris K - avatar
12 Answers
+ 3
Avoiding using subprocess if possible is always wise. At the very least it will mean the code is more likely to be platform independent, but it's also easy to inadvertently create security problems that way (if the program is accessible by other users and if they can send arbitrary data to that program). Oh, there is another option, but it's massively overkill and should not be needed. Still, in the interests of complete answers, it's always possible to create bindings to any C or C++ code in CPython with either ctypes, CFFI, SWIG or other similar tools.
2nd Jan 2019, 2:07 PM
Ben McGinnes
Ben McGinnes - avatar
+ 5
And? Did the subprocess work out?
1st Jan 2019, 10:53 PM
Stefaan Lampaert
Stefaan Lampaert - avatar
+ 3
Thank you bery much!!! I may have found a way, using subprocess and executing bash commands through it
1st Jan 2019, 5:41 PM
Dimitris K
Dimitris K - avatar
+ 2
It is difficult to answer to your question without experience, but I think these 2 frameworks may have something for you: kivy: network PyQt5: QtBluetooth, QtNetwork
1st Jan 2019, 5:12 PM
Seb TheS
Seb TheS - avatar
+ 2
Yep worked like a charm. Check my profile for the code if you want too
1st Jan 2019, 11:03 PM
Dimitris K
Dimitris K - avatar
+ 2
I ll post a code for obtaining a way to find fhe network you are conmected to using ifconfig and passing through grep the result, but imo it is not a very reliable way to find the network you are connected (via ifconfig)
1st Jan 2019, 11:18 PM
Dimitris K
Dimitris K - avatar
+ 2
I use Windows and for see the other ip and mac in the network i use The command prompt with The command "arp -a". I think that this command work on bash
2nd Jan 2019, 12:30 PM
Giacomino Panevino
Giacomino Panevino - avatar
+ 1
Thank you very much!!! This period, im experimenting with python and bash, so im totally new to this, and i havent still learned c. when im more experienced i will try to find multiple ways for these kind of problems, learning how the computer works in general
2nd Jan 2019, 2:23 PM
Dimitris K
Dimitris K - avatar
0
From the standard library, look at the asyncio, socket and ipaddress modules. In addition to that, also look at Twisted and the aio-libs.
2nd Jan 2019, 1:35 PM
Ben McGinnes
Ben McGinnes - avatar
0
thanks!!! If there is a way without subporcess that might be better
2nd Jan 2019, 1:40 PM
Dimitris K
Dimitris K - avatar
0
I have uploaded a script that finds out the wireless interfaces that are connected to the internet(if there are multiple) with their names added to a list, so they can be used to other scripts.
4th Jan 2019, 11:02 AM
Dimitris K
Dimitris K - avatar
0
covers all the possible outcomes, 0 or more interfaces. regex is sooo good!!!
4th Jan 2019, 11:03 AM
Dimitris K
Dimitris K - avatar