Skip to content

Commit

Permalink
v0.1.4 see CHANGES
Browse files Browse the repository at this point in the history
  • Loading branch information
WraithWireless authored and WraithWireless committed Jun 25, 2016
1 parent c5323ea commit ce18633
Show file tree
Hide file tree
Showing 22 changed files with 627 additions and 306 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,4 @@ ENV/
.spyderproject

# Rope project settings
.ropeproject
.ropeproject
21 changes: 20 additions & 1 deletion CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,23 @@ v 0.1.3
- retryshortset
- retrylongset
- rtsthreshset
- fragthreshset
- fragthreshset

v 0.1.4
o added functions:
- isup
- covclassget
- retryshortget
- retrylongget
o modified devadd. User is allowed to submit a Card object or a physical index
o removed hardcoded values for covclassset, retry(short|long)set, retsthreshet and
fragrthreshset
- constants defined in 80211.h
o removed return True where redundant i.e. when setting mac address we can assume
it worked if no error was thrown
o renamed ieee80211_h to wlan
o didn't like the incestual circular pyric error (libnl shouldn't know about pyric)
- replaced pyric.error with defined error in libnl and libio
- pyw has to catch libnl and libio errors and reraise as pyric errors
o retooled exception messages
o added new functions from 0.1.3 and 0.1.4 to unittests
1 change: 1 addition & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
PyRIC: Python Radio Interface Controller

Python wireless library
Copyright (C) 2016 Dale V. Patterson ([email protected])

Expand Down
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# setup paramaters
# setup paramaters for PyRIC via PyPi
include LICENSE CHANGES README.md TODO

# Include subdirectories
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# PyRIC 0.1.2: Python Radio Interface Controller
# PyRIC 0.1.4: Python Radio Interface Controller
## Linux wireless library for the Python Wireless Developer and Pentester
![](docs/logo.png?raw=true)

Expand Down Expand Up @@ -77,6 +77,7 @@ currently pyw provides the following:
* get phy info
* get/set regulatory domain
* get/set mode
* get/set coverage class, RTS threshold, Fragmentation threshold & retry limits
* add/delete interfaces
* enumerate ISM and UNII channels
* block/unblock rfkill devices
Expand Down
9 changes: 7 additions & 2 deletions TODO
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@
11) tried NL80211_CMD_GET_WIPHY, setting _WIPHY_TX_POWER_LEVEL but did
not return the current power level - currently cannot find anything in nl80211.h
that could be used to get tx power
12) add set retry short and long, set rts and set frag
13) replace hardcoded values like cc limits in setcovclass to constants
14) look at udevadm info --query=all --path /sys/class/net/<dev>
o has devie driver, name and some other details
15) fix unittest
16) look into readthedocs.

------- Request For Information RFI ----------

Expand Down Expand Up @@ -147,3 +149,6 @@ dev <devname> set txpower <auto|fixed|limit> [<tx power in mBm>]
phy <phyname> set txpower <auto|fixed|limit> [<tx power in mBm>]
Specify transmit power level and setting type.

6) Passwords
On ubuntu at least passwords for APs are stored in /etc/NetworkManager/system-connections
under directory for ssid
3 changes: 2 additions & 1 deletion __init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# PyRIC root Distribution directory
# Do not import from this directory i.e from PyRIC import foobar
# use pip ('sudo pip install PyRIC') to install or import from pyric
# use pip ('sudo pip install PyRIC') or download latest tarbal to
# install. Then execute from pyric import ffobar
2 changes: 1 addition & 1 deletion docs/PyRIC.bib
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

# PyRIC.bib for v 1.4
@Misc{libnl,
Title = {Netlink Library (libnl)},
Author = {Thomas Graf},
Expand Down
Binary file modified docs/PyRIC.pdf
Binary file not shown.
34 changes: 23 additions & 11 deletions docs/PyRIC.tex
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
basicstyle=\footnotesize
}

\title{\includegraphics[scale=1]{logo}\\ PyRIC v0.1.3: User Manual}
\title{\includegraphics[scale=1]{logo}\\ PyRIC v0.1.4: User Manual}
\author{Dale V. Patterson\\ [email protected]}

\begin{document}
Expand Down Expand Up @@ -185,9 +185,10 @@ \subsection{Cards}
A Card is merely a wrapper around a tuple t = (phy index,device name,ifindex).
Since the underlying Netlink calls sometimes require the physical index, sometimes
the device name, and sometimes the ifindex, pyw functions\footnote{Not all functions
accept a Card, the function pyw.devinfo() will accept either a Card or a dev and
pyw.isinterface() only accepts a dev} take a Card object which doesn't require
callers to know which identifier to use for each function. There are four primary methods to creating a Card:
accept a Card, devinfo() will accept either a Card or a dev and devadd will accept
either a Card or a physical index} take a Card object which doesn't require callers
to know which identifier to use for each function. There are four primary methods
to creating a Card:
\begin{enumerate}
\item \textbf{pyw.getcard} returns a Card object from a given dev,
\item \textbf{pyw.devinfo} returns the dict info where info['card'] is the Card
Expand All @@ -205,9 +206,9 @@ \subsection{Cards}
Keep in mind that any identifier (phy, dev, ifindex) can be invalidated outside
of your control. Another program can rename your interface, that is change the
dev without your knowledge. Depending on what functions are being used this may
not be noticed right away as the phy will remain the same. Also, usb devices (if
the usb is disconnected and reconnected) will have the same dev but the phy and
ifindex will be different.
not be noticed right away as the phy will remain the same. Also for usb devices,
(if the usb is disconnected and reconnected) will have the same dev but the phy
and ifindex will be different.

\subsection{Benchmarks}
PyRIC makes use of several "extensions" to speed up pyw functions:
Expand Down Expand Up @@ -687,7 +688,6 @@ \section{API: pyw.py}\label{sec:pywapi}
\subsection{Constants}
\begin{itemize}
\item \textbf{\_FAM80211ID\_}: Global netlink family id of nl80211. Do not touch
\item \textbf{\_MAXTHRESH\_}: defines limit for thresholds or 'off'. 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
Expand Down Expand Up @@ -753,14 +753,24 @@ \subsection{Functions}
get card's power save state True = on, False = off
\item pwrsaveset(card,on,[nlsock]) (iw dev card.<dev> set power\_save <on>) type:
netlink set card's power save state True = on, False = off
\item covclassget(card,[nlsock]) (iw phy card.<phy> get coverage <cc>) type:
netlink get card's coverage class
\item covclassset(card,cc,[nlsock]) (iw phy card.<phy> set coverage <cc>) type:
netlink set card's coverage class
\item retryshortget(card,[nlsock]) (iw phy card.<phy> info | grep 'retry short')
type:netlink get card's retry short limit
\item retryshortset(card,lim,[nlsock]) (iw phy card.<phy> set retry short <lim>)
type:netlink set card's retry short limit
\item retrylongget(card,[nlsock]) (iw phy card.<phy> info | grep 'retry long')
type:netlink get card's retry long limit
\item retrylongset(card,lim,[nlsock]) (iw phy card.<phy> set retry long <lim>)
type:netlink set card's retry long limit
\item rtsthreshget(card,[nlsock]) (iw phy card.<phy> info | grep rts) type:
netlink set card's RTS threshold
\item rtsthreshset(card,thresh,[nlsock]) (iw phy card.<phy> set rts <thresh>) type:
netlink set card's RTS threshold
\item fragthreshget(card,[nlsock]) (iw phy card.<phy> info | grep frag) type:
netlink get card's fragmentation threshold
\item fragthreshset(card,thresh,[nlsock]) (iw phy card.<phy> set frag <thresh>) type:
netlink set card's fragmentation threshold
\item inetget(card,[iosock]): (ifconfig card.<dev>), type: ioctl, get ip4 address,
Expand Down Expand Up @@ -824,9 +834,11 @@ \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 \_iftypes\_(i): returns the mode corresponding to i
\item \_frequencies\_(band): returns a list of frequencies from the packed byte
string band
\item \_commands\_(command): converts the list of numeric commands to a list of
commands as strings
\item \_ciphers\_(cipher): returns a list of ciphers from the packed byte string
cipher
\item \_iostub\_(fct,*argv): ioctl stub function, calls fct with parameter list argv
Expand Down Expand Up @@ -1085,7 +1097,7 @@ \subsection{Functions}
\end{enumerate}

\section{Copyright and License}\label{sec:copy}
PYRIC: Python Radio Interface Controller v0.1.3\\
PYRIC: Python Radio Interface Controller v0.1.4\\

Copyright (C) 2016 Dale V. Patterson ([email protected])\\

Expand Down
2 changes: 0 additions & 2 deletions pyric/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@
includes: /nlhelp /lib /net /utils pyw 0.1.4
changes:
See CHANGES in top-level directory
Changes since 1.3:
o added isup
"""

Expand Down
1 change: 1 addition & 0 deletions pyric/lib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
- added some error checking to nla_parse_nested, raising and handling error
in situations where attribute len is 0
- fixed nlmsg_fromstream to handle non-ack message parsing with a length of 36
o libnl and libnl now report their own errors rather than use pyric.error
"""

__name__ = 'lib'
Expand Down
13 changes: 7 additions & 6 deletions pyric/lib/libio.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@
import struct
import errno
from fcntl import ioctl
import pyric

class error(EnvironmentError): pass

def io_socket_alloc():
"""
Expand All @@ -64,14 +65,14 @@ def io_transfer(iosock,flag,ifreq):
except (AttributeError,struct.error) as e:
# either sock is not valid or a bad value passed to ifreq
# note: should not get these but just in case
if e.message.find('fileno'): raise pyric.error(errno.ENOTSOCK,"bad socket")
else: raise pyric.error(errno.EINVAL,e)
if e.message.find('fileno'): raise error(errno.ENOTSOCK,"bad socket")
else: raise error(errno.EINVAL,e)
except IOError as e:
# generally device cannot be found sort but can also be
# permissions etc, catch and reraise as our own
if e.errno is not None: # just in case we have a none 2-tuple error
raise pyric.error(e.errno,e.strerror)
raise error(e.errno,e.strerror)
else:
raise pyric.error(pyric.EUNDEF,e)
raise error(-1,e)
except Exception as e:
raise pyric.error(pyric.EUNDEF,e.args[0])
raise error(-1,e.args[0])
Loading

0 comments on commit ce18633

Please sign in to comment.