-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
wraith-wireless
committed
May 24, 2016
1 parent
f70f9ea
commit 47e5d47
Showing
33 changed files
with
153 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# Include license, README | ||
# Include license, README, channels, device, pyw and user guide | ||
include LICENSE README.md __init__.py channels.py device.py pyw.py PyRIC.pdf | ||
|
||
# Include subdirectories | ||
recursive-include lib net examples docs | ||
recursive-include docs *.help *.pdf | ||
recursive-include docs *.help |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,13 @@ | ||
1) overall | ||
o look at iw dev wlan0 link | ||
o look at iw dev | ||
o make a cli as well | ||
2) libnl.py | ||
o see (1) in RFI | ||
o define attr_ops and attr_mcast_groups in nla_policy_attr | ||
4) pyw | ||
o add txget from iw i.e. netlink perspective | ||
o find a better way to find the supported standards of a card | ||
o for now, using ioctl to set ip addresses | ||
- move everything to netlink | ||
o Can we find the current channel of a radio in monitor mode that is actively | ||
scanning? | ||
o parse NL80211_ATTR_WIPHY_BANDS | ||
o parse NL80211_ATTR_WIPHY_BANDS (have workaround currently in place) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
# root Distribution directory | ||
# root Distribution directory |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
#!/usr/bin/env python | ||
""" device.py | ||
Example for displaying device details | ||
""" | ||
|
||
import argparse as ap | ||
import pyric # pyric error (and ecode EUNDEF) | ||
from pyric import pyw # for iw functionality | ||
from pyric import device # for chipset/driver | ||
from pyric.channels import rf2ch # rf to channel conversion | ||
|
||
def execute(dev): | ||
# ensure dev is a wireless interfaces | ||
wifaces = pyw.winterfaces() | ||
if dev not in wifaces: | ||
print "Device {0} is not wireless, use one of {1}".format(dev,wifaces) | ||
|
||
dinfo = pyw.devinfo(dev) | ||
card = dinfo['card'] | ||
pinfo = pyw.phyinfo(card) | ||
driver = device.ifdriver(card.dev) | ||
chipset = device.ifchipset(driver) | ||
|
||
msg = "Device {0}\n".format(dev) | ||
msg += "\tDriver: {0} Chipset: {1}\n".format(driver,chipset) | ||
msg += "\tifindex: {0}\n".format(card.idx) | ||
msg += "\twdev: {0}\n".format(dinfo['wdev']) | ||
msg += "\taddr: {0}\n".format(dinfo['mac']) | ||
msg += "\tmode: {0}\n".format(dinfo['mode']) | ||
msg += "\twiphy: {0}\n".format(card.phy) | ||
if dinfo['mode'] == 'managed': | ||
msg += "\tchannel: {0} (1 MHz), width: {2}, CF: {3}\n".format(rf2ch(dinfo['RF']), | ||
dinfo['RF'], | ||
dinfo['CHW'], | ||
dinfo['CF']) | ||
else: | ||
msg += "\tDevice not associated\n" | ||
print msg | ||
|
||
msg = "Wiphy phy{0}\n".format(card.phy) | ||
msg += "\tGeneration: {0}m Coverage Class: {1}\n".format(pinfo['generation'], | ||
pinfo['cov_class']) | ||
msg += "\tMax # scan SSIDs: {0}\n".format(pinfo['scan_ssids']) | ||
msg += "\tRetry Short: {0}, Long: {1}\n".format(pinfo['retry_short'], | ||
pinfo['retry_long']) | ||
msg += "\tThreshold Frag: {0}, RTS: {1}\n".format(pinfo['frag_thresh'], | ||
pinfo['rts_thresh']) | ||
msg += "\tSupported Modes:\n" | ||
for mode in pinfo['modes']: | ||
msg += "\t * {0}\n".format(mode) | ||
msg += "\tSupported Commands:\n" | ||
for cmd in pinfo['commands']: | ||
msg += "\t * {0}\n".format(cmd) | ||
msg += "\tSupported Frequencies:\n" | ||
for freq in pinfo['freqs']: | ||
msg += "\t * {0}\n".format(freq) | ||
|
||
print msg | ||
|
||
if __name__ == '__main__': | ||
# create arg parser and parse command line args | ||
print "Wireless Device Info Display using PyRIC v{0}".format(pyric.__version__) | ||
argp = ap.ArgumentParser(description="Wireless Device Data") | ||
argp.add_argument('-d','--dev',help="Wireless Device") | ||
args = argp.parse_args() | ||
try: | ||
dev = args.dev | ||
if dev is None: | ||
print "usage: python device.py -d <dev>" | ||
else: | ||
execute(dev) | ||
except pyric.error as e: | ||
print e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,6 @@ | ||
#!/usr/bin/env python | ||
""" nlhelp.py: nl80211 help functions | ||
A set of functions to assist in finding info on nl80211 commands and attributes. | ||
These are stored in the "data" files commands.help and attributes.help which are | ||
json files. | ||
Copyright (C) 2016 Dale V. Patterson ([email protected]) | ||
This program is free software: you can redistribute it and/or modify it under | ||
|
@@ -23,6 +19,10 @@ | |
contributors may be used to endorse or promote products derived from this | ||
software without specific prior written permission. | ||
A set of functions to assist in finding info on nl80211 commands and attributes. | ||
These are stored in the "data" files commands.help and attributes.help which are | ||
json files. | ||
""" | ||
|
||
__name__ = 'nlhelp' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -72,7 +72,7 @@ | |
basicstyle=\footnotesize | ||
} | ||
|
||
\title{PyRIC v0.0.7: User Manual} | ||
\title{PyRIC v0.0.8: User Manual} | ||
\author{Dale V. Patterson\\ [email protected]} | ||
|
||
\begin{document} | ||
|
@@ -98,6 +98,7 @@ \section{About PyRIC}\label{sec:About} | |
\item enumerate interfaces and wireless interfaces, | ||
\item get/set regulatory domain, | ||
\item get/set hw address, | ||
\item get/set ip4, netmask and broadcast address | ||
\item identify a radio's chipset and driver, | ||
\item turn device on/off, | ||
\item get supported standards, | ||
|
@@ -656,6 +657,8 @@ \subsection{Constants} | |
\item \textbf{\_FAM80211ID\_}: Global netlink family id of nl80211. Do not touch | ||
\item \textbf{IFTYPES}: redefined (from nl80211\_h.py) interface modes | ||
\item \textbf{MNTRFLAGS}: redefined (from nl80211\_h.py) monitor mode flags | ||
\item \textbf{IPADDR}: Regular Expression for ip4 address validation | ||
\item \textbf{MACADDR}: Regular Expression for mac address validation | ||
\end{itemize} | ||
|
||
\subsection{Objects/Classes} | ||
|
@@ -751,6 +754,9 @@ \subsection{Functions} | |
\item devdel(card,[nlsock]): (iw card.<dev> del), type: netlink, deletes dev | ||
\begin{itemize} | ||
\item \_hex2mac\_(v): returns a ':' separated mac address from byte stream v | ||
\item \_hex2ip4\_(v): returns a '.' separated ip4 address from byte stream v | ||
\item \_validip4\_(addr): determines if addr is a valid ip4 address | ||
\item \_validmac\_(addr): determines if addr is a valid mac address | ||
\item \_issetf\_(flags,flag): determines if flag is set in flags | ||
\item \_setf\_(flags,flag): set flag in flags to on | ||
\item \_unsetf\_(flags,flag): set flag in flags to off | ||
|
@@ -759,6 +765,8 @@ \subsection{Functions} | |
\item \_ifindex\_(dev,[iosock]): returns dev's ifindex | ||
\item \_flagsget\_(dev,[iosock]): get's the dev's interface flags | ||
\item \_flagsset\_(dev,flags,[iosock]): set's the dev's interface flags | ||
\item \_getfreqs\_(band): returns a list of frequencies from the packed byte string | ||
band | ||
\item \_iostub\_(fct,*argv): ioctl stub function, calls fct with parameter list argv | ||
and an allocated ioctl socket | ||
\item \_nlstub\_(fct,*argv): netlink stub function, calls fct with parameter list | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -320,20 +320,6 @@ def nlattrhdr(alen,atype): | |
#NLA_HDRLEN = ((int) NLA_ALIGN(sizeof(struct nlattr))) | ||
|
||
# defined error codes | ||
""" | ||
For ease of use, I define netlink errors (netlink/errno.h) here | ||
/* | ||
* netlink/errno.h Error Numbers | ||
* | ||
* This library is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
* License as published by the Free Software Foundation version 2.1 | ||
* of the License. | ||
* | ||
* Copyright (c) 2008 Thomas Graf <[email protected]> | ||
*/ | ||
""" | ||
# only use success and failure -> using errno for other error numbers | ||
NLE = ['Success','Unspecified failure'] | ||
NLE_SUCCESS = 0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,10 +52,6 @@ | |
__email__ = '[email protected]' | ||
__status__ = 'Production' | ||
|
||
# Linux-specific socket ioctls | ||
#SIOCINQ = FIONREAD | ||
#SIOCOUTQ = TIOCOUTQ # output queue size (not sent + not acked) | ||
|
||
# Routing table calls | ||
SIOCADDRT = 0x890B # add routing table entry | ||
SIOCDELRT = 0x890C # delete routing table entry | ||
|
Oops, something went wrong.