├── MANIFEST.in ├── Makefile ├── README ├── api-2011.txt ├── build └── lib │ └── pythonwifi │ ├── __init__.py │ ├── flags.py │ └── iwlibs.py ├── docs ├── AUTHORS ├── BUGS ├── ChangeLog ├── DEVEL.txt ├── LICENSE.GPL ├── LICENSE.LGPL ├── NEWS ├── ROADMAP ├── TODO ├── VERSION ├── europython2005.mgp ├── feature_matrix_iwconfig.py.txt ├── feature_matrix_iwlist.py.txt ├── feature_matrix_wireless_extensions.txt ├── iwconfig.py.8 ├── iwlist.py.8 ├── logos │ ├── pythonwifi-logo-16x16.png │ ├── pythonwifi-logo-64x64.png │ ├── pythonwifi-logo-text.png │ ├── pythonwifi-logo-text.xcf │ ├── pythonwifi-logo.karbon │ └── pythonwifi-logo.svg ├── pywifi.tpp └── pywifi_english.tpp ├── examples ├── iwconfig.py └── iwlist.py ├── pythonwifi ├── __init__.py ├── flags.py └── iwlibs.py ├── setup.py └── tests ├── README ├── output_diff.sh ├── test_wireless.py └── test_wireless_doctest.py /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include README 2 | include Makefile 3 | include MANIFEST* 4 | include api-2011.txt 5 | recursive-include examples *.py 6 | recursive-include pythonwifi *.py 7 | recursive-include docs * 8 | recursive-include tests * 9 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # Makefile for Python WiFi 4 | # 5 | # Copyright 2015 Sean Robinson 6 | # 7 | # This program is free software; you can redistribute it and/or modify 8 | # it under the terms of the GNU General Public License as published by 9 | # the Free Software Foundation; version 2 of the License. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # `GNU General Public License `_ for more details. 15 | # 16 | 17 | # Binaries needed in this file... 18 | PEP8=pep8-py2.7 19 | PYFLAKES=pyflakes-py2.7 20 | PYTHON2=python2 21 | PYTHON3=python3 22 | SHELL=/bin/sh 23 | 24 | package = python-wifi 25 | 26 | TOPDIR := $(CURDIR) 27 | 28 | VERSION = $(shell cat $(TOPDIR)/docs/VERSION) 29 | 30 | TESTCASES = pymnl.tests.nlsocket,pymnl.tests.attributes,pymnl.tests.message,pymnl.tests.genl 31 | 32 | .PHONY: targets clean pep8 pep-verbose pyflakes sdist 33 | 34 | targets: 35 | @echo "Available make targets:" 36 | @echo " clean - remove caches and reports (e.g. coverage)" 37 | @echo " pep8 - check entire project for PEP8 compliance" 38 | @echo " pep8-verbose - include many details about PEP8 check" 39 | @echo " pyflakes - statically analyze entire project for common errors" 40 | @echo " sdist - make a source distribution with checksum and PGP signature" 41 | @echo "" 42 | 43 | clean: 44 | rm -fr tmp/ dist/ build/ MANIFEST 45 | rm -fr `find $(TOPDIR) -type f -a -name "*.pyc"` 46 | rm -fr `find $(TOPDIR) -type d -a -name "__pycache__"` 47 | 48 | pep8: 49 | $(PEP8) --statistics pythonwifi/ examples/ tests/ 50 | 51 | pep8-verbose: 52 | $(PEP8) --show-source --show-pep8 --statistics pythonwifi/ examples/ tests/ 53 | 54 | pyflakes: 55 | $(PYFLAKES) pythonwifi/ examples/ tests/ 56 | 57 | sdist: clean $(TOPDIR)/dist/${package}-$(VERSION).tar.bz2.sha256 $(TOPDIR)/dist/${package}-$(VERSION).tar.bz2.sign 58 | chmod 644 $(TOPDIR)/dist/${package}-$(VERSION).* 59 | 60 | $(TOPDIR)/dist/${package}-$(VERSION).tar.bz2.sha256: $(TOPDIR)/dist/${package}-$(VERSION).tar.bz2 61 | cd $(TOPDIR)/dist && \ 62 | sha256sum ${package}-$(VERSION).tar.bz2 \ 63 | > ${package}-$(VERSION).tar.bz2.sha256 64 | 65 | $(TOPDIR)/dist/${package}-$(VERSION).tar.bz2.sign: $(TOPDIR)/dist/${package}-$(VERSION).tar.bz2 66 | cd $(TOPDIR)/dist && \ 67 | gpg --detach-sign -a --output \ 68 | ${package}-$(VERSION).tar.bz2.asc \ 69 | ${package}-$(VERSION).tar.bz2 70 | cd $(TOPDIR)/dist && \ 71 | gpg --verify $(TOPDIR)/dist/${package}-$(VERSION).tar.bz2.asc 72 | 73 | $(TOPDIR)/dist/${package}-$(VERSION).tar.bz2: 74 | PYTHONPATH=$(TOPDIR) $(PYTHON2) ./setup.py sdist --force-manifest --formats=bztar 75 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | README 2 | ====== 3 | 4 | Python WiFi is a Python module that provides read and write access to a 5 | wireless network card's capabilities using the Linux Wireless Extensions. 6 | It was initially developed by Roman Joost with advice from Guido Goldstein 7 | of Infrae. It is currently maintained by Sean Robinson. 8 | 9 | More information is available at http://pythonwifi.tuxfamily.org. A 10 | mailing list for announcements and developer discussion is available at 11 | pythonwifi@lists.tuxfamily.org. 12 | 13 | Check the ./docs/feature_matrix_*.txt files for a detailed list of what is 14 | implemented. This may not work with 64-bit Linux kernels, I would appreciate 15 | reports of success or failure on such systems. 16 | 17 | 18 | Example Applications 19 | -------------------- 20 | The examples directory contains iwconfig.py and iwlist.py, which are sample 21 | re-implementations of iwconfig and iwlist. These scripts use the pythonwifi 22 | module to duplicate the functionality of those programs as closely as possible. 23 | 24 | 25 | Files and Directories 26 | --------------------- 27 | ./docs/ - supporting documentation 28 | ./docs/api/ - documentation of the pythonwifi API (not yet there) 29 | ./docs/logos/ - the Python WiFi logo in various formats 30 | ./examples/ - sample uses of pythonwifi module 31 | ./pythonwifi/ - the module source code 32 | ./INSTALL - installation instructions 33 | ./Makefile - convenience commands for developers 34 | ./README - this file 35 | ./setup.py - installation script 36 | 37 | 38 | Python WiFi Users 39 | ----------------- 40 | The methods in the Wireless class are the highest level interace. An example 41 | program, which prints the ESSID and the association mode: 42 | 43 | >>> from pythonwifi.iwlibs import Wireless 44 | >>> wifi = Wireless('eth1') 45 | >>> wifi.getEssid() 46 | 'romanofski' 47 | >>> wifi.getMode() 48 | 'Managed' 49 | 50 | 51 | License 52 | ------- 53 | 54 | pythonwifi is licensed under LGPLv2+, however, the examples 55 | (e.g. iwconfig.py and iwlist.py) are licensed under GPLv2+. 56 | 57 | -------------------------------------------------------------------------------- /api-2011.txt: -------------------------------------------------------------------------------- 1 | =RFC: New API to Unify WEXT (iwlibs) and nl80211 Interfaces in pythonwifi= 2 | 3 | Started: 20110317 4 | Rev. 20150317-01 5 | 6 | This document attempts to outline a new API for pythonwifi going forward 7 | from v0.5. Everything in this Request For Comment is open for discussion 8 | and change. The API described here is a starting point for such a discussion. 9 | That argument will take place on pythonwifi@lists.tuxfamily.org. If you would 10 | like to comment on this API, please subscribe and become involved. 11 | 12 | 13 | ==Authors== 14 | 15 | If you contribute to this RFC, by adding, removing, or editing content, 16 | please add your name to the author list below. Email addresses are optional. 17 | 18 | Sean Robinson 19 | 20 | 21 | ==History== 22 | 23 | pythonwifi, in its current state, is a pure Python distribution, developed 24 | under Python 2, for controlling wireless network device configuration in 25 | Linux systems using the WEXT ioctls. The WEXT interface is the long-time 26 | access method for configuration and control of wireless devices in the Linux 27 | kernel (i.e. iwconfig and iwlist). However, WEXT has been deprecated since 28 | at least 2007 and nl80211 is the new interface that Linux kernel developers 29 | are encouraging. 30 | 31 | pymnl is a newly written pure Python distribution to aid communicating with 32 | the Netlink system (which underlies the nl80211 protocol). pymnl does not 33 | know about nl80211, but it can be used as a foundation by pythonwifi to 34 | add nl80211 access, along with the current WEXT access. 35 | 36 | 37 | ==Future== 38 | 39 | I am proposing that pythonwifi add nl80211 and clean up the existing API so 40 | that a unified interface for WEXT and nl80211 will be possible. This means 41 | identifying those functions needed by pythonwifi users and providing those 42 | functions using the same class and method naming for the WEXT and nl80211 43 | modules. One goal of this reorganizaion is that the module used may be 44 | swapped out for the other module without requiring much, if any, other 45 | changes to the user's source code. 46 | 47 | A second goal is to make pythonwifi compatible with Python 2 and Python 3 48 | in the same source. 49 | 50 | 51 | ==Terminology== 52 | 53 | This document tries to follow the Python community conventions, as I 54 | understand them, for terminology relating to software libraries. The overall 55 | group of files is a distribution, the distribution under consideration is 56 | named pythonwifi. A package is a subgroup of files within a distribution. 57 | The root package is the top of the hierarchy and is the base of the 58 | distribution. The pythonwifi distribution will contain two packages 59 | below the root package: nl80211 and wext. 60 | 61 | A module is an individual file in the distribution. This file may be within 62 | the root package or any subpackages in the hierarchy. 63 | 64 | Where pseudo-code is used to illustrate the proposed API, an informal data 65 | type is used to hint at the values to be passed into and returned from the 66 | method. As Python is not a strongly-typed language, these types are only 67 | used to indicate general data types. 68 | 69 | The term "wireless client developers" is used to describe those programmers 70 | controlling the wireless hardware via requests to the driver from userspace. 71 | So the developers in question are requesting service from the wireless 72 | driver. This term is used to more clearly distinguish the pythonwifi target 73 | audience from device/driver developers. 74 | 75 | For the definitions of technical terms as they are used in this document, 76 | see the glossary at the end of this document. 77 | 78 | 79 | ==New API== 80 | 81 | ===Distribution Layout=== 82 | 83 | The new package will be named pythonwifi.nl80211. The existing pythonwifi 84 | package will be moved down to pythonwifi.wext. That is, the current file 85 | hierarchy will be changed from 86 | 87 | pythonwifi/__init__.py 88 | to 89 | pythonwifi/__init__.py 90 | pythonwifi/nl80211/__init__.py 91 | pythonwifi/wext/__init__.py 92 | 93 | This means the package(s) would be imported with: 94 | 95 | import pythonwifi.nl80211 96 | import pythonwifi.wext 97 | 98 | Although, only one package should be required at one time. 99 | 100 | 101 | ===Module Layout=== 102 | 103 | The main module in each package will be __init__.py so that importing the 104 | package will provide access to the primary class(es) to be used by wireless 105 | client developers. The module containing the most common constants used by 106 | each protocol will be named flags.py. The module containing common 107 | utilities required for the protocol, but not necessarily needed by wireless 108 | client developers, will be named base.py. Each package may have additional 109 | modules which provide additional protocol support. 110 | 111 | pythonwifi/(nl80211|wext)/__init__.py 112 | pythonwifi/(nl80211|wext)/flags.py 113 | pythonwifi/(nl80211|wext)/base.py 114 | 115 | 116 | ====Root Package Functions and Classes==== 117 | 118 | pythonwifi/__init__.py will contain utility functions useful to wireless 119 | client developers that are not directly wireless oriented (e.g. retrieve 120 | a list of NICs and wireless NICs or convert an interface name to its index). 121 | These are not required to be in classes, but a group of functions may be 122 | put into a class if it makes sense. 123 | 124 | {{{ 125 | def get_nic_names() 126 | def get_wnic_names() 127 | def get_phy_names() XXX 128 | def get_wiphy_names() XXX 129 | def if_nametoindex(string) 130 | def mw2dbm(mwatt): 131 | """ Convert mW to dBm (float). """ 132 | pass 133 | }}} 134 | 135 | ===Package Classes=== 136 | 137 | The primary classes of interest to pythonwifi users will be named Wireless 138 | and ServiceSet. These class names will be the same in the nl80211 and WEXT 139 | packages. Secondary classes for less common operations (i.e. WirelessConfig) 140 | will be in the same module. 141 | 142 | 143 | ====Wireless Class==== 144 | 145 | Note that the method names used below are a dramatic change from the current 146 | method names used in pythonwifi <= 0.5. One of the goals with this method 147 | renaming is to make pythonwifi more compliant with PEP 8. 148 | 149 | The methods included in the Wireless class should be only those most likely 150 | to be useful for wireless client developers. Therefor, all methods in 151 | Wireless should operate in both the nl80211 and wext packages. See 152 | WirelessConfig for more commands. 153 | 154 | {{{ 155 | class Wireless(object): 156 | """ Model of a wireless device. 157 | 158 | An exception may be raised if any of the following operations are 159 | attempted on a non-existant or unconfigured 160 | (i.e. ifconfig wlan0 down) device. 161 | """ 162 | def __init__(ifname=None, protocol="nl80211"): 163 | """ Create a Wireless object. 164 | 165 | ifname - string - name of wireless interface to use (e.g. wlan0) 166 | 167 | protocol - string - Which backend to use for wireless operations. 168 | Valid values are "nl80211" (default) and "wext", 169 | any other string will raise an exception. 170 | """ 171 | pass 172 | 173 | def scan(trigger=True, ssid=None, frequency=None, channel=None): 174 | """ Return a list of ServiceSet objects. These objects are built 175 | from the SSID information found in the local environment. 176 | 177 | trigger - boolean - True = ask wireless system to perform a new scan; 178 | False = use information from previous scan 179 | 180 | ssid - string - look for this specific SSID 181 | 182 | frequency - integer - scan only on this frequency (freq in MHz) 183 | 184 | channel - integer - scan only on this channel; will look up the 185 | associated frequency and use that for the scan 186 | 187 | If frequency and channel are both given, a warning is given and 188 | channel is ignored. 189 | """ 190 | return ss_list 191 | 192 | def connect(service_set): 193 | """ Connect with the specified service set. 194 | """ 195 | pass 196 | 197 | def disconnect(): 198 | """ Disconnect from currently connected service set. 199 | """ 200 | pass 201 | 202 | def get_connection(): 203 | """ Return the ServiceSet used for the current connection. Return 204 | None if no connection is in place. 205 | """ 206 | return service_set 207 | 208 | def is_connected(): 209 | """ Return state of connection. Return True if a connection is in 210 | place and False if no connection is in place. 211 | """ 212 | return connection_state 213 | }}} 214 | 215 | 216 | ====WirelessConfig Class==== 217 | 218 | The WirelessConfig class is a subclass of Wireless that aims to contain more 219 | of the information and commands available under each protocol. Because each 220 | protocol provides a slightly different set of information and commands, the 221 | methods in WirelessConfig are not guaranteed to be the same in number, 222 | content, or function. 223 | 224 | Many of the methods herein are for reading or assigning various options 225 | on the wireless network device. These methods are not necessary for only 226 | connecting to an access point, but are given for those wireless client 227 | developers that may want to accomplish other tasks with their clients. 228 | 229 | 230 | =====WirelessConfig Common Methods===== 231 | 232 | The methods listed here are those which will be in both packages' 233 | WirelessConfig. Package-specific methods are given after this section and 234 | are in addition to the API detailed here. 235 | 236 | {{{ 237 | class WirelessConfig(Wireless): 238 | def get_ssid(): 239 | """ Return the SSID currently assigned to the device. Returns None 240 | if no SSID has been assigned to the wireless device. 241 | """ 242 | return string 243 | 244 | def set_ssid(ssid): 245 | """ Set the device's SSID to ssid. 246 | 247 | ssid - string - desired SSID or "off" 248 | 249 | Changing the SSID while connected may break the connection. 250 | """ 251 | pass 252 | 253 | def get_bssid(): 254 | """ Return the BSSID currently assigned to the device as a string 255 | of six colon-separated octets (e.g. 00:01:02:AA:BC:EF). Returns 256 | None if no SSID has been assigned to the wireless device. 257 | """ 258 | return string 259 | 260 | def set_bssid(bssid): 261 | """ Set the BSSID to bssid. 262 | 263 | bssid - string - the deisred BSSID 264 | 265 | Changing the BSSID while connected may break the connection. 266 | """ 267 | pass 268 | 269 | def get_frequency(): 270 | """ Return the frequency (in MHz, e.g. 2462) current assigned to the 271 | device. 272 | """ 273 | return frequency 274 | 275 | def set_frequency(frequency): 276 | """ Set the frequency. 277 | 278 | frequency - integer - the wireless device's frequency (in MHz). 279 | 280 | Raises an exception if the frequency is not supported. 281 | """ 282 | pass 283 | 284 | def get_channel_info(): 285 | """ Return a list of tuples with channel number and frequency pairs. 286 | 287 | NOTE: This method returns a different value that the obsolete 288 | Wireless.getChannelInfo(). 289 | """ 290 | return channel_info 291 | 292 | def get_channel(): 293 | """ Return the channel currently assigned to the device. 294 | """ 295 | return channel 296 | 297 | def set_channel(channel): 298 | """ Set the frequency by looking up the given channel. 299 | 300 | channel - integer - the channel number for the frequency desired 301 | 302 | Raises an exception if the channel cannot be found or the matched 303 | frequency is not supported. 304 | """ 305 | pass 306 | 307 | def get_available_modes(): 308 | """ Return a list of the modes available on this device (i.e. IBSS, 309 | managed, monitor, etc.). 310 | """ 311 | return mode_list 312 | 313 | def get_mode(): 314 | """ Return the current mode (i.e. IBSS, managed, monitor, etc.) 315 | in string form. 316 | """ 317 | return mode 318 | 319 | def set_mode(mode): 320 | """ Set the mode. 321 | 322 | mode - string - the card mode 323 | 324 | Raises an exception if the mode is not supported. 325 | """ 326 | pass 327 | 328 | del get_encryption(): 329 | return XXX 330 | def set_encryption(XXX) 331 | pass 332 | 333 | def get_available_keys(): 334 | """ Return a list of the encryption keys in the device. Return 335 | an empty list if no keys are present in the device. 336 | """ 337 | return key_list 338 | 339 | def get_key(index=0): 340 | """ Return an encryption key from the device. Return None if no 341 | key is present in the device. 342 | 343 | index - integer - Up to four keys (0-3) can be stored on the 344 | device. get_key() defaults to returning the first key (at 345 | index 0), but other keys can be selected by choosing a 346 | different index. 347 | 348 | Raises an exception if not 0 <= index <= 3. 349 | 350 | XXX - more detail required 351 | What format for the key? 352 | """ 353 | return key 354 | 355 | def add_key(index, key): 356 | """ Set an encryption key on the device. May overwrite a key already 357 | in that index position. 358 | 359 | index - integer - The position in which to place the key, see 360 | get_key() for more information. 361 | 362 | key - the encryption key to add 363 | 364 | Raises an exception if not 0 <= index <= 3. 365 | 366 | XXX - more detail required 367 | What format for the key? 368 | """ 369 | pass 370 | 371 | def set_key(index, key=None): 372 | """ Set, and optionally add, the encryption key to use. 373 | 374 | index - integer - The position of the key, see get_key() for 375 | more information. 376 | 377 | key - (optional) the encryption key to add 378 | 379 | Raises an exception if not 0 <= index <= 3. 380 | 381 | XXX - more detail required 382 | What format for the key? 383 | """ 384 | pass 385 | }}} 386 | 387 | 388 | =====nl80211 WirelessConfig===== 389 | 390 | {{{ 391 | class WirelessConfig(pythonwifi.base.WirelessConfig): 392 | def authenticate(ssid, bssid, frequency=None, 393 | channel=None, auth_type=XXX, ie=XXX): 394 | """ Request the device Authenticate to the given BSS. 395 | 396 | ssid - string - a byte string from 1 to 32 bytes long which is 397 | the name of the BSS 398 | 399 | bssid - string - colon-separated string of six octets 400 | (e.g. '00:01:02:FC:A0:23') 401 | 402 | frequency - integer - the radio frequency to use (in MHz) 403 | 404 | channel - integer - look up the frequency for this channel and 405 | use that frequency for authentication. 406 | 407 | auth_type - XXX 408 | 409 | ie - XXX 410 | 411 | If frequency and channel are both given, a warning is given and 412 | channel is ignored. 413 | 414 | NOTE: It may be better to just hand this off to wpa_supplicant, 415 | where it is likely already done correctly. 416 | """ 417 | pass 418 | 419 | def deauthenticate(): 420 | """ Request the device Deauthenticate from the BSS to which it is 421 | currently authenticated. 422 | """ 423 | pass 424 | 425 | def associate(ssid=string, bssid=hex_string, frequency=float, 426 | channel=integer, auth_type=XXX, ie=XXX) 427 | """ Request the device Associate with the given BSS. 428 | 429 | ssid - string - a byte string from 1 to 32 bytes long which is 430 | the name of the BSS 431 | 432 | bssid - string - colon-separated string of six octets 433 | (e.g. '00:01:02:FC:A0:23') 434 | 435 | frequency - integer - the radio frequency to use (in MHz) 436 | 437 | channel - integer - look up the frequency for this channel and 438 | use that frequency for authentication. 439 | 440 | auth_type - XXX 441 | 442 | ie - XXX 443 | 444 | If frequency and channel are both given, a warning is given and 445 | channel is ignored. 446 | """ 447 | pass 448 | 449 | def disassociate(): 450 | """ Request the device Disassociate from the BSS to which it is 451 | currently associated. 452 | """ 453 | pass 454 | 455 | def get_mesh_path(): 456 | """ 457 | """ 458 | return XXX 459 | 460 | def set_mesh_path(XXX) 461 | """ 462 | """ 463 | pass 464 | 465 | def get_mesh_config(): 466 | """ 467 | """ 468 | return XXX 469 | 470 | def set_mesh_config(XXX) 471 | """ 472 | """ 473 | pass 474 | 475 | def mesh_join(XXX) 476 | """ 477 | """ 478 | pass 479 | 480 | def mesh_leave() 481 | """ 482 | """ 483 | pass 484 | 485 | def get_reg_domain() 486 | """ 487 | """ 488 | return XXX 489 | 490 | def set_reg_domain(XXX) 491 | """ 492 | """ 493 | pass 494 | 495 | def get_bitrates() 496 | """ 497 | """ 498 | return XXX 499 | 500 | def set_bitrates(XXX) 501 | """ 502 | """ 503 | pass 504 | 505 | def set_tx_bitrate_mask(XXX) 506 | """ 507 | """ 508 | pass 509 | 510 | def get_tx_power(): 511 | """ Return the transmit power (in mBm). 512 | """ 513 | return power 514 | 515 | def limit_tx_power(limit) 516 | """ Limit the transmit power by limit mBm. 517 | """ 518 | pass 519 | 520 | def set_tx_power(power) 521 | """ Fix the transmit power at power mBm. 522 | """ 523 | pass 524 | 525 | def get_power_save(): 526 | """ Return the current state of power save; True for power save on 527 | and False for power save off. 528 | """ 529 | return power_save 530 | 531 | def set_power_save(power_save): 532 | """ Set the power save state for the device. 533 | 534 | power_save - boolean - True to turn on power save and False to 535 | turn it off. 536 | """ 537 | pass 538 | }}} 539 | 540 | 541 | =====wext WirelessConfig===== 542 | 543 | {{{ 544 | class WirelessConfig(pythonwifi.base.WirelessConfig): 545 | def get_ap_addr(): 546 | """ Return the MAC address of the WAP to which the device is 547 | connected. 548 | """ 549 | return addr 550 | 551 | def set_ap_addr(addr): 552 | """ Set the MAC address of the WAP to which the device will connect. 553 | """ 554 | pass 555 | 556 | def get_bitrate(self): 557 | """ Return the current bit rate (in kibibytes per second) on the 558 | device. 559 | """ 560 | return bitrate 561 | 562 | def get_bitrates(self): 563 | """ Return a list of the bit rates (in kibibytes per second) 564 | supported on the device. 565 | """ 566 | return [bitrate] 567 | 568 | def get_tx_power(self): 569 | """ Return the transmit power (in dBm). 570 | """ 571 | return tx_power 572 | 573 | def set_tx_power(power) 574 | """ Set the transmit power (in dBm). 575 | 576 | power - float - the transmit power in dBm 577 | """ 578 | pass 579 | 580 | def get_power_management(self): 581 | """ Return the power management settings. 582 | """ 583 | return XXX 584 | 585 | def set_power_management(XXX) 586 | """ Set the power management options. 587 | """ 588 | pass 589 | 590 | def commit(self): 591 | """ Commit pending changes to the device. 592 | 593 | Not all wireless cards require this step, however it is included 594 | for those that do need it. 595 | """ 596 | pass 597 | 598 | }}} 599 | 600 | 601 | ====ServiceSet Class==== 602 | 603 | Wireless.scan() in pythonwifi <= 0.5 returns an Iwscan object, which is too 604 | implementation specific. In wext and nl80211 the result of a scan will be 605 | a list of ServiceSet objects. 606 | 607 | The attributes included in the ServiceSet class should be all those returned 608 | by the underlying protocol plus any meta-data likely to be helpful to 609 | wireless client developers. The amount of information in a ServiceSet depends 610 | on the amount of detail asked. That is, a scan will return some information 611 | about a service set which will be placed in a ServiceSet object, but querying 612 | the SSID may place more information in the ServiceSet object. 613 | 614 | ServiceSet will be a subclass of the Python dict built-in class. The nl80211 615 | and wext packages will each implement a custom constructor to make object 616 | creation from the underlying system's data easier. wext's ServiceSet will 617 | accept an Iwscanresult, while nl80211's ServiceSet will accept a pymnl 618 | MessageList. Each package will also implement a binary() method to return 619 | a representation of the object which can be used with wext or nl80211. 620 | 621 | {{{ 622 | class ServiceSet(dict): 623 | @classmethod 624 | def from_data_str(cls, data_str): 625 | """ Create a new ServiceSet object from the binary data string 626 | returned from a scan. 627 | """ 628 | self = cls() 629 | for (key, value_) in data_str: 630 | self[key] = value_ 631 | return self 632 | 633 | def binary(self): 634 | """ Return a binary representation of the ServiceSet which can be 635 | used by the Python WiFi backend (i.e. wext or nl80211). 636 | """ 637 | return data_str 638 | }}} 639 | 640 | Because ServiceSet is a subclass of dict, attribute access is dict access, e.g. 641 | 642 | {{{ 643 | >>> access_point = ServiceSet(Iwscanresult) 644 | >>> for (key, val) in access_point.items(): 645 | ... print(key, val) 646 | ... 647 | essid WinterPalace 648 | ap 00:11:22:33:44:55 649 | mode managed 650 | etc. 651 | >>> print('signal', access_point['signal']) 652 | signal 67 653 | }}} 654 | 655 | 656 | == Glossary == 657 | 658 | 'Basic Service Set' (BSS) is two or more stations coordinating their 659 | communications, upon which a network can be formed. This group of stations 660 | uses a BSSID to identify their common effort. 661 | 662 | 'Basic Service Set IDentifier' (BSSID) is a 48-bit number used to uniquely 663 | identify a BSS. This value is usually the hardware address of the radio 664 | in the device supervising the BSS and is often represented as a string of 665 | six colon-separated octets. 666 | 667 | 'Extended Service Set' (ESS) is a geographically distributed collection of 668 | multiple BSS that are linked together and presented to stations as a 669 | single BSS. 670 | 671 | 'Service Set' (SS) is a non-standard term used in pythonwifi generically 672 | referring to a BSS or ESS. This is advertised to clients via the SSID. 673 | 674 | 'Service Set IDentifier' (SSID) is the (generally) human-readable string by 675 | which a service set can be identified. It is included in a BSS and may be 676 | repeatedly used in the several BSS composing an ESS. The SSID is from 677 | one (1) to thirty-two (32) octets in length. 678 | 679 | 'Station' is a radio-containing device which is designed to communicate 680 | wirelessly with other stations. Specifically, this wireless communication 681 | is of the format detailed by the IEEE 802.11 standards. 682 | -------------------------------------------------------------------------------- /build/lib/pythonwifi/__init__.py: -------------------------------------------------------------------------------- 1 | # make it a python package 2 | -------------------------------------------------------------------------------- /build/lib/pythonwifi/flags.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llazzaro/python3-wifi/f4b7511750d2354aa766745a73399ff069e81f52/build/lib/pythonwifi/flags.py -------------------------------------------------------------------------------- /build/lib/pythonwifi/iwlibs.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llazzaro/python3-wifi/f4b7511750d2354aa766745a73399ff069e81f52/build/lib/pythonwifi/iwlibs.py -------------------------------------------------------------------------------- /docs/AUTHORS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llazzaro/python3-wifi/f4b7511750d2354aa766745a73399ff069e81f52/docs/AUTHORS -------------------------------------------------------------------------------- /docs/BUGS: -------------------------------------------------------------------------------- 1 | Known Bugs: 2 | =========== 3 | -------------------------------------------------------------------------------- /docs/ChangeLog: -------------------------------------------------------------------------------- 1 | 2009-02-13 Roman Joost 2 | 3 | * docs/AUTHORS 4 | * pythonwifi/iwlibs.py: bugfix #2636, submitted by Sean Robinson 5 | 6 | 2009-02-13 Roman Joost 7 | 8 | * pythonwifi/iwlibs.py: fixes ##13090 (Error parsing the event 9 | stream if no available acces points) spotted by Pierre-Nicolas 10 | 11 | * setup.py 12 | * README: small spelling fix 13 | 14 | 2008-08-01 Roman Joost 15 | 16 | * docs/DEVEL.txt: moved devel instructions 17 | 18 | * examples/pyiwlist.py 19 | * pythonwifi/iwlibs.py 20 | * pythonwifi/flags.py: mostly code cleanup 21 | 22 | * setup.py: cleanup 23 | 24 | 2008-08-01 Roman Joost 25 | 26 | * docs/NEWS 27 | * NEWS 28 | * INSTALL 29 | * README: restructured and moved devel instructions out to docs 30 | 31 | 2008-08-01 Roman Joost 32 | 33 | * setup.py: bumped to version 0.3.1 34 | 35 | * version.txt 36 | * PKG-INFO: removed, because they're not needed 37 | 38 | 2008-07-28 Roman Joost 39 | 40 | * pythonwifi/iwlibs.py: fixes a small bug in the regular 41 | expression for detecting the interface name, spotted by Paulo 42 | Ferreira 43 | 44 | 2006-07-05 Roman Joost 45 | 46 | * docs/BUGS 47 | * docs/pywifi_english.tpp 48 | * docs/pywifi.tpp 49 | * docs/NEWS 50 | * PKG-INFO 51 | * README: minor package changes and updates 52 | 53 | * examples/pyiwconfig.py 54 | * examples/pyiwlist.py: import the correct module from the 55 | correct package 56 | 57 | 2006-07-05 Roman Joost 58 | 59 | * pythonwifi 60 | * setup.py 61 | * python-wireless 62 | * python-wireless/iwlibs.py 63 | * python-wireless/flags.py 64 | * python-wireless/__init__.py: as I already figured, this 65 | package name is not suitable 66 | 67 | 2006-07-05 Roman Joost 68 | 69 | * LICENSE: GPL -> LGPL 70 | 71 | * docs/README 72 | * README: updated description and moved README to toplevel 73 | 74 | * setup.py 75 | * PKG-INFO 76 | * ez_setup.py: boilerplate for setuptools and metadata 77 | 78 | * lib 79 | * lib/iwlibs.py 80 | * lib/flags.py 81 | * docs/AUTHORS 82 | * python-wireless 83 | * python-wireless/iwlibs.py 84 | * python-wireless/flags.py 85 | * python-wireless/__init__.py: updated copyright date and 86 | renamed to a better package name 87 | 88 | 2006-07-05 Roman Joost 89 | 90 | * iwlibs.py 91 | * flags.py 92 | * pyiwconfig.py 93 | * pyiwlist.py 94 | * trunk/lib/iwlibs.py 95 | * trunk/lib/flags.py 96 | * trunk/examples 97 | * trunk/examples/pyiwconfig.py 98 | * trunk/examples/pyiwlist.py: moved files in designated areas 99 | 100 | 2006-07-05 Roman Joost 101 | 102 | * LICENSE 103 | * pyiwlist 104 | * pyiwlist.py 105 | * ChangeLog 106 | * docs 107 | * docs/BUGS 108 | * docs/profiling.py 109 | * docs/pywifi_english.tpp 110 | * docs/europython2005.mgp 111 | * docs/TODO 112 | * docs/AUTHORS 113 | * docs/pywifi.tpp 114 | * docs/NEWS 115 | * docs/README 116 | * README 117 | * tests 118 | * tests/test_wireless.py 119 | * tests/test_wireless_doctest.py 120 | * tests/README 121 | * version.txt 122 | * trunk/LICENSE 123 | * trunk/tests 124 | * trunk/version.txt 125 | * trunk/lib 126 | * trunk/ChangeLog 127 | * trunk/docs 128 | * trunk/README: moved everything to trunk directory, some more 129 | files and dirs will follow 130 | 131 | 2006-07-05 Roman Joost 132 | 133 | * version.txt: bumped to 0.3 134 | 135 | * iwlibs.py 136 | * flags.py 137 | * pyiwlist 138 | * pyiwconfig.py 139 | * docs/pywifi_english.tpp 140 | * docs/pywifi.tpp 141 | * docs/AUTHORS 142 | * docs/README: added patch submitted by Mike Auty which adds 143 | scanning functionality 144 | 145 | 2005-08-026 Roman Joost 146 | 147 | * docs/europython2005.mgp: added presentation from the 148 | europython 149 | 150 | 2005-06-05 Roman Joost 151 | 152 | * tests/test_wireless.py 153 | * tests/test_wirelessconfig.py 154 | * pyiwconfig 155 | * pyiwconfig.py: renamed 156 | 157 | * iwlibs.py: new methods for returning the right power 158 | management values 159 | 160 | * flags.py: moved ioctl calls and flags out to seperate module 161 | 162 | * README: hint to check the docs directory 163 | 164 | 2005-06-05 Roman Joost 165 | 166 | * iwlibs.py 167 | * tests 168 | * tests/README 169 | * tests/test_wireless_doctest.py 170 | * tests/test_wirelessconfig.py: added doctests and a method to 171 | get the ifnames by a systemcall if /proc/net/wireless doesn't 172 | exist 173 | 174 | * README 175 | * NEWS 176 | * BUGS 177 | * AUTHORS 178 | * TODO 179 | * docs 180 | * docs/profiling.py 181 | * docs/BUGS 182 | * docs/TODO 183 | * docs/AUTHORS 184 | * docs/NEWS 185 | * docs/README: moved to seperate docs directory 186 | 187 | * pyiwconfig: specified the copyright year 188 | 189 | 2005-05-22 Roman Joost 190 | 191 | * version.txt: bumped to 0.2 192 | 193 | * iwlibs.py: fixed spelling in docstring 194 | 195 | * pyiwlist: fixed wrong exception catch 196 | 197 | * AUTHORS 198 | * TODO 199 | * NEWS 200 | * README: moving some text to their right directions, added 201 | some tutorial style code for pywifi relevant 'users' 202 | 203 | 2005-05-18 Roman Joost 204 | 205 | * iwlibs.py 206 | * pyiwlist: refactoring 207 | 208 | * TODO: added possible todo item 209 | 210 | 2005-05-17 Roman Joost 211 | 212 | * iwlibs.py 213 | * pyiwlist 214 | * pyiwconfig: added 'bitrates' option and fixed some syntax 215 | errors and bugs 216 | 217 | 2005-05-16 Roman Joost 218 | 219 | * iwconfig.py 220 | * pyiwconfig: renamed 221 | 222 | 2005-05-16 Roman Joost 223 | 224 | * pyiwlist 225 | * iwlibs.py: new method for gathering detailed information 226 | 227 | * BUGS: known bugs 228 | 229 | * iwconfig.py: minor modifications for main program 230 | 231 | 2005-05-08 Roman Joost 232 | 233 | * iwlibs.py 234 | * iwconfig.py: new parsing style to achieve same options parsing 235 | like the wireless tools 236 | 237 | * README: descriptions about whats going on 238 | 239 | 2005-05-08 Roman Joost 240 | 241 | * main.py: removed, because iwconfig should be doing this now 242 | * iwconfig.py 243 | * iwlibs.py: factored out most of iwconfig methods to new 244 | Wireless class. Not sure if this is the right name for this, but 245 | it'll store all necessary methods for read/write to the driver. 246 | -------------------------------------------------------------------------------- /docs/DEVEL.txt: -------------------------------------------------------------------------------- 1 | What is implemented? 2 | -------------------- 3 | 4 | - pyiwconfig: 5 | 6 | read write 7 | --------------------------------||-------- 8 | Accesspoint MAC Mode 9 | Bitrate 10 | available Bitrates 11 | available Channels/Frequency 12 | ESSID 13 | Encryption 14 | Frequency 15 | Mode 16 | WirelessName 17 | Powermanagement 18 | Retrylimit 19 | RTS 20 | Sensitivity 21 | TXPower 22 | Statistics 23 | 24 | - pyiwlist: prints detailed information about: 25 | 26 | o Bitrates 27 | o Channels/Frequency 28 | o Scanning support! 29 | 30 | Python Wireless developers: 31 | --------------------------- 32 | So, you want to know what the other classes doing? Well, lets talk about 33 | the wireless tools at first. If you don't know anything about C, forget 34 | the following information. Learn C first or at least read some tutorials 35 | about C (I don't know C very well, but know how to handle all this C 36 | stuff which works for me ;). 37 | 38 | The wireless tools store the request in a union which is passed with a 39 | pointer to the kernel by a system call. The union is defined in the 40 | wireless.h and holds the following structures: 41 | 42 | union iwreq_data 43 | { 44 | /* Config - generic */ 45 | char name[IFNAMSIZ]; 46 | /* Name : used to verify the presence of wireless extensions. 47 | * Name of the protocol/provider... */ 48 | 49 | struct iw_point essid; /* Extended network name */ 50 | struct iw_param nwid; /* network id (or domain - the cell) */ 51 | struct iw_freq freq; /* frequency or channel : 52 | * 0-1000 = channel 53 | * > 1000 = frequency in Hz */ 54 | 55 | struct iw_param sens; /* signal level threshold */ 56 | struct iw_param bitrate; /* default bit rate */ 57 | struct iw_param txpower; /* default transmit power */ 58 | struct iw_param rts; /* RTS threshold threshold */ 59 | struct iw_param frag; /* Fragmentation threshold */ 60 | __u32 mode; /* Operation mode */ 61 | struct iw_param retry; /* Retry limits & lifetime */ 62 | 63 | struct iw_point encoding; /* Encoding stuff : tokens */ 64 | struct iw_param power; /* PM duration/timeout */ 65 | struct iw_quality qual; /* Quality part of statistics */ 66 | 67 | struct sockaddr ap_addr; /* Access point address */ 68 | struct sockaddr addr; /* Destination address (hw/mac) */ 69 | 70 | struct iw_param param; /* Other small parameters */ 71 | struct iw_point data; /* Other large parameters */ 72 | }; 73 | 74 | Well, anyway -- the interesting thing here is, that I need to build a 75 | C struct in Python, where the kernel can write his information in. 76 | For example the ESSID (relevant methods are: pack_wrq and iw_get_ext in 77 | Iwstruct): 78 | 79 | First, we build a buffer with a buffersize of 32 80 | byte: 81 | 82 | buff = array.array('c', '\0'*buffsize) 83 | 84 | Then, the system call needs the address of this buffer and the 85 | length, which can be optained by a method on the buffer. 86 | This information need to be packed in C like style by 'struct': 87 | 88 | caddr_t, length = buff.buffer_info() 89 | s = struct.pack('Pi', caddr_t, length) 90 | 91 | Then, the request can be made by specifying the interface name, 92 | which is passed as a second argument to the ioctl method. 93 | 94 | -------------------------------------------------------------------------------- /docs/LICENSE.GPL: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc. 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Library General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | 294 | Copyright (C) 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License 307 | along with this program; if not, write to the Free Software 308 | Foundation, Inc., 51 Franklin St., Fifth Floor, Boston, MA 02110-1301 USA 309 | 310 | 311 | Also add information on how to contact you by electronic and paper mail. 312 | 313 | If the program is interactive, make it output a short notice like this 314 | when it starts in an interactive mode: 315 | 316 | Gnomovision version 69, Copyright (C) year name of author 317 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 318 | This is free software, and you are welcome to redistribute it 319 | under certain conditions; type `show c' for details. 320 | 321 | The hypothetical commands `show w' and `show c' should show the appropriate 322 | parts of the General Public License. Of course, the commands you use may 323 | be called something other than `show w' and `show c'; they could even be 324 | mouse-clicks or menu items--whatever suits your program. 325 | 326 | You should also get your employer (if you work as a programmer) or your 327 | school, if any, to sign a "copyright disclaimer" for the program, if 328 | necessary. Here is a sample; alter the names: 329 | 330 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 331 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 332 | 333 | , 1 April 1989 334 | Ty Coon, President of Vice 335 | 336 | This General Public License does not permit incorporating your program into 337 | proprietary programs. If your program is a subroutine library, you may 338 | consider it more useful to permit linking proprietary applications with the 339 | library. If this is what you want to do, use the GNU Library General 340 | Public License instead of this License. 341 | -------------------------------------------------------------------------------- /docs/LICENSE.LGPL: -------------------------------------------------------------------------------- 1 | GNU LESSER GENERAL PUBLIC LICENSE 2 | Version 2.1, February 1999 3 | 4 | Copyright (C) 1991, 1999 Free Software Foundation, Inc. 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | [This is the first released version of the Lesser GPL. It also counts 10 | as the successor of the GNU Library Public License, version 2, hence 11 | the version number 2.1.] 12 | 13 | Preamble 14 | 15 | The licenses for most software are designed to take away your 16 | freedom to share and change it. By contrast, the GNU General Public 17 | Licenses are intended to guarantee your freedom to share and change 18 | free software--to make sure the software is free for all its users. 19 | 20 | This license, the Lesser General Public License, applies to some 21 | specially designated software packages--typically libraries--of the 22 | Free Software Foundation and other authors who decide to use it. You 23 | can use it too, but we suggest you first think carefully about whether 24 | this license or the ordinary General Public License is the better 25 | strategy to use in any particular case, based on the explanations below. 26 | 27 | When we speak of free software, we are referring to freedom of use, 28 | not price. Our General Public Licenses are designed to make sure that 29 | you have the freedom to distribute copies of free software (and charge 30 | for this service if you wish); that you receive source code or can get 31 | it if you want it; that you can change the software and use pieces of 32 | it in new free programs; and that you are informed that you can do 33 | these things. 34 | 35 | To protect your rights, we need to make restrictions that forbid 36 | distributors to deny you these rights or to ask you to surrender these 37 | rights. These restrictions translate to certain responsibilities for 38 | you if you distribute copies of the library or if you modify it. 39 | 40 | For example, if you distribute copies of the library, whether gratis 41 | or for a fee, you must give the recipients all the rights that we gave 42 | you. You must make sure that they, too, receive or can get the source 43 | code. If you link other code with the library, you must provide 44 | complete object files to the recipients, so that they can relink them 45 | with the library after making changes to the library and recompiling 46 | it. And you must show them these terms so they know their rights. 47 | 48 | We protect your rights with a two-step method: (1) we copyright the 49 | library, and (2) we offer you this license, which gives you legal 50 | permission to copy, distribute and/or modify the library. 51 | 52 | To protect each distributor, we want to make it very clear that 53 | there is no warranty for the free library. Also, if the library is 54 | modified by someone else and passed on, the recipients should know 55 | that what they have is not the original version, so that the original 56 | author's reputation will not be affected by problems that might be 57 | introduced by others. 58 | 59 | Finally, software patents pose a constant threat to the existence of 60 | any free program. We wish to make sure that a company cannot 61 | effectively restrict the users of a free program by obtaining a 62 | restrictive license from a patent holder. Therefore, we insist that 63 | any patent license obtained for a version of the library must be 64 | consistent with the full freedom of use specified in this license. 65 | 66 | Most GNU software, including some libraries, is covered by the 67 | ordinary GNU General Public License. This license, the GNU Lesser 68 | General Public License, applies to certain designated libraries, and 69 | is quite different from the ordinary General Public License. We use 70 | this license for certain libraries in order to permit linking those 71 | libraries into non-free programs. 72 | 73 | When a program is linked with a library, whether statically or using 74 | a shared library, the combination of the two is legally speaking a 75 | combined work, a derivative of the original library. The ordinary 76 | General Public License therefore permits such linking only if the 77 | entire combination fits its criteria of freedom. The Lesser General 78 | Public License permits more lax criteria for linking other code with 79 | the library. 80 | 81 | We call this license the "Lesser" General Public License because it 82 | does Less to protect the user's freedom than the ordinary General 83 | Public License. It also provides other free software developers Less 84 | of an advantage over competing non-free programs. These disadvantages 85 | are the reason we use the ordinary General Public License for many 86 | libraries. However, the Lesser license provides advantages in certain 87 | special circumstances. 88 | 89 | For example, on rare occasions, there may be a special need to 90 | encourage the widest possible use of a certain library, so that it becomes 91 | a de-facto standard. To achieve this, non-free programs must be 92 | allowed to use the library. A more frequent case is that a free 93 | library does the same job as widely used non-free libraries. In this 94 | case, there is little to gain by limiting the free library to free 95 | software only, so we use the Lesser General Public License. 96 | 97 | In other cases, permission to use a particular library in non-free 98 | programs enables a greater number of people to use a large body of 99 | free software. For example, permission to use the GNU C Library in 100 | non-free programs enables many more people to use the whole GNU 101 | operating system, as well as its variant, the GNU/Linux operating 102 | system. 103 | 104 | Although the Lesser General Public License is Less protective of the 105 | users' freedom, it does ensure that the user of a program that is 106 | linked with the Library has the freedom and the wherewithal to run 107 | that program using a modified version of the Library. 108 | 109 | The precise terms and conditions for copying, distribution and 110 | modification follow. Pay close attention to the difference between a 111 | "work based on the library" and a "work that uses the library". The 112 | former contains code derived from the library, whereas the latter must 113 | be combined with the library in order to run. 114 | 115 | GNU LESSER GENERAL PUBLIC LICENSE 116 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 117 | 118 | 0. This License Agreement applies to any software library or other 119 | program which contains a notice placed by the copyright holder or 120 | other authorized party saying it may be distributed under the terms of 121 | this Lesser General Public License (also called "this License"). 122 | Each licensee is addressed as "you". 123 | 124 | A "library" means a collection of software functions and/or data 125 | prepared so as to be conveniently linked with application programs 126 | (which use some of those functions and data) to form executables. 127 | 128 | The "Library", below, refers to any such software library or work 129 | which has been distributed under these terms. A "work based on the 130 | Library" means either the Library or any derivative work under 131 | copyright law: that is to say, a work containing the Library or a 132 | portion of it, either verbatim or with modifications and/or translated 133 | straightforwardly into another language. (Hereinafter, translation is 134 | included without limitation in the term "modification".) 135 | 136 | "Source code" for a work means the preferred form of the work for 137 | making modifications to it. For a library, complete source code means 138 | all the source code for all modules it contains, plus any associated 139 | interface definition files, plus the scripts used to control compilation 140 | and installation of the library. 141 | 142 | Activities other than copying, distribution and modification are not 143 | covered by this License; they are outside its scope. The act of 144 | running a program using the Library is not restricted, and output from 145 | such a program is covered only if its contents constitute a work based 146 | on the Library (independent of the use of the Library in a tool for 147 | writing it). Whether that is true depends on what the Library does 148 | and what the program that uses the Library does. 149 | 150 | 1. You may copy and distribute verbatim copies of the Library's 151 | complete source code as you receive it, in any medium, provided that 152 | you conspicuously and appropriately publish on each copy an 153 | appropriate copyright notice and disclaimer of warranty; keep intact 154 | all the notices that refer to this License and to the absence of any 155 | warranty; and distribute a copy of this License along with the 156 | Library. 157 | 158 | You may charge a fee for the physical act of transferring a copy, 159 | and you may at your option offer warranty protection in exchange for a 160 | fee. 161 | 162 | 2. You may modify your copy or copies of the Library or any portion 163 | of it, thus forming a work based on the Library, and copy and 164 | distribute such modifications or work under the terms of Section 1 165 | above, provided that you also meet all of these conditions: 166 | 167 | a) The modified work must itself be a software library. 168 | 169 | b) You must cause the files modified to carry prominent notices 170 | stating that you changed the files and the date of any change. 171 | 172 | c) You must cause the whole of the work to be licensed at no 173 | charge to all third parties under the terms of this License. 174 | 175 | d) If a facility in the modified Library refers to a function or a 176 | table of data to be supplied by an application program that uses 177 | the facility, other than as an argument passed when the facility 178 | is invoked, then you must make a good faith effort to ensure that, 179 | in the event an application does not supply such function or 180 | table, the facility still operates, and performs whatever part of 181 | its purpose remains meaningful. 182 | 183 | (For example, a function in a library to compute square roots has 184 | a purpose that is entirely well-defined independent of the 185 | application. Therefore, Subsection 2d requires that any 186 | application-supplied function or table used by this function must 187 | be optional: if the application does not supply it, the square 188 | root function must still compute square roots.) 189 | 190 | These requirements apply to the modified work as a whole. If 191 | identifiable sections of that work are not derived from the Library, 192 | and can be reasonably considered independent and separate works in 193 | themselves, then this License, and its terms, do not apply to those 194 | sections when you distribute them as separate works. But when you 195 | distribute the same sections as part of a whole which is a work based 196 | on the Library, the distribution of the whole must be on the terms of 197 | this License, whose permissions for other licensees extend to the 198 | entire whole, and thus to each and every part regardless of who wrote 199 | it. 200 | 201 | Thus, it is not the intent of this section to claim rights or contest 202 | your rights to work written entirely by you; rather, the intent is to 203 | exercise the right to control the distribution of derivative or 204 | collective works based on the Library. 205 | 206 | In addition, mere aggregation of another work not based on the Library 207 | with the Library (or with a work based on the Library) on a volume of 208 | a storage or distribution medium does not bring the other work under 209 | the scope of this License. 210 | 211 | 3. You may opt to apply the terms of the ordinary GNU General Public 212 | License instead of this License to a given copy of the Library. To do 213 | this, you must alter all the notices that refer to this License, so 214 | that they refer to the ordinary GNU General Public License, version 2, 215 | instead of to this License. (If a newer version than version 2 of the 216 | ordinary GNU General Public License has appeared, then you can specify 217 | that version instead if you wish.) Do not make any other change in 218 | these notices. 219 | 220 | Once this change is made in a given copy, it is irreversible for 221 | that copy, so the ordinary GNU General Public License applies to all 222 | subsequent copies and derivative works made from that copy. 223 | 224 | This option is useful when you wish to copy part of the code of 225 | the Library into a program that is not a library. 226 | 227 | 4. You may copy and distribute the Library (or a portion or 228 | derivative of it, under Section 2) in object code or executable form 229 | under the terms of Sections 1 and 2 above provided that you accompany 230 | it with the complete corresponding machine-readable source code, which 231 | must be distributed under the terms of Sections 1 and 2 above on a 232 | medium customarily used for software interchange. 233 | 234 | If distribution of object code is made by offering access to copy 235 | from a designated place, then offering equivalent access to copy the 236 | source code from the same place satisfies the requirement to 237 | distribute the source code, even though third parties are not 238 | compelled to copy the source along with the object code. 239 | 240 | 5. A program that contains no derivative of any portion of the 241 | Library, but is designed to work with the Library by being compiled or 242 | linked with it, is called a "work that uses the Library". Such a 243 | work, in isolation, is not a derivative work of the Library, and 244 | therefore falls outside the scope of this License. 245 | 246 | However, linking a "work that uses the Library" with the Library 247 | creates an executable that is a derivative of the Library (because it 248 | contains portions of the Library), rather than a "work that uses the 249 | library". The executable is therefore covered by this License. 250 | Section 6 states terms for distribution of such executables. 251 | 252 | When a "work that uses the Library" uses material from a header file 253 | that is part of the Library, the object code for the work may be a 254 | derivative work of the Library even though the source code is not. 255 | Whether this is true is especially significant if the work can be 256 | linked without the Library, or if the work is itself a library. The 257 | threshold for this to be true is not precisely defined by law. 258 | 259 | If such an object file uses only numerical parameters, data 260 | structure layouts and accessors, and small macros and small inline 261 | functions (ten lines or less in length), then the use of the object 262 | file is unrestricted, regardless of whether it is legally a derivative 263 | work. (Executables containing this object code plus portions of the 264 | Library will still fall under Section 6.) 265 | 266 | Otherwise, if the work is a derivative of the Library, you may 267 | distribute the object code for the work under the terms of Section 6. 268 | Any executables containing that work also fall under Section 6, 269 | whether or not they are linked directly with the Library itself. 270 | 271 | 6. As an exception to the Sections above, you may also combine or 272 | link a "work that uses the Library" with the Library to produce a 273 | work containing portions of the Library, and distribute that work 274 | under terms of your choice, provided that the terms permit 275 | modification of the work for the customer's own use and reverse 276 | engineering for debugging such modifications. 277 | 278 | You must give prominent notice with each copy of the work that the 279 | Library is used in it and that the Library and its use are covered by 280 | this License. You must supply a copy of this License. If the work 281 | during execution displays copyright notices, you must include the 282 | copyright notice for the Library among them, as well as a reference 283 | directing the user to the copy of this License. Also, you must do one 284 | of these things: 285 | 286 | a) Accompany the work with the complete corresponding 287 | machine-readable source code for the Library including whatever 288 | changes were used in the work (which must be distributed under 289 | Sections 1 and 2 above); and, if the work is an executable linked 290 | with the Library, with the complete machine-readable "work that 291 | uses the Library", as object code and/or source code, so that the 292 | user can modify the Library and then relink to produce a modified 293 | executable containing the modified Library. (It is understood 294 | that the user who changes the contents of definitions files in the 295 | Library will not necessarily be able to recompile the application 296 | to use the modified definitions.) 297 | 298 | b) Use a suitable shared library mechanism for linking with the 299 | Library. A suitable mechanism is one that (1) uses at run time a 300 | copy of the library already present on the user's computer system, 301 | rather than copying library functions into the executable, and (2) 302 | will operate properly with a modified version of the library, if 303 | the user installs one, as long as the modified version is 304 | interface-compatible with the version that the work was made with. 305 | 306 | c) Accompany the work with a written offer, valid for at 307 | least three years, to give the same user the materials 308 | specified in Subsection 6a, above, for a charge no more 309 | than the cost of performing this distribution. 310 | 311 | d) If distribution of the work is made by offering access to copy 312 | from a designated place, offer equivalent access to copy the above 313 | specified materials from the same place. 314 | 315 | e) Verify that the user has already received a copy of these 316 | materials or that you have already sent this user a copy. 317 | 318 | For an executable, the required form of the "work that uses the 319 | Library" must include any data and utility programs needed for 320 | reproducing the executable from it. However, as a special exception, 321 | the materials to be distributed need not include anything that is 322 | normally distributed (in either source or binary form) with the major 323 | components (compiler, kernel, and so on) of the operating system on 324 | which the executable runs, unless that component itself accompanies 325 | the executable. 326 | 327 | It may happen that this requirement contradicts the license 328 | restrictions of other proprietary libraries that do not normally 329 | accompany the operating system. Such a contradiction means you cannot 330 | use both them and the Library together in an executable that you 331 | distribute. 332 | 333 | 7. You may place library facilities that are a work based on the 334 | Library side-by-side in a single library together with other library 335 | facilities not covered by this License, and distribute such a combined 336 | library, provided that the separate distribution of the work based on 337 | the Library and of the other library facilities is otherwise 338 | permitted, and provided that you do these two things: 339 | 340 | a) Accompany the combined library with a copy of the same work 341 | based on the Library, uncombined with any other library 342 | facilities. This must be distributed under the terms of the 343 | Sections above. 344 | 345 | b) Give prominent notice with the combined library of the fact 346 | that part of it is a work based on the Library, and explaining 347 | where to find the accompanying uncombined form of the same work. 348 | 349 | 8. You may not copy, modify, sublicense, link with, or distribute 350 | the Library except as expressly provided under this License. Any 351 | attempt otherwise to copy, modify, sublicense, link with, or 352 | distribute the Library is void, and will automatically terminate your 353 | rights under this License. However, parties who have received copies, 354 | or rights, from you under this License will not have their licenses 355 | terminated so long as such parties remain in full compliance. 356 | 357 | 9. You are not required to accept this License, since you have not 358 | signed it. However, nothing else grants you permission to modify or 359 | distribute the Library or its derivative works. These actions are 360 | prohibited by law if you do not accept this License. Therefore, by 361 | modifying or distributing the Library (or any work based on the 362 | Library), you indicate your acceptance of this License to do so, and 363 | all its terms and conditions for copying, distributing or modifying 364 | the Library or works based on it. 365 | 366 | 10. Each time you redistribute the Library (or any work based on the 367 | Library), the recipient automatically receives a license from the 368 | original licensor to copy, distribute, link with or modify the Library 369 | subject to these terms and conditions. You may not impose any further 370 | restrictions on the recipients' exercise of the rights granted herein. 371 | You are not responsible for enforcing compliance by third parties with 372 | this License. 373 | 374 | 11. If, as a consequence of a court judgment or allegation of patent 375 | infringement or for any other reason (not limited to patent issues), 376 | conditions are imposed on you (whether by court order, agreement or 377 | otherwise) that contradict the conditions of this License, they do not 378 | excuse you from the conditions of this License. If you cannot 379 | distribute so as to satisfy simultaneously your obligations under this 380 | License and any other pertinent obligations, then as a consequence you 381 | may not distribute the Library at all. For example, if a patent 382 | license would not permit royalty-free redistribution of the Library by 383 | all those who receive copies directly or indirectly through you, then 384 | the only way you could satisfy both it and this License would be to 385 | refrain entirely from distribution of the Library. 386 | 387 | If any portion of this section is held invalid or unenforceable under any 388 | particular circumstance, the balance of the section is intended to apply, 389 | and the section as a whole is intended to apply in other circumstances. 390 | 391 | It is not the purpose of this section to induce you to infringe any 392 | patents or other property right claims or to contest validity of any 393 | such claims; this section has the sole purpose of protecting the 394 | integrity of the free software distribution system which is 395 | implemented by public license practices. Many people have made 396 | generous contributions to the wide range of software distributed 397 | through that system in reliance on consistent application of that 398 | system; it is up to the author/donor to decide if he or she is willing 399 | to distribute software through any other system and a licensee cannot 400 | impose that choice. 401 | 402 | This section is intended to make thoroughly clear what is believed to 403 | be a consequence of the rest of this License. 404 | 405 | 12. If the distribution and/or use of the Library is restricted in 406 | certain countries either by patents or by copyrighted interfaces, the 407 | original copyright holder who places the Library under this License may add 408 | an explicit geographical distribution limitation excluding those countries, 409 | so that distribution is permitted only in or among countries not thus 410 | excluded. In such case, this License incorporates the limitation as if 411 | written in the body of this License. 412 | 413 | 13. The Free Software Foundation may publish revised and/or new 414 | versions of the Lesser General Public License from time to time. 415 | Such new versions will be similar in spirit to the present version, 416 | but may differ in detail to address new problems or concerns. 417 | 418 | Each version is given a distinguishing version number. If the Library 419 | specifies a version number of this License which applies to it and 420 | "any later version", you have the option of following the terms and 421 | conditions either of that version or of any later version published by 422 | the Free Software Foundation. If the Library does not specify a 423 | license version number, you may choose any version ever published by 424 | the Free Software Foundation. 425 | 426 | 14. If you wish to incorporate parts of the Library into other free 427 | programs whose distribution conditions are incompatible with these, 428 | write to the author to ask for permission. For software which is 429 | copyrighted by the Free Software Foundation, write to the Free 430 | Software Foundation; we sometimes make exceptions for this. Our 431 | decision will be guided by the two goals of preserving the free status 432 | of all derivatives of our free software and of promoting the sharing 433 | and reuse of software generally. 434 | 435 | NO WARRANTY 436 | 437 | 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO 438 | WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. 439 | EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR 440 | OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY 441 | KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE 442 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 443 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE 444 | LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME 445 | THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 446 | 447 | 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN 448 | WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY 449 | AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU 450 | FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR 451 | CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE 452 | LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING 453 | RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A 454 | FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF 455 | SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 456 | DAMAGES. 457 | 458 | END OF TERMS AND CONDITIONS 459 | 460 | How to Apply These Terms to Your New Libraries 461 | 462 | If you develop a new library, and you want it to be of the greatest 463 | possible use to the public, we recommend making it free software that 464 | everyone can redistribute and change. You can do so by permitting 465 | redistribution under these terms (or, alternatively, under the terms of the 466 | ordinary General Public License). 467 | 468 | To apply these terms, attach the following notices to the library. It is 469 | safest to attach them to the start of each source file to most effectively 470 | convey the exclusion of warranty; and each file should have at least the 471 | "copyright" line and a pointer to where the full notice is found. 472 | 473 | 474 | Copyright (C) 475 | 476 | This library is free software; you can redistribute it and/or 477 | modify it under the terms of the GNU Lesser General Public 478 | License as published by the Free Software Foundation; either 479 | version 2.1 of the License, or (at your option) any later version. 480 | 481 | This library is distributed in the hope that it will be useful, 482 | but WITHOUT ANY WARRANTY; without even the implied warranty of 483 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 484 | Lesser General Public License for more details. 485 | 486 | You should have received a copy of the GNU Lesser General Public 487 | License along with this library; if not, write to the Free Software 488 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 489 | 490 | Also add information on how to contact you by electronic and paper mail. 491 | 492 | You should also get your employer (if you work as a programmer) or your 493 | school, if any, to sign a "copyright disclaimer" for the library, if 494 | necessary. Here is a sample; alter the names: 495 | 496 | Yoyodyne, Inc., hereby disclaims all copyright interest in the 497 | library `Frob' (a library for tweaking knobs) written by James Random Hacker. 498 | 499 | , 1 April 1990 500 | Ty Coon, President of Vice 501 | 502 | That's all there is to it! 503 | 504 | 505 | -------------------------------------------------------------------------------- /docs/NEWS: -------------------------------------------------------------------------------- 1 | ======= 2 | Changes 3 | ======= 4 | 5 | pythonwifi 0.6.1 release 6 | ------------------------ 7 | - fix one bug that prevented installation 8 | 9 | pythonwifi 0.6.0 release 10 | ------------------------ 11 | - various improvements to WEXT modules and examples 12 | - updates to URLs and documentation 13 | 14 | pythonwifi 0.5.0 release 15 | ------------------------ 16 | - make licensing on each file more explicit 17 | - added documentation 18 | - fuller implementation of the wireless extensions 22 19 | - bug fixes 20 | 21 | pythonwifi 0.3.1 release 22 | ------------------------ 23 | - bugfixes 24 | - mostly code cleanups 25 | 26 | pythonwifi 0.3 release 27 | ---------------------- 28 | - renamed to python-wifi and package cleanup 29 | - included patch submitted by Mike Auty , which 30 | adds scanning functionality 31 | 32 | PyWifi 0.2 release 33 | ------------------- 34 | - big refactoring, most low level code moved to Iw* classes 35 | - little documentation 36 | - able to set the wireless mode 37 | -------------------------------------------------------------------------------- /docs/ROADMAP: -------------------------------------------------------------------------------- 1 | When it's ready. 2 | -------------------------------------------------------------------------------- /docs/TODO: -------------------------------------------------------------------------------- 1 | TODO 2 | ---- 3 | 4 | - increase exception use 5 | - the whole wireless extensions, of course 6 | - use NETLINK (cfg80211) interface in addition to Wireless Ext. 7 | - better error control if something goes wrong 8 | -------------------------------------------------------------------------------- /docs/VERSION: -------------------------------------------------------------------------------- 1 | 0.1 2 | -------------------------------------------------------------------------------- /docs/europython2005.mgp: -------------------------------------------------------------------------------- 1 | 2 | %include "default.mgp" 3 | motivation: 4 | - collection of wireless statistics involves the use of executing 5 | external programs and parsing the output -> depends on the 6 | output formating 7 | -> external program dependencies 8 | 9 | - spare time project -> investing not much time 10 | - i'm not a kernel hacker -> educational project for me 11 | 12 | pywifi: 13 | - implementation of the wireless tools for linux in pure python 14 | - does system calls to the linux kernel and parses the output 15 | 16 | current development status: 17 | o can read most of the wireless parameters 18 | o 2 parameters can be set 19 | o scaning not possible 20 | 21 | whats missing: 22 | o setting wireless parameters (ESSID) 23 | o scanning 24 | -------------------------------------------------------------------------------- /docs/feature_matrix_iwconfig.py.txt: -------------------------------------------------------------------------------- 1 | iwconfig Feature Matrix 2 | ----------------------- 3 | 4 | Comparison of Linux iwconfig vs Python WiFi iwconfig.py. iwconfig is the 5 | baseline to which iwconfig.py must match-up. 6 | 7 | Feature iwconfig iwconfig.py Version Note 8 | --------------- -------- ----------- ------- -------------------- 9 | list devices yes yes 10 | list device properties yes partial not quite exact match 11 | 12 | read properties 13 | wireless name yes yes 14 | ESSID yes yes 15 | Nickname yes no 16 | Mode yes yes 17 | Frequency yes yes 18 | Access Point yes partial 19 | Bit Rate yes yes 20 | Tx-Power yes yes 21 | Sensitivity yes partial 22 | Retry Limit yes partial 23 | RTS thr yes yes 24 | Encryption yes partial 25 | Power Management yes partial 26 | Link Quality yes partial 27 | Signal level yes partial 28 | Noise level yes partial 29 | Rx invalid yes partial 30 | Rx invalid crypt yes partial 31 | Rx invalid frag yes partial 32 | Tx excessive retries yes partial 33 | Invalid misc yes partial 34 | Missed Beacon yes partial 35 | 36 | write properties 37 | wireless name 38 | ESSID 39 | Nickname 40 | Mode 41 | Frequency 42 | Access Point 43 | Bit Rate 44 | Tx-Power 45 | Sensitivity 46 | Retry Limit 47 | RTS thr 48 | Encryption 49 | Power Management 50 | Link Quality 51 | Signal level 52 | Noise level 53 | Rx invalid 54 | Rx invalid crypt 55 | Rx invalid frag 56 | Tx excessive retries 57 | Invalid misc 58 | Missed Beacon 59 | -------------------------------------------------------------------------------- /docs/feature_matrix_iwlist.py.txt: -------------------------------------------------------------------------------- 1 | iwlist Feature Matrix 2 | ----------------------- 3 | 4 | Comparison of Linux iwlist vs Python WiFi iwlist.py. iwlist is the baseline 5 | to which iwlist.py must match-up. 6 | 7 | Feature iwlist iwlist.py Version Note 8 | --------------- -------- ----------- ------- ---------------- 9 | usage message yes yes 0.5 close match 10 | 11 | unknown command error yes yes 0.3.1 close match 12 | 13 | commands: 14 | scanning yes yes 0.3.1 15 | frequency yes yes 0.3.1 exact match 16 | channel yes yes 0.3.1 exact match 17 | 18 | bitrate yes yes 0.3.1 75% match 19 | rate yes yes 0.3.1 75% match 20 | 21 | encryption yes yes 0.5 close 22 | keys yes yes 0.5 close 23 | 24 | power yes yes 0.5 close 25 | txpower yes yes 26 | 27 | retry yes yes 28 | 29 | ap yes yes 30 | accesspoints yes yes 31 | peers yes yes 32 | 33 | events yes no 34 | 35 | auth yes no 36 | 37 | wpakeys yes no 38 | 39 | genie yes no 40 | 41 | modulation yes no 42 | 43 | 44 | -------------------------------------------------------------------------------- /docs/feature_matrix_wireless_extensions.txt: -------------------------------------------------------------------------------- 1 | WE Feature Matrix 2 | -------------- 3 | 4 | Comparison of Linux Wireless Extension 22 vs Python WiFi. WE22 is the baseline 5 | to which Python WiFi must match-up, but Python WiFi may have some convenience 6 | features not in WE22. 7 | 8 | Python WiFi 9 | Feature WE22 Class Version Note 10 | --------------- ----- --------------- ------- -------------------- 11 | /proc devices yes iwlib 0.3.1 get wireless devices from /proc 12 | SIOCGIFCONF yes iwlib 0.3.1 get wireless devices via ioctl 13 | 14 | SIOCSIWCOMMIT yes Wireless send commit instruction 15 | SIOCGIWNAME yes Wireless 0.3.1 get wireless protocol 16 | SIOCSIWNWID yes not implemented set network id (pre-802.11) 17 | SIOCGIWNWID yes not implemented get network id (the cell) 18 | 19 | SIOCSIWFREQ yes Wireless set channel/frequency (Hz) 20 | SIOCGIWFREQ yes Wireless 0.3.1 get channel/frequency (Hz) 21 | all freqs Wireless 0.3.1 get all frequencies/channels 22 | device can handle 23 | 24 | SIOCSIWMODE yes Wireless 0.3.1 set operation mode 25 | SIOCGIWMODE yes Wireless 0.3.1 get operation mode 26 | SIOCSIWSENS yes not implemented set sensitivity (dBm) 27 | SIOCGIWSENS yes Wireless 0.3.1 get sensitivity (dBm) 28 | SIOCGIWRANGE yes Iwrange 0.3.1 get range of parameters 29 | SIOCGIWPRIV yes not implemented get private ioctl interface 30 | SIOCGIWSTATS yes Iwstats 0.3.1 get /proc/net/wireless stats 31 | SIOCSIWSPY yes not implemented set spy addresses 32 | SIOCGIWSPY yes not implemented get spy info (quality of link) 33 | SIOCSIWTHRSPY yes not implemented set spy threshold (spy event) 34 | SIOCGIWTHRSPY yes not implemented get spy threshold 35 | SIOCSIWAP yes Wireless set access point MAC addresses 36 | SIOCGIWAP yes Wireless 0.3.1 get access point MAC addresses 37 | SIOCSIWSCAN yes Iwscan 0.3.1 trigger scanning (list cells) 38 | SIOCGIWSCAN yes Iwscan 0.3.1 get scanning results 39 | SIOCSIWESSID yes Wireless 0.3.1 set ESSID (network name) 40 | SIOCGIWESSID yes Wireless 0.3.1 get ESSID 41 | SIOCSIWNICKN yes not implemented set node name/nickname 42 | SIOCGIWNICKN yes not implemented get node name/nickname 43 | 44 | SIOCSIWRATE yes not implemented set default bit rate (bps) 45 | SIOCGIWRATE yes Wireless 0.3.1 get default bit rate (bps) 46 | all bitrates Wireless 0.3.1 get all bitrates device 47 | can handle 48 | 49 | SIOCSIWRTS yes not implemented set RTS/CTS threshold (bytes) 50 | SIOCGIWRTS yes Wireless 0.3.1 get RTS/CTS threshold (bytes) 51 | SIOCSIWFRAG yes not implemented set fragmentation thr (bytes) 52 | SIOCGIWFRAG yes Wireless 0.3.1 get fragmentation thr (bytes) 53 | SIOCSIWTXPOW yes not implemented set transmit power (dBm) 54 | SIOCGIWTXPOW yes Wireless 0.3.1 get transmit power (dBm) 55 | SIOCSIWRETRY yes not implemented set retry limits and lifetime 56 | SIOCGIWRETRY yes Wireless 0.3.1 get retry limits and lifetime 57 | SIOCSIWENCODE yes Wireless set encoding token & mode 58 | SIOCGIWENCODE yes Wireless 0.3.1 get encoding token & mode 59 | SIOCSIWPOWER yes not implemented set Power Management settings 60 | SIOCGIWPOWER yes Wireless 0.3.1 get Power Management settings 61 | SIOCSIWMODUL yes not implemented set Modulations settings 62 | SIOCGIWMODUL yes not implemented get Modulations settings 63 | SIOCSIWGENIE yes not implemented set generic IE 64 | SIOCGIWGENIE yes not implemented get generic IE 65 | SIOCSIWMLME yes not implemented request MLME operation 66 | SIOCSIWAUTH yes not implemented set authentication mode params 67 | SIOCGIWAUTH yes not implemented get authentication mode params 68 | SIOCSIWENCODEEXT yes not implemented set encoding token & mode 69 | SIOCGIWENCODEEXT yes not implemented get encoding token & mode 70 | SIOCSIWPMKSA yes not implemented PMKSA cache operation 71 | 72 | 73 | -------------------------------------------------------------------------------- /docs/iwconfig.py.8: -------------------------------------------------------------------------------- 1 | .\" Author: Sean Robinson 2 | .\" iwconfig.py.8 3 | .\" 4 | .TH IWCONFIG.py 8 "16 December 2009" "Python WiFi" "Linux Programmer's Manual" 5 | .\" 6 | .\" NAME part 7 | .\" 8 | .SH NAME 9 | iwconfig.py \- configure a wireless network interface via Python 10 | .\" 11 | .\" SYNOPSIS part 12 | .\" 13 | .SH SYNOPSIS 14 | .BI "iwconfig.py [" interface ] 15 | .br 16 | .BI "iwconfig.py " interface " [essid " X "] [nwid " N "] [mode " M "] [freq " F "] 17 | .br 18 | .BI " [channel " C ] [sens " S "] [ap " A "] [nick " NN ] 19 | .br 20 | .BI " [rate " R "] [rts " RT "] [frag " FT "] [txpower " T ] 21 | .br 22 | .BI " [enc " E "] [key " K "] [power " P "] [retry " R ] 23 | .br 24 | .BI " [modu " M "] [commit] 25 | .br 26 | .BI "iwconfig.py --help" 27 | .br 28 | .BI "iwconfig.py --version" 29 | .\" 30 | .\" DESCRIPTION part 31 | .\" 32 | .SH DESCRIPTION 33 | .B iwconfig.py 34 | intends to be a drop-in replacement for 35 | .IR iwconfig (8), 36 | but uses the pythonwifi module to implement its functionality in pure Python. 37 | See the 38 | .IR iwconfig (8) 39 | man page for more detail about what 40 | .B iwconfig.py 41 | can do. 42 | .PP 43 | But, at this time, this program does not work well (if at all). 44 | .PP 45 | The compatitibilty of specific operations 46 | .B iwconfig.py 47 | has with 48 | .IR iwconfig (8) 49 | are listed below. 50 | .\" 51 | .\" COMPATIBILITY part 52 | .\" 53 | .SH COMPATIBILITY 54 | .TP 55 | .BR essid 56 | Not working. 57 | 58 | .TP 59 | .BR nwid 60 | Not working. 61 | 62 | .TP 63 | .BR nick [name] 64 | Not working. 65 | 66 | .TP 67 | .BR mode 68 | Not working. 69 | 70 | .TP 71 | .BR freq / channel 72 | Not working. 73 | 74 | .TP 75 | .BR ap 76 | Not working. 77 | 78 | .TP 79 | .BR rate / bit [rate] 80 | Not working. 81 | 82 | .TP 83 | .BR txpower 84 | Not working. 85 | 86 | .TP 87 | .BR sens 88 | Not working. 89 | 90 | .TP 91 | .BR retry 92 | Not working. 93 | 94 | .TP 95 | .BR rts [_threshold] 96 | Not working. 97 | 98 | .TP 99 | .BR frag [mentation_threshold] 100 | Not working. 101 | 102 | .TP 103 | .BR key / enc [ryption] 104 | Not working. 105 | 106 | .TP 107 | .BR power 108 | Not working. 109 | 110 | .TP 111 | .BR modu [lation] 112 | Not working. 113 | 114 | .TP 115 | .BR commit 116 | Not working. 117 | 118 | .\" 119 | .\" AUTHOR part 120 | .\" 121 | .SH AUTHOR 122 | Sean Robinson \- seankrobinson@gmail.com 123 | .\" 124 | .\" COPYRIGHT part 125 | .\" 126 | .SH COPYRIGHT 127 | Portions Copyright 1996-2006 Jean Tourrilhes 128 | .br 129 | Copyright 2004-2005 Roman Joost 130 | .br 131 | Copyright 2009 Sean Robinson 132 | .\" 133 | .\" FILES part 134 | .\" 135 | .SH FILES 136 | .I /proc/net/dev, 137 | .I /proc/net/wireless 138 | .\" 139 | .\" SEE ALSO part 140 | .\" 141 | .SH SEE ALSO 142 | .BR iwconfig (8), 143 | .BR iwlist.py (8), 144 | -------------------------------------------------------------------------------- /docs/iwlist.py.8: -------------------------------------------------------------------------------- 1 | .\" Author: Sean Robinson 2 | .\" iwlist.py.8 3 | .\" 4 | .TH IWLIST.py 8 "16 December 2009" "Python WiFi" "Linux Programmer's Manual" 5 | .\" 6 | .\" NAME part 7 | .\" 8 | .SH NAME 9 | iwlist.py \- Get more detailed wireless information from a wireless interface via Python 10 | .\" 11 | .\" SYNOPSIS part 12 | .\" 13 | .SH SYNOPSIS 14 | .BI "iwlist.py [" interface ] 15 | .br 16 | .BI "iwlist.py [" interface ] 17 | scanning 18 | .br 19 | .BI "iwlist.py [" interface ] 20 | frequency 21 | .br 22 | .BI "iwlist.py [" interface ] 23 | rate 24 | .br 25 | .BI "iwlist.py [" interface ] 26 | keys 27 | .br 28 | .BI "iwlist.py [" interface ] 29 | power 30 | .br 31 | .BI "iwlist.py [" interface ] 32 | txpower 33 | .br 34 | .BI "iwlist.py [" interface ] 35 | retry 36 | .br 37 | .BI "iwlist.py [" interface ] 38 | event 39 | .br 40 | .BI "iwlist.py [" interface ] 41 | auth 42 | .br 43 | .BI "iwlist.py [" interface ] 44 | wpakeys 45 | .br 46 | .BI "iwlist.py [" interface ] 47 | genie 48 | .br 49 | .BI "iwlist.py [" interface ] 50 | modulation 51 | .br 52 | .BI "iwlist.py --help" 53 | .br 54 | .BI "iwlist.py --version" 55 | .\" 56 | .\" DESCRIPTION part 57 | .\" 58 | .SH DESCRIPTION 59 | .B iwlist.py 60 | is a drop-in replacement for 61 | .IR iwlist (8), 62 | but uses the pythonwifi module to implement its functionality in pure Python. 63 | See the 64 | .IR iwlist (8) 65 | man page for more detail about what 66 | .B iwlist.py 67 | can do. 68 | .PP 69 | The compatitibilty of specific operations 70 | .B iwlist.py 71 | has with 72 | .IR iwlist (8) 73 | are listed below. 74 | .\" 75 | .\" COMPATIBILITY part 76 | .\" 77 | .SH COMPATIBILITY 78 | .TP 79 | .BR scanning 80 | 81 | Essentially the same as 82 | .IR iwlist (8), 83 | but with a possible different line order in the results and probably less 84 | information per AP. 85 | 86 | .TP 87 | .BR frequency 88 | 89 | Not working, but it should be. 90 | 91 | .TP 92 | .BR rate 93 | 94 | Probably as unreliable as 95 | .IR iwlist (8). 96 | 97 | .TP 98 | .BR keys 99 | 100 | Very close to the same output. 101 | 102 | .TP 103 | .BR power 104 | 105 | Close, but not well tested. 106 | 107 | .TP 108 | .BR txpower 109 | 110 | Not working. 111 | 112 | .TP 113 | .BR retry 114 | 115 | Very close to the same output. 116 | 117 | .TP 118 | .BR event 119 | 120 | Not working. 121 | 122 | .TP 123 | .BR auth 124 | 125 | Not working. 126 | 127 | .TP 128 | .BR wpakeys 129 | 130 | Not working. 131 | 132 | .TP 133 | .BR genie 134 | 135 | Not working. 136 | 137 | .TP 138 | .BR modulation 139 | 140 | Not working. 141 | 142 | .\" 143 | .\" AUTHOR part 144 | .\" 145 | .SH AUTHOR 146 | Sean Robinson \- seankrobinson@gmail.com 147 | .\" 148 | .\" COPYRIGHT part 149 | .\" 150 | .SH COPYRIGHT 151 | Portions Copyright 1996-2006 Jean Tourrilhes 152 | .br 153 | Copyright 2004-2005 Roman Joost 154 | .br 155 | Copyright 2009 Sean Robinson 156 | .\" 157 | .\" FILES part 158 | .\" 159 | .SH FILES 160 | .I /proc/net/dev, 161 | .I /proc/net/wireless 162 | .\" 163 | .\" SEE ALSO part 164 | .\" 165 | .SH SEE ALSO 166 | .BR iwlist (8), 167 | .BR iwconfig.py (8), 168 | -------------------------------------------------------------------------------- /docs/logos/pythonwifi-logo-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llazzaro/python3-wifi/f4b7511750d2354aa766745a73399ff069e81f52/docs/logos/pythonwifi-logo-16x16.png -------------------------------------------------------------------------------- /docs/logos/pythonwifi-logo-64x64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llazzaro/python3-wifi/f4b7511750d2354aa766745a73399ff069e81f52/docs/logos/pythonwifi-logo-64x64.png -------------------------------------------------------------------------------- /docs/logos/pythonwifi-logo-text.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llazzaro/python3-wifi/f4b7511750d2354aa766745a73399ff069e81f52/docs/logos/pythonwifi-logo-text.png -------------------------------------------------------------------------------- /docs/logos/pythonwifi-logo-text.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llazzaro/python3-wifi/f4b7511750d2354aa766745a73399ff069e81f52/docs/logos/pythonwifi-logo-text.xcf -------------------------------------------------------------------------------- /docs/logos/pythonwifi-logo.karbon: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llazzaro/python3-wifi/f4b7511750d2354aa766745a73399ff069e81f52/docs/logos/pythonwifi-logo.karbon -------------------------------------------------------------------------------- /docs/logos/pythonwifi-logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Python WiFi logo 6 | A modifed Python logo. One snake, green, with longer body and TV antennae. Copyight 2009 by Sean Robinson <seankrobinson@gmail.com>. Licensed under the Creative Commons Attribution License. 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /docs/pywifi.tpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llazzaro/python3-wifi/f4b7511750d2354aa766745a73399ff069e81f52/docs/pywifi.tpp -------------------------------------------------------------------------------- /docs/pywifi_english.tpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llazzaro/python3-wifi/f4b7511750d2354aa766745a73399ff069e81f52/docs/pywifi_english.tpp -------------------------------------------------------------------------------- /examples/iwconfig.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llazzaro/python3-wifi/f4b7511750d2354aa766745a73399ff069e81f52/examples/iwconfig.py -------------------------------------------------------------------------------- /examples/iwlist.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llazzaro/python3-wifi/f4b7511750d2354aa766745a73399ff069e81f52/examples/iwlist.py -------------------------------------------------------------------------------- /pythonwifi/__init__.py: -------------------------------------------------------------------------------- 1 | # make it a python package 2 | -------------------------------------------------------------------------------- /pythonwifi/flags.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llazzaro/python3-wifi/f4b7511750d2354aa766745a73399ff069e81f52/pythonwifi/flags.py -------------------------------------------------------------------------------- /pythonwifi/iwlibs.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llazzaro/python3-wifi/f4b7511750d2354aa766745a73399ff069e81f52/pythonwifi/iwlibs.py -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | from distutils.core import setup 3 | 4 | 5 | def get_version(): 6 | with open("docs/VERSION") as f: 7 | version=f.readline() 8 | return version[:-1] 9 | 10 | 11 | setup( 12 | name="python3-wifi", 13 | version=get_version(), 14 | author="Róman Joost", 15 | author_email="roman@bromeco.de", 16 | maintainer="Sean Robinson", 17 | maintainer_email="pythonwifi@lists.tuxfamily.org", 18 | description="""Python WiFi is a Python module that provides read and write access to a 19 | wireless network card's capabilities using the Linux Wireless Extensions.""", 20 | url="http://pythonwifi.tuxfamily.org/", 21 | packages=['pythonwifi'], 22 | 23 | data_files=[('', ['README']), 24 | ('examples', ['examples/iwlist.py', 'examples/iwconfig.py']), 25 | ('docs', ['docs/AUTHORS', 'docs/BUGS', 'docs/LICENSE.GPL', 26 | 'docs/LICENSE.LGPL', 'docs/NEWS', 'docs/ROADMAP', 27 | 'docs/TODO', 'docs/VERSION', 'docs/ChangeLog', 28 | 'docs/DEVEL.txt', 29 | 'docs/feature_matrix_iwconfig.py.txt', 30 | 'docs/feature_matrix_iwlist.py.txt', 31 | 'docs/feature_matrix_wireless_extensions.txt']), 32 | ('docs/logos', ['docs/logos/pythonwifi-logo.svg', 33 | 'docs/logos/pythonwifi-logo-16x16.png', 34 | 'docs/logos/pythonwifi-logo-64x64.png', 35 | 'docs/logos/pythonwifi-logo-text.png', 36 | 'docs/logos/pythonwifi-logo.karbon']), 37 | ('man/man8', ['docs/iwconfig.py.8', 'docs/iwlist.py.8'])], 38 | 39 | platforms="Linux", 40 | license="LGPL for module; GPL for example apps", 41 | keywords="wifi wireless wlan iwconfig iwlist iwtools", 42 | classifiers=[ 43 | 'Development Status :: 3 - Alpha', 44 | 'Environment :: Other Environment', 45 | 'Intended Audience :: Developers', 46 | 'License :: OSI Approved :: GNU General Public License (GPL)', 47 | 'License :: OSI Approved :: Lesser General Public License (LGPL)', 48 | 'Natural Language :: English', 49 | 'Operating System :: POSIX :: Linux', 50 | 'Programming Language :: Python', 51 | 'Topic :: System :: Networking', 52 | ], 53 | ) 54 | -------------------------------------------------------------------------------- /tests/README: -------------------------------------------------------------------------------- 1 | I wrote these tests to improve the quality of the libraries. Most of 2 | them are hardware dependend, so they may not work with your hardware and 3 | therefore fail. 4 | -------------------------------------------------------------------------------- /tests/output_diff.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # output_diff.sh - generate a meld for the output of the 4 | # C and Python versions of example code 5 | # 6 | # Copyright 2009 by Sean Robinson 7 | # 8 | # This file is part of Python WiFi 9 | # 10 | # This program is free software; you can redistribute it and/or modify 11 | # it under the terms of the GNU General Public License as published by 12 | # the Free Software Foundation; either version 2 of the License, or 13 | # (at your option) any later version. 14 | # 15 | # This program is distributed in the hope that it will be useful, 16 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | # GNU General Public License for more details. 19 | # 20 | # You should have received a copy of the GNU General Public License 21 | # along with this program; if not, write to the Free Software 22 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23 | # 24 | 25 | PYTHONWIFIBASEDIR=/home/sean/devel/python-wifi.dev 26 | 27 | case "$1" in 28 | 'iwlist') 29 | IWCOMMAND=iwlist 30 | PYCOMMAND=$PYTHONWIFIBASEDIR/examples/iwlist.py 31 | ;; 32 | 'iwconfig') 33 | IWCOMMAND=iwconfig 34 | PYCOMMAND=$PYTHONWIFIBASEDIR/examples/iwconfig.py 35 | ;; 36 | *) 37 | echo "Usage: output_diff.sh COMMAND INTERFACE SUBCOMMAND" 38 | echo " COMMAND is iwlist or iwconfig" 39 | echo " INTERFACE is the interface to use or - for none" 40 | echo " SUBCOMMAND is the COMMAND's parameter to use (e.g. scan for iwlist)" 41 | echo 42 | echo " (ex: output_diff.sh iwlist wlan0 channel)" 43 | exit 1 44 | ;; 45 | esac 46 | 47 | # if user passes hyphen for 2nd param, use no interface in command call 48 | if [ "$2" == "-" ]; then 49 | NIC="" 50 | else 51 | NIC=$2 52 | fi 53 | 54 | # if user passes hyphen for 3rd param, use no subcommand in command call 55 | if [ "$3" == "-" ]; then 56 | SUBCOMMAND="" 57 | else 58 | SUBCOMMAND=$3 59 | fi 60 | 61 | # create some temporary files to hold each programs output 62 | TMPFILE1=`mktemp -t diff-1-XXXXXX` 63 | TMPFILE2=`mktemp -t diff-2-XXXXXX` 64 | 65 | # remove the first three command line parameters 66 | shift 67 | shift 68 | shift 69 | 70 | # run commands and redirect output to temporary files 71 | $IWCOMMAND $NIC $SUBCOMMAND $@ > $TMPFILE1 2>&1 72 | $PYCOMMAND $NIC $SUBCOMMAND $@ > $TMPFILE2 2>&1 73 | 74 | # call meld to compare files 75 | meld -L $IWCOMMAND $TMPFILE1 -L $PYCOMMAND $TMPFILE2 76 | 77 | # remove the temporary files 78 | rm $TMPFILE1 $TMPFILE2 79 | 80 | -------------------------------------------------------------------------------- /tests/test_wireless.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Copyright 2004-2008 Roman Joost - Rotterdam, Netherlands 3 | # this file is part of the python-wifi package - a python wifi library 4 | # 5 | # This program is free software; you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation; either version 2 of the License, or 8 | # (at your option) any later version. 9 | # 10 | # This program is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program; if not, write to the Free Software 17 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | # 19 | import errno 20 | import unittest 21 | from pythonwifi.iwlibs import Wireless, getNICnames 22 | from pythonwifi.flags import IW_ENCODE_RESTRICTED 23 | 24 | 25 | class TestWireless(unittest.TestCase): 26 | 27 | def setUp(self): 28 | ifnames = getNICnames() 29 | self.wifi = Wireless(ifnames[0]) 30 | 31 | def test_wirelessMethods(self): 32 | # test all wireless methods that they don't return an error 33 | methods = ['getAPaddr', 34 | 'getBitrate', 35 | 'getBitrates', 36 | 'getChannelInfo', 37 | 'getEssid', 38 | 'getFragmentation', 39 | 'getFrequency', 40 | 'getMode', 41 | 'getNwids', 42 | 'getWirelessName', 43 | 'getPowermanagement', 44 | 'getQualityMax', 45 | 'getQualityAvg', 46 | 'getRetrylimit', 47 | 'getRTS', 48 | 'getSensitivity', 49 | 'getTXPower', 50 | 'getStatistics', 51 | 'commit'] 52 | 53 | for m in methods: 54 | getattr(self.wifi, m)() 55 | 56 | old_mode = self.wifi.getMode() 57 | self.wifi.setMode('Monitor') 58 | self.assert_(self.wifi.getMode() == 'Monitor') 59 | self.wifi.setMode(old_mode) 60 | 61 | old_essid = self.wifi.getEssid() 62 | self.wifi.setEssid('Joost') 63 | self.assert_(self.wifi.getEssid() == 'Joost') 64 | self.wifi.setEssid(old_essid) 65 | 66 | old_freq = self.wifi.getFrequency() 67 | self.wifi.setFrequency('2.462GHz') 68 | self.assert_(self.wifi.getFrequency() == '2.462GHz') 69 | self.wifi.setFrequency(old_freq) 70 | 71 | # test setAPaddr - does not work unless AP is real and available 72 | #old_mac = self.wifi.getAPaddr() 73 | #self.wifi.setAPaddr('61:62:63:64:65:66') 74 | #time.sleep(3) # 3 second delay between set and get required 75 | #self.assert_(self.wifi.getAPaddr() == '61:62:63:64:65:66') 76 | #self.wifi.setAPaddr(old_mac) 77 | 78 | old_enc = self.wifi.getEncryption() 79 | self.wifi.setEncryption('restricted') 80 | self.assert_(self.wifi.getEncryption() == 'restricted') 81 | self.assert_(self.wifi.getEncryption(symbolic=False) 82 | == IW_ENCODE_RESTRICTED + 1) 83 | self.wifi.setEncryption(old_enc) 84 | 85 | try: 86 | old_key = self.wifi.getKey() 87 | except ValueError: 88 | old_key = None 89 | self.wifi.setKey('ABCDEF1234', 1) 90 | self.assert_(self.wifi.getKey() == 'ABCD-EF12-34') 91 | self.assert_(map(hex, self.wifi.getKey(formatted=False)) 92 | == ['0xab', '0xcd', '0xef', '0x12', '0x34']) 93 | if old_key: 94 | self.wifi.setKey(old_key, 1) 95 | else: 96 | self.wifi.setEncryption('off') 97 | 98 | def test_wirelessWithNonWifiCard(self): 99 | self.wifi.ifname = 'eth0' 100 | methods = ['getAPaddr', 101 | 'getBitrate', 102 | 'getBitrates', 103 | 'getChannelInfo', 104 | 'getEssid', 105 | 'getFragmentation', 106 | 'getFrequency', 107 | 'getMode', 108 | 'getNwids', 109 | 'getWirelessName', 110 | 'getPowermanagement', 111 | 'getQualityMax', 112 | 'getQualityAvg', 113 | 'getRetrylimit', 114 | 'getRTS', 115 | 'getSensitivity', 116 | 'getTXPower', 117 | 'commit'] 118 | 119 | for m in methods: 120 | try: 121 | getattr(self.wifi, m)() 122 | except IOError, (error, msg): 123 | self.assertEquals(error, errno.EINVAL) 124 | 125 | try: 126 | self.wifi.getStatistics() 127 | except IOError, (error, msg): 128 | self.assertEquals(error, errno.EOPNOTSUPP) 129 | 130 | try: 131 | self.wifi.setMode('Monitor') 132 | except IOError, (error, msg): 133 | self.assertEquals(error, errno.EINVAL) 134 | 135 | try: 136 | self.wifi.setEssid('Joost') 137 | except IOError, (error, msg): 138 | self.assertEquals(error, errno.EINVAL) 139 | 140 | try: 141 | self.wifi.setFrequency('2.462GHz') 142 | except IOError, (error, msg): 143 | self.assertEquals(error, errno.EINVAL) 144 | 145 | try: 146 | self.wifi.setEncryption('restricted') 147 | except IOError, (error, msg): 148 | self.assertEquals(error, errno.EINVAL) 149 | 150 | try: 151 | self.wifi.setKey('ABCDEF1234', 1) 152 | except IOError, (error, msg): 153 | self.assertEquals(error, errno.EINVAL) 154 | 155 | def test_wirelessWithNonExistantCard(self): 156 | self.wifi.ifname = 'eth5' 157 | methods = ['getAPaddr', 158 | 'getBitrate', 159 | 'getBitrates', 160 | 'getChannelInfo', 161 | 'getEssid', 162 | 'getFragmentation', 163 | 'getFrequency', 164 | 'getMode', 165 | 'getNwids', 166 | 'getWirelessName', 167 | 'getPowermanagement', 168 | 'getQualityMax', 169 | 'getQualityAvg', 170 | 'getRetrylimit', 171 | 'getRTS', 172 | 'getSensitivity', 173 | 'getTXPower', 174 | 'commit'] 175 | 176 | for m in methods: 177 | try: 178 | getattr(self.wifi, m)() 179 | except IOError, (error, msg): 180 | self.assertEquals(error, errno.ENODEV) 181 | 182 | try: 183 | self.wifi.setMode('Monitor') 184 | except IOError, (error, msg): 185 | self.assertEquals(error, errno.ENODEV) 186 | 187 | try: 188 | self.wifi.setEssid('Joost') 189 | except IOError, (error, msg): 190 | self.assertEquals(error, errno.ENODEV) 191 | 192 | try: 193 | self.wifi.setFrequency('2.462GHz') 194 | except IOError, (error, msg): 195 | self.assertEquals(error, errno.ENODEV) 196 | 197 | try: 198 | self.wifi.setEncryption('restricted') 199 | except IOError, (error, msg): 200 | self.assertEquals(error, errno.ENODEV) 201 | 202 | try: 203 | self.wifi.setKey('ABCDEF1234', 1) 204 | except IOError, (error, msg): 205 | self.assertEquals(error, errno.ENODEV) 206 | 207 | 208 | suite = unittest.TestSuite() 209 | suite.addTest(unittest.makeSuite(TestWireless)) 210 | unittest.TextTestRunner(verbosity=2).run(suite) 211 | -------------------------------------------------------------------------------- /tests/test_wireless_doctest.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Copyright 2004-2008 Roman Joost - Rotterdam, Netherlands 3 | # this file is part of the python-wifi package - a python wifi library 4 | # 5 | # This program is free software; you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation; either version 2 of the License, or 8 | # (at your option) any later version. 9 | # 10 | # This program is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program; if not, write to the Free Software 17 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | # 19 | import doctest 20 | import iwlibs 21 | import pyiwconfig 22 | 23 | 24 | def _test_pyiwconfig(): 25 | return doctest.testmod(pyiwconfig) 26 | 27 | 28 | def _test_iwlibs(): 29 | return doctest.testmod(iwlibs) 30 | 31 | if __name__ == "__main__": 32 | _test_iwlibs() 33 | _test_pyiwconfig() 34 | --------------------------------------------------------------------------------