Skip to content

Commit

Permalink
v0.1.5 phylist w.r.t Issue #17
Browse files Browse the repository at this point in the history
  • Loading branch information
WraithWireless authored and WraithWireless committed Jul 14, 2016
1 parent e3d93ca commit 569a9f7
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 2 deletions.
4 changes: 3 additions & 1 deletion CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ v 0.1.5 Begin STA associated functionality
- link
- stainfo
- devset
- phylist
o updated nested netlink attribute handling - my understanding of it was incomplete
- There are still occasional errors
- nested attributes are parsed as 'far' as possible
Expand All @@ -142,4 +143,5 @@ v 0.1.5 Begin STA associated functionality
testing confirms that the new nla_parse_nested is bug-free)
o fixed error on devadd during restoration in examples/pentest.py
o fixed output error, incorrect labeling
o fixed output error ASW max tx power
o fixed output error ASW max tx power
o added phylist w.r.t issue #17
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,8 @@ False
False
>>> pyw.iswinterface('wlan0')
True
>>> pyw.phylist() # list all current phys (Note device ASW phy1)
[(1,'phy1), (0, 'phy0')]
>>> pyw.regget() # get the regulatory domain
'US'
>>> pyw.regset('BO') # set the regulatory domain
Expand Down
Binary file modified docs/PyRIC.pdf
Binary file not shown.
2 changes: 2 additions & 0 deletions docs/PyRIC.tex
Original file line number Diff line number Diff line change
Expand Up @@ -728,6 +728,8 @@ \subsection{Functions}
\item winterfaces([iosock]): (iwconfig), type: ioctl, list wireless interfaces
\item iswireless(dev,[iosock]): (iwconfig <dev>), type: ioctl, check dev is a
wireless interface
\item phylist(): (iw phy | grep wiphy) type: N/A, list phy indexes and phy names
present on system
\item regget([nlsock]: (iw reg get), type: netlink, get regulatory domain
\item regset(rd,[nlsock]): (iw reg set <rd>), type: netlink, set regulatory domain
to rd
Expand Down
12 changes: 12 additions & 0 deletions pyric/pyw.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,18 @@ def iswireless(dev, *argv):
if e.errno == pyric.ENODEV or e.errno == pyric.EOPNOTSUPP: return False
else: raise pyric.error(e.errno, e.strerror)

def phylist():
""" :returns: a list of tuples t = (physical indexe, physical name) """
# we could walk the directory /sys/class/ieee80211 as well but we'll
# let rfkill do it (just in case the above path differs across distros or
# in future upgrades
phys = []
rfdevs = rfkill.rfkill_list()
for rfk in rfdevs:
if rfdevs[rfk]['type'] == 'wlan':
phys.append((int(rfk.split('phy')[1]),rfk))
return phys

def regget(*argv):
"""
gets the current regulatory domain (iw reg get)
Expand Down
2 changes: 1 addition & 1 deletion pyric/utils/hardware.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
contributors may be used to endorse or promote products derived from this
software without specific prior written permission.
Defines device hardware related functions: mac address, driver, chipset
Defines device hardware related functions: mac address, driver, chipset etc
"""

Expand Down

0 comments on commit 569a9f7

Please sign in to comment.