initial commit

This commit is contained in:
jkoschke
2022-08-26 12:49:14 +02:00
commit 4990667410
573 changed files with 29169 additions and 0 deletions

19
tests/index.js Normal file
View File

@ -0,0 +1,19 @@
var iwconfig = require('wireless-tools/iwconfig');
iwconfig.status(function (err, status) {
console.log('--- Iwconfig ---')
if (err) console.log("err:", err);
console.log("IWconfig status:", status);
});
var ifconfig = require('wireless-tools/ifconfig');
ifconfig.status(function (err, status) {
console.log('--- Ifconfig ---')
if (err) {
console.log('err:', err);
}
console.log('Ifconfig Status:', status);
});

16
tests/node_modules/.yarn-integrity generated vendored Normal file
View File

@ -0,0 +1,16 @@
{
"systemParams": "darwin-x64-93",
"modulesFolders": [
"node_modules"
],
"flags": [],
"linkedModules": [],
"topLevelPatterns": [
"wireless-tools@^0.19.0"
],
"lockfileEntries": {
"wireless-tools@^0.19.0": "https://registry.yarnpkg.com/wireless-tools/-/wireless-tools-0.19.0.tgz#67fb73cd371f2d9ba3b9ef253400a31f8c784b11"
},
"files": [],
"artifacts": {}
}

27
tests/node_modules/wireless-tools/.npmignore generated vendored Normal file
View File

@ -0,0 +1,27 @@
# Logs
logs
*.log
# Runtime data
pids
*.pid
*.seed
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# node-waf configuration
.lock-wscript
# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release
# Dependency directory
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
node_modules

6
tests/node_modules/wireless-tools/.travis.yml generated vendored Normal file
View File

@ -0,0 +1,6 @@
language: node_js
node_js: stable
sudo: false
after_success:
- npm run codeclimate

22
tests/node_modules/wireless-tools/LICENSE generated vendored Normal file
View File

@ -0,0 +1,22 @@
The MIT License (MIT)
Copyright (c) 2015 Christopher M. Baker
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

738
tests/node_modules/wireless-tools/README.md generated vendored Normal file
View File

@ -0,0 +1,738 @@
# Wireless tools for Node.js
[![npm version](https://badge.fury.io/js/wireless-tools.svg)](http://badge.fury.io/js/wireless-tools)
[![release version](https://img.shields.io/badge/version-0.19.0-blue.svg)](https://github.com/bakerface/wireless-tools)
[![build status](https://travis-ci.org/bakerface/wireless-tools.svg?branch=master)](https://travis-ci.org/bakerface/wireless-tools)
[![code climate](https://codeclimate.com/github/bakerface/wireless-tools/badges/gpa.svg)](https://codeclimate.com/github/bakerface/wireless-tools)
[![test coverage](https://codeclimate.com/github/bakerface/wireless-tools/badges/coverage.svg)](https://codeclimate.com/github/bakerface/wireless-tools/coverage)
[![github issues](https://img.shields.io/github/issues/bakerface/wireless-tools.svg)](https://github.com/bakerface/wireless-tools/issues)
[![dependencies](https://david-dm.org/bakerface/wireless-tools.svg)](https://david-dm.org/bakerface/wireless-tools)
[![dev dependencies](https://david-dm.org/bakerface/wireless-tools/dev-status.svg)](https://david-dm.org/bakerface/wireless-tools#info=devDependencies)
[![downloads](http://img.shields.io/npm/dm/wireless-tools.svg)](https://www.npmjs.com/package/wireless-tools)
## Table of Contents
- [hostapd](#hostapd) - configure an access point
- [hostapd.enable(options, callback)](#hostapdenableoptions-callback) - host an access point
- [hostapd.disable(interface, callback)](#hostapddisableinterface-callback) - stop hosting an access point
- [ifconfig](#ifconfig) - configure network interfaces
- [ifconfig.status(callback)](#ifconfigstatuscallback) - status of all network interfaces
- [ifconfig.status(interface, callback)](#ifconfigstatusinterface-callback) - status of a network interface
- [ifconfig.down(interface, callback)](#ifconfigdowninterface-callback) - take down a network interface
- [ifconfig.up(options, callback)](#ifconfigupoptions-callback) - bring up a network interface
- [iwconfig](#iwconfig) - configure wireless network interfaces
- [iwconfig.status(callback)](#iwconfigstatuscallback) - status of all wireless network interfaces
- [iwconfig.status(interface, callback)](#iwconfigstatusinterface-callback) - status of a wireless network interface
- [iwlist](#iwlist) - query wireless network interfaces
- [iwlist.scan(options, callback)](#iwlistscaninterface-callback) - scan for wireless networks
- [udhcpc](#udhcpc) - configure a dhcp client
- [udhcpc.enable(options, callback)](#udhcpcenableoptions-callback) - start a dhcp client
- [udhcpc.disable(interface, callback)](#udhcpcdisableinterface-callback) - stop a dhcp client
- [udhcpd](#udhcpd) - configure a dhcp server
- [udhcpd.enable(options, callback)](#udhcpdenableoptions-callback) - start a dhcp server
- [udhcpd.disable(interface, callback)](#udhcpddisableinterface-callback) - stop a dhcp server
- [wpa_cli](#wpa_cli) - send commands to wpa_supplicant using wpa_cli
- [wpa_cli.status(interface, callback)](#wpa_clistatusinterface-callback) - get status of wpa
- [wpa_cli.bssid(interface, ap, ssid, callback)](#wpa_clibssidinterface-ap-ssid-callback) - set preferred bssid for ssid
- [wpa_cli.reassociate(interface, callback)](#wpa_clireassociateinterface-callback) - tell wpa_supplicant to reassociate to an access points
- [wpa_cli.set(interface, variable, value, callback)](#wpa_clisetinterface-variable-value-callback) - set variable to value
- [wpa_cli.add_network(interface, callback)](#wpa_cliadd_networkinterface-callback) - add network
- [wpa_cli.set_network(interface, id, variable, value, callback)](#wpa_cliset_networkinterface-id-variable-value-callback) - set network variables
- [wpa_cli.enable_network(interface, id, callback)](#wpa_clienable_networkinterface-id-callback) - enable network
- [wpa_cli.disable_network(interface, id, callback)](#wpa_clidisable_networkinterface-id-callback) - disable network
- [wpa_cli.remove_network(interface, id, callback)](#wpa_cliremove_networkinterface-id-callback) - remove network
- [wpa_cli.select_network(interface, id, callback)](#wpa_cliselect_networkinterface-id-callback) - select network
- [wpa_cli.scan(interface, callback)](#wpa_cliscaninterface-callback) - new BSS scan
- [wpa_cli.scan_results(interface, callback)](#wpa_cliscan_resultsinterface-callback) - results of latest BSS scan
- [wpa_cli.save_config(interface, callback)](#wpa_clisave_configinterface-callback) - saves the current configuration
- [wpa_supplicant](#wpa_supplicant) - configure a wireless network connection
- [wpa_supplicant.enable(options, callback)](#wpa_supplicantenableoptions-callback) - connect to a wireless network
- [wpa_supplicant.disable(interface, callback)](#wpa_supplicantdisableinterface-callback) - disconnect from a wireless network
- [wpa_supplicant.manual(options, callback)](#wpa_supplicantmanualoptions-callback) - start wpa_supplicant in a way it can receive commands from wpa_cli
- [iw](#iw) - get and set parameters using `iw`, the interface for nl80211 interfaces
- [iw.scan(options, callback)](#iwscaninterface-callback) - scan for wireless networks
# hostapd
The **hostapd** command is used to configure wireless access points.
## hostapd.enable(options, callback)
The **hostapd enable** command is used to host an access point on a specific wireless interface.
``` javascript
var hostapd = require('wireless-tools/hostapd');
var options = {
channel: 6,
driver: 'rtl871xdrv',
hw_mode: 'g',
interface: 'wlan0',
ssid: 'RaspberryPi',
wpa: 2,
wpa_passphrase: 'raspberry'
};
hostapd.enable(options, function(err) {
// the access point was created
});
```
## hostapd.disable(interface, callback)
The **hostapd disable** command is used to stop hosting an access point on a specific wireless interface.
``` javascript
var hostapd = require('wireless-tools/hostapd');
hostapd.disable('wlan0', function(err) {
// no longer hosting the access point
});
```
# ifconfig
The **ifconfig** command is used to configure network interfaces.
## ifconfig.status(callback)
The **ifconfig status** command is used to query the status of all configured interfaces.
``` javascript
var ifconfig = require('wireless-tools/ifconfig');
ifconfig.status(function(err, status) {
console.log(status);
});
// =>
[
{
interface: 'eth0',
link: 'ethernet',
address: 'b8:27:eb:da:52:ad',
ipv4_address: '192.168.1.2',
ipv4_broadcast: '192.168.1.255',
ipv4_subnet_mask: '255.255.255.0',
up: true,
broadcast: true,
running: true,
multicast: true
},
{
interface: 'lo',
link: 'local',
ipv4_address: '127.0.0.1',
ipv4_subnet_mask: '255.0.0.0',
up: true,
running: true,
loopback: true
},
{
interface: 'wlan0',
link: 'ethernet',
address: '00:0b:81:95:12:21',
ipv4_address: '192.168.10.1',
ipv4_broadcast: '192.168.10.255',
ipv4_subnet_mask: '255.255.255.0',
up: true,
broadcast: true,
multicast: true
}
]
```
## ifconfig.status(interface, callback)
The **ifconfig interface status** command is used to query the status of a specific interface.
``` javascript
var ifconfig = require('wireless-tools/ifconfig');
ifconfig.status('eth0', function(err, status) {
console.log(status);
});
// =>
{
interface: 'eth0',
link: 'ethernet',
address: 'b8:27:eb:da:52:ad',
ipv4_address: '192.168.1.2',
ipv4_broadcast: '192.168.1.255',
ipv4_subnet_mask: '255.255.255.0',
up: true,
broadcast: true,
running: true,
multicast: true
}
```
## ifconfig.down(interface, callback)
The **ifconfig down** command is used to take down an interface that is up.
``` javascript
var ifconfig = require('wireless-tools/ifconfig');
ifconfig.down('wlan0', function(err) {
// the interface is down
});
```
## ifconfig.up(options, callback)
The **ifconfig up** command is used to bring up an interface with the specified configuration.
``` javascript
var ifconfig = require('wireless-tools/ifconfig');
var options = {
interface: 'wlan0',
ipv4_address: '192.168.10.1',
ipv4_broadcast: '192.168.10.255',
ipv4_subnet_mask: '255.255.255.0'
};
ifconfig.up(options, function(err) {
// the interface is up
});
```
# iwconfig
The **iwconfig** command is used to configure wireless network interfaces.
## iwconfig.status(callback)
The **iwconfig status** command is used to query the status of all configured wireless interfaces.
``` javascript
var iwconfig = require('wireless-tools/iwconfig');
iwconfig.status(function(err, status) {
console.log(status);
});
// =>
[
{
interface: 'wlan0',
access_point: '00:0b:81:95:12:21',
frequency: 2.437,
ieee: '802.11bg',
mode: 'master',
noise: 0,
quality: 77,
sensitivity: 0,
signal: 50,
ssid: 'RaspberryPi'
},
{
interface: 'wlan1',
frequency: 2.412,
mode: 'auto',
noise: 0,
quality: 0,
sensitivity: 0,
signal: 0,
unassociated: true
}
]
```
## iwconfig.status(interface, callback)
The **iwconfig interface status** command is used to query the status of a specific wireless interface.
``` javascript
var iwconfig = require('wireless-tools/iwconfig');
iwconfig.status('wlan0', function(err, status) {
console.log(status);
});
// =>
{
interface: 'wlan0',
access_point: '00:0b:81:95:12:21',
frequency: 2.437,
ieee: '802.11bg',
mode: 'master',
noise: 0,
quality: 77,
sensitivity: 0,
signal: 50,
ssid: 'RaspberryPi'
}
```
# iwlist
The **iwlist** command is used to get detailed information from a wireless interface.
## iwlist.scan(interface, callback)
The **iwlist scan** command is used to scan for wireless networks visible to a wireless interface. For convenience, the networks are sorted by signal strength.
``` javascript
var iwlist = require('wireless-tools/iwlist');
iwlist.scan('wlan0', function(err, networks) {
console.log(networks);
});
iwlist.scan({ iface : 'wlan0', show_hidden : true }, function(err, networks) {
console.log(networks);
});
// =>
[
{
address: '00:0b:81:ab:14:22',
ssid: 'BlueberryPi',
mode: 'master',
frequency: 2.437,
channel: 6,
security: 'wpa',
quality: 48,
signal: 87
},
{
address: '00:0b:81:95:12:21',
ssid: 'RaspberryPi',
mode: 'master',
frequency: 2.437,
channel: 6,
security: 'wpa2',
quality: 58,
signal: 83
},
{
address: '00:0b:81:cd:f2:04',
ssid: 'BlackberryPi',
mode: 'master',
frequency: 2.437,
channel: 6,
security: 'wep',
quality: 48,
signal: 80
},
{
address: '00:0b:81:fd:42:14',
ssid: 'CranberryPi',
mode: 'master',
frequency: 2.437,
channel: 6,
security: 'open',
quality: 32,
signal: 71
}
]
[
{
address: '00:0b:81:ab:14:22',
ssid: 'BlueberryPi',
mode: 'master',
frequency: 2.437,
channel: 6,
security: 'wpa',
quality: 48,
signal: 87
},
{
address: '00:0b:81:95:12:21',
ssid: 'RaspberryPi',
mode: 'master',
frequency: 2.437,
channel: 6,
security: 'wpa2',
quality: 58,
signal: 83
},
{
address: '00:0b:81:cd:f2:04',
ssid: 'BlackberryPi',
mode: 'master',
frequency: 2.437,
channel: 6,
security: 'wep',
quality: 48,
signal: 80
},
{
address: '00:0b:81:fd:42:14',
ssid: 'CranberryPi',
mode: 'master',
frequency: 2.437,
channel: 6,
security: 'open',
quality: 32,
signal: 71
},
{
address: '2c:c5:d3:02:ae:4c',
channel: 100,
frequency: 5.5,
mode: 'master',
quality: 66,
signal: -44,
security: 'wpa2'
}
]
```
# udhcpc
The **udhcpc** command is used to configure a dhcp client for a network interface.
## udhcpc.enable(options, callback)
The **udhcpc enable** command is used to start a dhcp client on a specific network interface.
``` javascript
var udhcpc = require('wireless-tools/udhcpc');
var options = {
interface: 'wlan0'
};
udhcpc.enable(options, function(err) {
// the dhcp client was started
});
```
## udhcpc.disable(interface, callback)
The **udhcpc disable** command is used to stop a dhcp client on a specific network interface.
``` javascript
var udhcpc = require('wireless-tools/udhcpc');
udhcpc.disable('wlan0', function(err) {
// the dhcp client was stopped
});
```
# udhcpd
The **udhcpd** command is used to configure a dhcp server for a network interface.
## udhcpd.enable(options, callback)
The **udhcpd enable** command is used to start a dhcp server on a specific network interface.
``` javascript
var udhcpd = require('wireless-tools/udhcpd');
var options = {
interface: 'wlan0',
start: '192.168.10.100',
end: '192.168.10.200',
option: {
router: '192.168.10.1',
subnet: '255.255.255.0',
dns: [ '4.4.4.4', '8.8.8.8' ]
}
};
udhcpd.enable(options, function(err) {
// the dhcp server was started
});
```
## udhcpd.disable(interface, callback)
The **udhcpd disable** command is used to stop a dhcp server on a specific network interface.
``` javascript
var udhcpd = require('wireless-tools/udhcpd');
udhcpd.disable('wlan0', function(err) {
// the dhcp server was stopped
});
```
# wpa_cli
The **wpa_cli** command is used to setup what wpa_supplicant must do to connect to a wireless network connection for a network interface.
Most of wpa_cli commands return either 'OK' or 'FAIL' (and the exit status is
always 0). Because of this, all 'FAIL' responses will return and callback with an error.
Responses containing an 'OK' result only means than wpa_supplicant had received
the command. You must poll wpa_supplicant (or other commands like iwconfig) to be sure that the command was actually applied by wpa_supplicant.
## wpa_cli.status(interface, callback)
The **wpa_cli status** command is used to get the current status of wpa_supplicant on a specific network interface.
``` javascript
var wpa_cli = require('wireless-tools/wpa_cli');
wpa_cli.status('wlan0', function(err, status) {
console.dir(status);
});
```
``` javascript
// =>
{
bssid: '2c:f5:d3:02:ea:d9',
frequency: 2412,
mode: 'station',
key_mgmt: 'wpa2-psk',
ssid: 'Fake-Wifi',
pairwise_cipher: 'CCMP',
group_cipher: 'CCMP',
p2p_device_address: 'e4:28:9c:a8:53:72',
wpa_state: 'COMPLETED',
ip: '10.34.141.168',
mac: 'e4:28:9c:a8:53:72',
uuid: 'e1cda789-8c88-53e8-ffff-31c304580c1e',
id: 0
}
```
## wpa_cli.bssid(interface, ap, ssid, callback)
The **wpa_cli bssid** command is used to set the preferred access points for an specific ssid on a specific network interface.
``` javascript
var wpa_cli = require('wireless-tools/wpa_cli');
wpa_cli.bssid('wlan0', '2c:f5:d3:02:ea:dd', 'Fake-Wifi', function(err, data){
// this is correct usage
console.dir(data);
});
```
## wpa_cli.reassociate(interface, callback)
The **wpa_cli reassociate** command is used to instruct wpa_supplicant to reassociate to access points for an SSID on a specific network interface.
``` javascript
var wpa_cli = require('wireless-tools/wpa_cli');
wpa_cli.bssid('wlan0', 'Fake-Wifi', '2c:f5:d3:02:ea:dd', function(err, data){
// our usage is wrong so an error is triggered
if (err) {
console.dir(err);
// attempt to reassociate
wpa_cli.reassociate('wlan0', function(err, data) {
console.dir(data);
});
}
});
```
## wpa_cli.set(interface, variable, value, callback)
The **wpa_cli set** command is used to set wpa_supplicant parameters to a value on a specific network interface.
## wpa_cli.add_network(interface, callback)
The **wpa_cli add_network** command is used to create a new network entry on a specific network interface.
It will return on success the id of the new network
## wpa_cli.set_network(interface, id, variable, value, callback)
The **wpa_cli set_network** command is used to set variables for a network on a specific network interface.
## wpa_cli.enable_network(interface, id, callback)
The **wpa_cli enable_network** command is used to enable a network on a specific network interface.
## wpa_cli.disable_network(interface, id, callback)
The **wpa_cli disable_network** command is used to disable a network on a specific network interface.
## wpa_cli.remove_network(interface, id, callback)
The **wpa_cli remove_network** command is used to remove a network on a specific network interface.
## wpa_cli.select_network(interface, id, callback)
The **wpa_cli select_network** command is used to select a specific network on a specific network interface and
disable all others.
``` javascript
var wpa_cli = require('wireless-tools/wpa_cli');
wpa_cli.select_network('wlan0', 0, function(err, data){
if (err) {
// most likely the set values for the specified id are wrong
console.dir(err);
} else {
// successfully connected to the new network
console.dir(data);
}
});
```
## wpa_cli.scan(interface, callback)
The **wpa_cli scan** is used to request a new BSS scan on a specific network interface.
## wpa_cli.scan_results(interface, callback)
The **wpa_cli scan_results** is used to return the results of the latest BSS scan
that was run on a specific network interface.
``` javascript
var wpa_cli = require('wireless-tools/wpa_cli');
wpa_cli.scan('wlan0', function(err, data){
wpa_cli.scan_results('wlan0', function(err, data) {
// returns the results of the BSS scan once it completes
console.dir(data);
}
});
```
``` javascript
=>
[
{
bssid: '2c:f5:d3:02:ea:d9',
frequency: 2472,
signalLevel: -31,
flags: '[WPA-PSK-CCMP+TKIP][WPA2-PSK-CCMP+TKIP][ESS]',
ssid: 'FakeWifi'
},
{
bssid: '2c:f5:d3:02:ea:d9',
frequency: 2472,
signalLevel: -31,
flags: '[WPA-PSK-CCMP+TKIP][WPA2-PSK-CCMP+TKIP][ESS]',
ssid: 'FakeWifi2'
}
]
```
## wpa_cli.save_config(interface, callback)
The **wpa_cli save_config** command is used to save the current wpa_cli configuration for the specific network interface.
``` javascript
var wpa_cli = require('wireless-tools/wpa_cli');
wpa_cli.save_config('wlan0', function(err, data){
// current wpa_cli configuration is saved
});
```
# wpa_supplicant
The **wpa_supplicant** command is used to configure a wireless network connection for a network interface.
## wpa_supplicant.enable(options, callback)
The **wpa_supplicant enable** command is used to join a wireless network on a specific network interface.
``` javascript
var wpa_supplicant = require('wireless-tools/wpa_supplicant');
var options = {
interface: 'wlan0',
ssid: 'RaspberryPi',
passphrase: 'raspberry',
driver: 'wext'
};
wpa_supplicant.enable(options, function(err) {
// connected to the wireless network
});
```
## wpa_supplicant.disable(interface, callback)
The **wpa_supplicant disable** command is used to disconnect from a wireless network on a specific network interface.
``` javascript
var wpa_supplicant = require('wireless-tools/wpa_supplicant');
wpa_supplicant.disable('wlan0', function(err) {
// disconnected from wireless network
});
```
## wpa_supplicant.manual(options, callback)
The **wpa_supplicant manual** command is used to launch wpa_supplicant on a specific network interface.
``` javascript
var wpa_supplicant = require('wireless-tools/wpa_supplicant');
var options = {
interface: 'wlan0',
drivers: [ 'nl80211', 'wext' ]
};
wpa_supplicant.manual(options, function(err) {
// wpa_supplicant launched on wlan0 interface (can be setup using wpa_cli)
});
```
# iw
The **iw** command is used to get and set detailed information from an nl80211 wireless interface.
## iw.scan(interface, callback)
The **iw scan** command is used to scan for wireless networks visible to a wireless interface. For convenience, the networks are sorted by signal strength.
``` javascript
var iw = require('wireless-tools/iw');
iw.scan('wlan0', function(err, networks) {
console.log(networks);
});
iw.scan({ iface : 'wlan0', show_hidden : true }, function(err, networks) {
console.log(networks);
});
// =>
[
{
address: '00:0b:81:ab:14:22',
frequency: 2422,
signal: -80,
lastSeenMs: 0,
ssid: 'BlueberryPi',
channel: 3,
security: 'wpa'
},
{
address: '00:0b:81:95:12:21',
frequency: 5825,
signal: -83,
lastSeenMs: 2031,
ssid: 'RaspberryPi',
channel: 165,
security: 'wpa2'
},
{
address: '00:0b:81:cd:f2:04',
frequency: 2437,
signal: -88,
lastSeenMs: 0,
ssid: 'BlackberryPi',
channel: 6,
security: 'wep'
},
{
address: '00:0b:81:fd:42:14',
frequency: 2412,
signal: -92,
lastSeenMs: 0,
ssid: 'CranberryPi',
channel: 1,
security: 'open'
}
]
[
{
address: '00:0b:81:ab:14:22',
frequency: 2422,
signal: -80,
lastSeenMs: 0,
ssid: 'BlueberryPi',
channel: 3,
security: 'wpa'
},
{
address: '00:0b:81:95:12:21',
frequency: 5825,
signal: -83,
lastSeenMs: 2031,
ssid: 'RaspberryPi',
channel: 165,
security: 'wpa2'
},
{
address: '00:0b:81:cd:f2:04',
frequency: 2437,
signal: -88,
lastSeenMs: 0,
ssid: 'BlackberryPi',
channel: 6,
security: 'wep'
},
{
address: '00:0b:81:fd:42:14',
frequency: 2412,
signal: -92,
lastSeenMs: 0,
ssid: 'CranberryPi',
channel: 1,
security: 'open'
},
{
address: '00:0b:81:fd:42:01',
frequency: 2412,
signal: -94,
lastSeenMs: 1069,
channel: 1,
security: 'open'
}
]
```

4
tests/node_modules/wireless-tools/bump-version generated vendored Executable file
View File

@ -0,0 +1,4 @@
#!/bin/sh
sed -i '' 's/"version": ".*"/"version": "'$1'"/g' package.json
sed -i '' 's/version-.*-blue.svg/version-'$1'-blue.svg/g' README.md

104
tests/node_modules/wireless-tools/hostapd.js generated vendored Normal file
View File

@ -0,0 +1,104 @@
/*
* Copyright (c) 2015 Christopher M. Baker
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
var child_process = require('child_process');
/**
* The **hostpad** command is used to configure wireless access points.
*
* @static
* @category hostapd
*
*/
var hostapd = module.exports = {
exec: child_process.exec,
disable: disable,
enable: enable
};
/**
* The **hostpad disable** command is used to stop hosting an access point
* on a specific wireless interface.
*
* @static
* @category hostapd
* @param {string} interface The network interface of the access point.
* @param {function} callback The callback function.
* @returns {process} The child process.
* @example
*
* var hostapd = require('wireless-tools/hostapd');
*
* hostapd.disable('wlan0', function(err) {
* // no longer hosting the access point
* });
*
*/
function disable(interface, callback) {
var file = interface + '-hostapd.conf';
return this.exec('kill `pgrep -f "^hostapd -B ' + file + '"` || true',
callback);
}
/**
* The **hostpad enable** command is used to host an access point
* on a specific wireless interface.
*
* @static
* @category hostapd
* @param {object} options The access point configuration.
* @param {function} callback The callback function.
* @returns {process} The child process.
* @example
*
* var hostapd = require('wireless-tools/hostapd');
*
* var options = {
* channel: 6,
* driver: 'rtl871xdrv',
* hw_mode: 'g',
* interface: 'wlan0',
* ssid: 'RaspberryPi',
* wpa: 2,
* wpa_passphrase: 'raspberry'
* };
*
* hostapd.enable(options, function(err) {
* // the access point was created
* });
*
*/
function enable(options, callback) {
var file = options.interface + '-hostapd.conf';
var commands = [
'cat <<EOF >' + file + ' && hostapd -B ' + file + ' && rm -f ' + file
];
Object.getOwnPropertyNames(options).forEach(function(key) {
commands.push(key + '=' + options[key]);
});
return this.exec(commands.join('\n'), callback);
}

249
tests/node_modules/wireless-tools/ifconfig.js generated vendored Normal file
View File

@ -0,0 +1,249 @@
/*
* Copyright (c) 2015 Christopher M. Baker
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
var child_process = require('child_process');
/**
* The **ifconfig** command is used to configure network interfaces.
*
* @static
* @category ifconfig
*
*/
var ifconfig = module.exports = {
exec: child_process.exec,
status: status,
down: down,
up: up
};
/**
* Parses the status for a single network interface.
*
* @private
* @static
* @category ifconfig
* @param {string} block The section of stdout for the interface.
* @returns {object} The parsed network interface status.
*
*/
function parse_status_block(block) {
var match;
var parsed = {
interface: block.match(/^([^\s]+)/)[1]
};
if ((match = block.match(/Link encap:\s*([^\s]+)/))) {
parsed.link = match[1].toLowerCase();
}
if ((match = block.match(/HWaddr\s+([^\s]+)/))) {
parsed.address = match[1].toLowerCase();
}
if ((match = block.match(/inet6\s+addr:\s*([^\s]+)/))) {
parsed.ipv6_address = match[1];
}
if ((match = block.match(/inet\s+addr:\s*([^\s]+)/))) {
parsed.ipv4_address = match[1];
}
if ((match = block.match(/Bcast:\s*([^\s]+)/))) {
parsed.ipv4_broadcast = match[1];
}
if ((match = block.match(/Mask:\s*([^\s]+)/))) {
parsed.ipv4_subnet_mask = match[1];
}
if ((match = block.match(/UP/))) {
parsed.up = true;
}
if ((match = block.match(/BROADCAST/))) {
parsed.broadcast = true;
}
if ((match = block.match(/RUNNING/))) {
parsed.running = true;
}
if ((match = block.match(/MULTICAST/))) {
parsed.multicast = true;
}
if ((match = block.match(/LOOPBACK/))) {
parsed.loopback = true;
}
return parsed;
}
/**
* Parses the status for all network interfaces.
*
* @private
* @static
* @category ifconfig
* @param {function} callback The callback function.
*
*/
function parse_status(callback) {
return function(error, stdout, stderr) {
if (error) callback(error);
else callback(error,
stdout.trim().split('\n\n').map(parse_status_block));
};
}
/**
* Parses the status for a single network interface.
*
* @private
* @static
* @category ifconfig
* @param {function} callback The callback function.
*
*/
function parse_status_interface(callback) {
return function(error, stdout, stderr) {
if (error) callback(error);
else callback(error, parse_status_block(stdout.trim()));
};
}
/**
* The **ifconfig status** command is used to query the status of all
* configured interfaces.
*
* @static
* @category ifconfig
* @param {string} [interface] The network interface.
* @param {function} callback The callback function.
* @example
*
* var ifconfig = require('wireless-tools/ifconfig');
*
* ifconfig.status(function(err, status) {
* console.log(status);
* });
*
* // =>
* [
* {
* interface: 'eth0',
* link: 'ethernet',
* address: 'b8:27:eb:da:52:ad',
* ipv4_address: '192.168.1.2',
* ipv4_broadcast: '192.168.1.255',
* ipv4_subnet_mask: '255.255.255.0',
* up: true,
* broadcast: true,
* running: true,
* multicast: true
* },
* {
* interface: 'lo',
* link: 'local',
* ipv4_address: '127.0.0.1',
* ipv4_subnet_mask: '255.0.0.0',
* up: true,
* running: true,
* loopback: true
* },
* {
* interface: 'wlan0',
* link: 'ethernet',
* address: '00:0b:81:95:12:21',
* ipv4_address: '192.168.10.1',
* ipv4_broadcast: '192.168.10.255',
* ipv4_subnet_mask: '255.255.255.0',
* up: true,
* broadcast: true,
* multicast: true
* }
* ]
*
*/
function status(interface, callback) {
if (callback) {
this.exec('ifconfig ' + interface, parse_status_interface(callback));
}
else {
this.exec('ifconfig -a', parse_status(interface));
}
}
/**
* The **ifconfig down** command is used to take down an interface that is up.
*
* @static
* @category ifconfig
* @param {string} interface The network interface.
* @param {function} callback The callback function.
* @returns {process} The child process.
* @example
*
* var ifconfig = require('wireless-tools/ifconfig');
*
* ifconfig.down('wlan0', function(err) {
* // the interface is down
* });
*
*/
function down(interface, callback) {
return this.exec('ifconfig ' + interface + ' down', callback);
}
/**
* The **ifconfig up** command is used to bring up an interface with the
* specified configuration.
*
* @static
* @category ifconfig
* @param {object} options The interface configuration.
* @param {function} callback The callback function.
* @returns {process} The child process.
* @example
*
* var options = {
* interface: 'wlan0',
* ipv4_address: '192.168.10.1',
* ipv4_broadcast: '192.168.10.255',
* ipv4_subnet_mask: '255.255.255.0'
* };
*
* ifconfig.up(options, function(err) {
* // the interface is up
* });
*
*/
function up(options, callback) {
return this.exec('ifconfig ' + options.interface +
' ' + options.ipv4_address +
' netmask ' + options.ipv4_subnet_mask +
' broadcast ' + options.ipv4_broadcast +
' up', callback);
}

192
tests/node_modules/wireless-tools/iw.js generated vendored Normal file
View File

@ -0,0 +1,192 @@
/*
* Copyright (c) 2015 Christopher M. Baker
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
var child_process = require('child_process');
/**
* The **iw** command is used to control nl80211 radios.
*
* @static
* @category iw
*
*/
var iw = module.exports = {
exec: child_process.exec,
scan: scan
};
/**
* Returns a truthy if the network has an ssid; falsy otherwise.
*
* @private
* @static
* @category iw
* @param {object} network The scanned network object.
* @returns {string} The ssid.
*
*/
function has_ssid(network) {
return network.ssid;
}
/**
* Returns a truthy if the network has any key; falsy otherwise.
*
* @private
* @static
* @category iw
* @param {object} network The scanned network object.
* @returns {boolean} True if any key.
*
*/
function has_keys(network) {
return Object.keys(network).length !== 0;
}
/**
* A comparison function to sort networks ordered by signal strength.
*
* @private
* @static
* @category iw
* @param {object} a A scanned network object.
* @param {object} b Another scanned network object.
* @returns {number} The comparison value.
*
*/
function by_signal(a, b) {
return b.signal - a.signal;
}
/**
* Parses a scanned wireless network cell.
*
* @private
* @static
* @category iw
* @param {string} cell The section of stdout for the cell.
* @returns {object} The scanned network object.
*
*/
function parse_cell(cell) {
var parsed = { };
var match;
if ((match = cell.match(/BSS ([0-9A-Fa-f:-]{17})\(on/))) {
parsed.address = match[1].toLowerCase();
}
if ((match = cell.match(/freq: ([0-9]+)/))) {
parsed.frequency = parseInt(match[1], 10);
}
if ((match = cell.match(/signal: (-?[0-9.]+) dBm/))) {
parsed.signal = parseFloat(match[1]);
}
if ((match = cell.match(/last seen: ([0-9]+) ms ago/))) {
parsed.lastSeenMs = parseInt(match[1], 10);
}
if ((match = cell.match(/SSID: \\x00/))) {
delete parsed.ssid;
}
else if ((match = cell.match(/SSID: ([^\n]*)/))) {
parsed.ssid = match[1];
}
if ((match = cell.match(/DS Parameter set: channel ([0-9]+)/))) {
parsed.channel = parseInt(match[1], 10);
}
else if ((match = cell.match(/\* primary channel: ([0-9]+)/))) {
parsed.channel = parseInt(match[1], 10);
}
if ((match = cell.match(/RSN:[\s*]+Version: 1/))) {
parsed.security = 'wpa2';
}
else if ((match = cell.match(/WPA:[\s*]+Version: 1/))) {
parsed.security = 'wpa';
}
else if ((match = cell.match(/capability: ESS Privacy/))) {
parsed.security = 'wep';
}
else if ((match = cell.match(/capability: ESS/))) {
parsed.security = 'open';
}
return parsed;
}
/**
* Parses all scanned wireless network cells.
*
* @private
* @static
* @category iw
* @param {function} callback The callback function.
*
*/
function parse_scan(show_hidden, callback) {
return function(error, stdout, stderr) {
if (error) callback(error);
else
if (show_hidden) {
callback(error, stdout
.split(/(^|\n)(?=BSS )/)
.map(parse_cell)
.filter(has_keys)
.sort(by_signal));
} else {
callback(error, stdout
.split(/(^|\n)(?=BSS )/)
.map(parse_cell)
.filter(has_ssid)
.sort(by_signal));
}
};
}
/**
* The **iw scan** command is used to scan for wireless networks
* visible to a wireless interface. For convenience, the networks are
* sorted by signal strength.
*
* @static
* @category iw
* @param {string} interface The wireless network interface.
* @param {function} callback The callback function.
*/
function scan(options, callback) {
var interface, show_hidden
if (typeof options === 'string') {
var interface = options;
var show_hidden = false;
} else {
var interface = options.iface;
var show_hidden = options.show_hidden || false;
}
this.exec('iw dev ' + interface + ' scan', parse_scan(show_hidden, callback));
}

185
tests/node_modules/wireless-tools/iwconfig.js generated vendored Normal file
View File

@ -0,0 +1,185 @@
/*
* Copyright (c) 2015 Christopher M. Baker
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
var child_process = require('child_process');
/**
* The **iwconfig** command is used to configure wireless network interfaces.
*
* @private
* @category iwconfig
*
*/
var iwconfig = module.exports = {
exec: child_process.exec,
status: status
};
/**
* Parses the status for a single wireless network interface.
*
* @private
* @static
* @category iwconfig
* @param {string} block The section of stdout for the interface.
* @returns {object} The parsed wireless network interface status.
*
*/
function parse_status_block(block) {
var match;
// Skip out of the block is invalid
if (!block) return;
var parsed = {
interface: block.match(/^([^\s]+)/)[1]
};
if ((match = block.match(/Access Point:\s*([A-Fa-f0-9:]{17})/))) {
parsed.access_point = match[1].toLowerCase();
}
if ((match = block.match(/Frequency[:|=]\s*([0-9\.]+)/))) {
parsed.frequency = parseFloat(match[1]);
}
if ((match = block.match(/IEEE\s*([^\s]+)/))) {
parsed.ieee = match[1].toLowerCase();
}
if ((match = block.match(/Mode[:|=]\s*([^\s]+)/))) {
parsed.mode = match[1].toLowerCase();
}
if ((match = block.match(/Noise level[:|=]\s*(-?[0-9]+)/))) {
parsed.noise = parseInt(match[1], 10);
}
if ((match = block.match(/Link Quality[:|=]\s*([0-9]+)/))) {
parsed.quality = parseInt(match[1], 10);
}
if ((match = block.match(/Sensitivity[:|=]\s*([0-9]+)/))) {
parsed.sensitivity = parseInt(match[1], 10);
}
if ((match = block.match(/Signal level[:|=]\s*(-?[0-9]+)/))) {
parsed.signal = parseInt(match[1], 10);
}
if ((match = block.match(/ESSID[:|=]\s*"([^"]+)"/))) {
parsed.ssid = match[1];
}
if ((match = block.match(/unassociated/))) {
parsed.unassociated = true;
}
return parsed;
}
/**
* Parses the status for all wireless network interfaces.
*
* @private
* @static
* @category iwconfig
* @param {function} callback The callback function.
*
*/
function parse_status(callback) {
return function(error, stdout, stderr) {
if (error) callback(error);
else callback(error,
stdout.trim().split('\n\n').map(parse_status_block).filter(function(i) { return !! i }));
};
}
/**
* Parses the status for a single wireless network interface.
*
* @private
* @static
* @category iwconfig
* @param {function} callback The callback function.
*
*/
function parse_status_interface(callback) {
return function(error, stdout, stderr) {
if (error) callback(error);
else callback(error, parse_status_block(stdout.trim()));
};
}
/**
* Parses the status for a single wireless network interface.
*
* @private
* @static
* @category iwconfig
* @param {string} [interface] The wireless network interface.
* @param {function} callback The callback function.
* @example
*
* var iwconfig = require('wireless-tools/iwconfig');
*
* iwconfig.status(function(err, status) {
* console.log(status);
* });
*
* // =>
* [
* {
* interface: 'wlan0',
* access_point: '00:0b:81:95:12:21',
* frequency: 2.437,
* ieee: '802.11bg',
* mode: 'master',
* noise: 0,
* quality: 77,
* sensitivity: 0,
* signal: 50,
* ssid: 'RaspberryPi'
* },
* {
* interface: 'wlan1',
* frequency: 2.412,
* mode: 'auto',
* noise: 0,
* quality: 0,
* sensitivity: 0,
* signal: 0,
* unassociated: true
* }
* ]
*
*/
function status(interface, callback) {
if (callback) {
return this.exec('iwconfig ' + interface,
parse_status_interface(callback));
}
else {
return this.exec('iwconfig', parse_status(interface));
}
}

310
tests/node_modules/wireless-tools/iwlist.js generated vendored Normal file
View File

@ -0,0 +1,310 @@
/*
* Copyright (c) 2015 Christopher M. Baker
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
var child_process = require('child_process');
/**
* The **iwlist** command is used to get detailed information from a
* wireless interface.
*
* @static
* @category iwlist
*
*/
var iwlist = module.exports = {
exec: child_process.exec,
scan: scan
};
/**
* Returns a truthy if the network has an ssid; falsy otherwise.
*
* @private
* @static
* @category iwlist
* @param {object} network The scanned network object.
* @returns {string} The ssid.
*
*/
function has_ssid(network) {
return network.ssid;
}
/**
* Returns a truthy if the network has any key; falsy otherwise.
*
* @private
* @static
* @category iwlist
* @param {object} network The scanned network object.
* @returns {boolean} True if any key.
*
*/
function has_keys(network) {
return Object.keys(network).length !== 0;
}
/**
* A comparison function to sort networks ordered by signal strength.
*
* @private
* @static
* @category iwlist
* @param {object} a A scanned network object.
* @param {object} b Another scanned network object.
* @returns {number} The comparison value.
*
*/
function by_signal(a, b) {
return b.signal - a.signal;
}
/**
* Parses a scanned wireless network cell.
*
* @private
* @static
* @category iwlist
* @param {string} cell The section of stdout for the cell.
* @returns {object} The scanned network object.
*
*/
function parse_cell(cell) {
var parsed = { };
var match;
if ((match = cell.match(/Address\s*[:|=]\s*([A-Fa-f0-9:]{17})/))) {
parsed.address = match[1].toLowerCase();
}
if ((match = cell.match(/Channel\s*([0-9]+)/))) {
parsed.channel = parseInt(match[1], 10);
}
if ((match = cell.match(/Frequency\s*[:|=]\s*([0-9\.]+)\s*GHz/))) {
parsed.frequency = parseFloat(match[1]);
}
if ((match = cell.match(/Mode\s*[:|=]\s*([^\s]+)/))) {
parsed.mode = match[1].toLowerCase();
}
if ((match = cell.match(/Quality\s*[:|=]\s*([0-9]+)/))) {
parsed.quality = parseInt(match[1], 10);
}
if ((match = cell.match(/Signal level\s*[:|=]\s*(-?[0-9]+)/))) {
parsed.signal = parseInt(match[1], 10);
}
if ((match = cell.match(/Noise level\s*[:|=]\s*(-?[0-9]+)/))) {
parsed.noise = parseInt(match[1], 10);
}
if ((match = cell.match(/ESSID\s*[:|=]\s*"([^"]+)"/))) {
parsed.ssid = match[1];
}
if ((match = cell.match(/WPA2\s+Version/))) {
parsed.security = 'wpa2';
}
else if ((match = cell.match(/WPA\s+Version/))) {
parsed.security = 'wpa';
}
else if ((match = cell.match(/Encryption key\s*[:|=]\s*on/))) {
parsed.security = 'wep';
}
else if ((match = cell.match(/Encryption key\s*[:|=]\s*off/))) {
parsed.security = 'open';
}
return parsed;
}
/**
* Parses all scanned wireless network cells.
*
* @private
* @static
* @category iwlist
* @param {function} callback The callback function.
*
*/
function parse_scan(show_hidden, callback) {
return function(error, stdout, stderr) {
if (error) callback(error);
else
if (show_hidden) {
callback(error, stdout
.split(/Cell [0-9]+ -/)
.map(parse_cell)
.filter(has_keys)
.sort(by_signal));
} else {
callback(error, stdout
.split(/Cell [0-9]+ -/)
.map(parse_cell)
.filter(has_ssid)
.sort(by_signal));
}
};
}
/**
* The **iwlist scan** command is used to scan for wireless networks
* visible to a wireless interface. For convenience, the networks are
* sorted by signal strength.
*
* @static
* @category iwlist
* @param {string} interface The wireless network interface.
* @param {function} callback The callback function.
* @example
*
* var iwlist = require('wireless-tools/iwlist');
*
* iwlist.scan('wlan0', function(err, networks) {
* console.log(networks);
* });
*
* iwlist.scan({ iface : 'wlan0', show_hidden: true }, function(err, networks) {
* console.log(networks);
* });
*
* // =>
* [
* {
* address: '00:0b:81:ab:14:22',
* ssid: 'BlueberryPi',
* mode: 'master',
* frequency: 2.437,
* channel: 6,
* security: 'wpa',
* quality: 48,
* signal: 87
* },
* {
* address: '00:0b:81:95:12:21',
* ssid: 'RaspberryPi',
* mode: 'master',
* frequency: 2.437,
* channel: 6,
* security: 'wpa2',
* quality: 58,
* signal: 83
* },
* {
* address: '00:0b:81:cd:f2:04',
* ssid: 'BlackberryPi',
* mode: 'master',
* frequency: 2.437,
* channel: 6,
* security: 'wep',
* quality: 48,
* signal: 80
* },
* {
* address: '00:0b:81:fd:42:14',
* ssid: 'CranberryPi',
* mode: 'master',
* frequency: 2.437,
* channel: 6,
* security: 'open',
* quality: 32,
* signal: 71
* }
* ]
*
* [
* {
* address: '00:0b:81:ab:14:22',
* ssid: 'BlueberryPi',
* mode: 'master',
* frequency: 2.437,
* channel: 6,
* security: 'wpa',
* quality: 48,
* signal: 87
* },
* {
* address: '00:0b:81:95:12:21',
* ssid: 'RaspberryPi',
* mode: 'master',
* frequency: 2.437,
* channel: 6,
* security: 'wpa2',
* quality: 58,
* signal: 83
* },
* {
* address: '00:0b:81:cd:f2:04',
* ssid: 'BlackberryPi',
* mode: 'master',
* frequency: 2.437,
* channel: 6,
* security: 'wep',
* quality: 48,
* signal: 80
* },
* {
* address: '00:0b:81:fd:42:14',
* ssid: 'CranberryPi',
* mode: 'master',
* frequency: 2.437,
* channel: 6,
* security: 'open',
* quality: 32,
* signal: 71
* },
* {
* address: '2c:c5:d3:02:ae:4c',
* channel: 100,
* frequency: 5.5,
* mode: 'master',
* quality: 66,
* signal: -44,
* security: 'wpa2'
* }
* ]
*
*/
function scan(options, callback) {
var interface, show_hidden
if (typeof options === 'string') {
var interface = options;
var show_hidden = false;
} else {
var interface = options.iface;
var show_hidden = options.show_hidden || false;
}
var extra_params = '';
if (options.ssid) {
extra_params = ' essid ' + options.ssid;
}
this.exec('iwlist ' + interface + ' scan' + extra_params, parse_scan(show_hidden, callback));
}

55
tests/node_modules/wireless-tools/package.json generated vendored Normal file
View File

@ -0,0 +1,55 @@
{
"name": "wireless-tools",
"version": "0.19.0",
"description": "Wireless tools for Node.js",
"author": "Christopher M. Baker",
"license": "MIT",
"homepage": "https://github.com/bakerface/wireless-tools",
"main": "wireless-tools.js",
"keywords": [
"wireless",
"tools",
"hostapd",
"ifconfig",
"iwconfig",
"iwlist",
"iw",
"udhcpc",
"udhcpd",
"wpa_supplicant"
],
"repository": {
"type": "git",
"url": "https://github.com/bakerface/wireless-tools.git"
},
"bugs": {
"url": "https://github.com/bakerface/wireless-tools/issues"
},
"scripts": {
"test": "istanbul cover node_modules/.bin/_mocha",
"posttest": "istanbul check-coverage --statements 100 --functions 100 --branches 100 --lines 100",
"codeclimate": "codeclimate-test-reporter < coverage/lcov.info"
},
"xo": {
"space": true
},
"devDependencies": {
"codeclimate-test-reporter": "^0.3.1",
"istanbul": "^0.4.3",
"mocha": "^2.5.3",
"should": "^9.0.2",
"xo": "^0.16.0"
},
"contributors": [
{
"name": "Athom",
"email": "support@athom.com",
"url": "https://www.athom.com/en/"
},
{
"name": "Wink",
"email": "support@wink.com",
"url": "https://www.wink.com/"
}
]
}

108
tests/node_modules/wireless-tools/test/hostapd.js generated vendored Normal file
View File

@ -0,0 +1,108 @@
/*
* Copyright (c) 2015 Christopher M. Baker
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
var should = require('should');
var hostapd = require('../hostapd');
describe('hostapd', function() {
describe('hostapd.disable(options, callback)', function() {
it('should stop the daemons', function(done) {
hostapd.exec = function(command, callback) {
should(command).eql(
'kill `pgrep -f "^hostapd -B wlan0-hostapd.conf"` || true');
callback(null, '', '');
};
hostapd.disable('wlan0', function(err) {
should(err).not.be.ok;
done();
});
})
it('should handle errors', function(done) {
hostapd.exec = function(command, callback) {
callback('error');
};
hostapd.disable('wlan0', function(err) {
should(err).eql('error');
done();
});
})
})
describe('hostapd.enable(options, callback)', function() {
it('should start the daemon', function(done) {
hostapd.exec = function(command, callback) {
should(command).eql('cat <<EOF >wlan0-hostapd.conf' +
' && hostapd -B wlan0-hostapd.conf' +
' && rm -f wlan0-hostapd.conf\n' +
'channel=6\n' +
'driver=rtl871xdrv\n' +
'hw_mode=g\n' +
'interface=wlan0\n' +
'ssid=RaspberryPi\n' +
'wpa=2\n' +
'wpa_passphrase=raspberry');
callback(null, '', '');
};
var options = {
channel: 6,
driver: 'rtl871xdrv',
hw_mode: 'g',
interface: 'wlan0',
ssid: 'RaspberryPi',
wpa: 2,
wpa_passphrase: 'raspberry'
};
hostapd.enable(options, function(err) {
should(err).not.be.ok;
done();
});
})
it('should handle errors', function(done) {
hostapd.exec = function(command, callback) {
callback('error');
};
var options = {
channel: 6,
driver: 'rtl871xdrv',
hw_mode: 'g',
interface: 'wlan0',
ssid: 'RaspberryPi',
wpa: 2,
wpa_passphrase: 'raspberry'
};
hostapd.enable(options, function(err) {
should(err).eql('error');
done();
});
})
})
})

201
tests/node_modules/wireless-tools/test/ifconfig.js generated vendored Normal file
View File

@ -0,0 +1,201 @@
/*
* Copyright (c) 2015 Christopher M. Baker
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
var should = require('should');
var ifconfig = require('../ifconfig');
var IFCONFIG_STATUS_LINUX = [
'eth0 Link encap:Ethernet HWaddr DE:AD:BE:EF:C0:DE',
' inet addr:192.168.1.2 Bcast:192.168.1.255 Mask:255.255.255.0',
' UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1',
' RX packets:114919 errors:0 dropped:10 overruns:0 frame:0',
' TX packets:117935 errors:0 dropped:0 overruns:0 carrier:0',
' collisions:0 txqueuelen:1000',
' RX bytes:28178397 (26.8 MiB) TX bytes:23423409 (22.3 MiB)',
'',
'lo Link encap:Local Loopbacks',
' inet addr:127.0.0.1 Mask:255.0.0.0',
' UP LOOPBACK RUNNING MTU:65536 Metric:1',
' RX packets:0 errors:0 dropped:0 overruns:0 frame:0',
' TX packets:0 errors:0 dropped:0 overruns:0 carrier:0',
' collisions:0 txqueuelen:0',
' RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)'
].join('\n');
var IFCONFIG_STATUS_INTERFACE_LINUX = [
'wlan0 HWaddr DE:AD:BE:EF:C0:DE',
' inet6 addr:fe80::21c:c0ff:feae:b5e6/64 Scope:Link',
' MTU:1500 Metric:1',
' RX packets:0 errors:0 dropped:0 overruns:0 frame:0',
' TX packets:0 errors:0 dropped:0 overruns:0 carrier:0',
' collisions:0 txqueuelen:1000',
' RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)'
].join('\n');
describe('ifconfig', function() {
describe('ifconfig.status(callback)', function() {
it('should get the status for each interface', function(done) {
ifconfig.exec = function(command, callback) {
should(command).eql('ifconfig -a');
callback(null, IFCONFIG_STATUS_LINUX, '');
};
ifconfig.status(function(err, status) {
should(status).eql([
{
interface: 'eth0',
link: 'ethernet',
address: 'de:ad:be:ef:c0:de',
ipv4_address: '192.168.1.2',
ipv4_broadcast: '192.168.1.255',
ipv4_subnet_mask: '255.255.255.0',
up: true,
broadcast: true,
running: true,
multicast: true
},
{
interface: 'lo',
link: 'local',
ipv4_address: '127.0.0.1',
ipv4_subnet_mask: '255.0.0.0',
up: true,
loopback: true,
running: true
}
]);
done();
});
})
it('should handle errors', function(done) {
ifconfig.exec = function(command, callback) {
callback('error');
};
ifconfig.status(function(err, status) {
should(err).eql('error');
done();
});
})
})
describe('ifconfig.status(interface, callback)', function() {
it('should get the status for the specified interface', function(done) {
ifconfig.exec = function(command, callback) {
should(command).eql('ifconfig wlan0');
callback(null, IFCONFIG_STATUS_INTERFACE_LINUX, '');
};
ifconfig.status('wlan0', function(err, status) {
should(status).eql({
interface: 'wlan0',
address: 'de:ad:be:ef:c0:de',
ipv6_address: 'fe80::21c:c0ff:feae:b5e6/64'
});
done();
});
})
it('should handle errors', function(done) {
ifconfig.exec = function(command, callback) {
callback('error');
};
ifconfig.status('wlan0', function(err, status) {
should(err).eql('error');
done();
});
})
})
describe('ifconfig.down(interface, callback)', function() {
it('should take down the interface', function(done) {
ifconfig.exec = function(command, callback) {
should(command).eql('ifconfig wlan0 down');
callback(null, '', '');
};
ifconfig.down('wlan0', function(err) {
should(err).not.be.ok;
done();
});
})
it('should handle errors', function(done) {
ifconfig.exec = function(command, callback) {
callback('error');
};
ifconfig.down('wlan0', function(err) {
should(err).eql('error');
done();
});
})
})
describe('ifconfig.up(options, callback)', function() {
it('should bring up the interface', function(done) {
ifconfig.exec = function(command, callback) {
should(command).eql('ifconfig wlan0 192.168.10.1' +
' netmask 255.255.255.0 broadcast 192.168.10.255 up');
callback(null, '', '');
};
var options = {
interface: 'wlan0',
ipv4_address: '192.168.10.1',
ipv4_broadcast: '192.168.10.255',
ipv4_subnet_mask: '255.255.255.0'
};
ifconfig.up(options, function(err) {
should(err).not.be.ok;
done();
});
})
it('should handle errors', function(done) {
ifconfig.exec = function(command, callback) {
callback('error');
};
var options = {
interface: 'wlan0',
ipv4_address: '192.168.10.1',
ipv4_broadcast: '192.168.10.255',
ipv4_subnet_mask: '255.255.255.0'
};
ifconfig.down(options, function(err) {
should(err).eql('error');
done();
});
})
})
})

860
tests/node_modules/wireless-tools/test/iw.js generated vendored Normal file
View File

@ -0,0 +1,860 @@
/*
* Copyright (c) 2015 Christopher M. Baker
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
var should = require('should');
var iw = require('../iw');
var IW_SCAN_LINUX = "BSS 14:91:82:c7:76:b9(on wlan0)\n" +
" TSF: 337644127 usec (0d, 00:05:37)\n" +
" freq: 2412\n" +
" beacon interval: 100 TUs\n" +
" capability: ESS Privacy ShortSlotTime (0x0411)\n" +
" signal: -87.00 dBm\n" +
" last seen: 0 ms ago\n" +
" Information elements from Probe Response frame:\n" +
" SSID: creamcorn\n" +
" Supported rates: 1.0* 2.0* 5.5* 11.0* 22.0 6.0 9.0 12.0 \n" +
" DS Parameter set: channel 1\n" +
" TIM: DTIM Count 0 DTIM Period 2 Bitmap Control 0x0 Bitmap[0] 0x0\n" +
" ERP: <no flags>\n" +
" Extended supported rates: 18.0 24.0 36.0 48.0 54.0 \n" +
" RSN: * Version: 1\n" +
" * Group cipher: CCMP\n" +
" * Pairwise ciphers: CCMP\n" +
" * Authentication suites: PSK\n" +
" * Capabilities: 16-PTKSA-RC 1-GTKSA-RC (0x000c)\n" +
" HT capabilities:\n" +
" Capabilities: 0x6f\n" +
" RX LDPC\n" +
" HT20/HT40\n" +
" SM Power Save disabled\n" +
" RX HT20 SGI\n" +
" RX HT40 SGI\n" +
" No RX STBC\n" +
" Max AMSDU length: 3839 bytes\n" +
" No DSSS/CCK HT40\n" +
" Maximum RX AMPDU length 65535 bytes (exponent: 0x003)\n" +
" Minimum RX AMPDU time spacing: 4 usec (0x05)\n" +
" HT TX/RX MCS rate indexes supported: 0-23, 32\n" +
" HT operation:\n" +
" * primary channel: 1\n" +
" * secondary channel offset: no secondary\n" +
" * STA channel width: 20 MHz\n" +
" * RIFS: 0\n" +
" * HT protection: nonmember\n" +
" * non-GF present: 0\n" +
" * OBSS non-GF present: 1\n" +
" * dual beacon: 0\n" +
" * dual CTS protection: 0\n" +
" * STBC beacon: 0\n" +
" * L-SIG TXOP Prot: 0\n" +
" * PCO active: 0\n" +
" * PCO phase: 0\n" +
" Extended capabilities: 6\n" +
" VHT capabilities:\n" +
" VHT Capabilities (0x33801831):\n" +
" Max MPDU length: 7991\n" +
" Supported Channel Width: neither 160 nor 80+80\n" +
" RX LDPC\n" +
" short GI (80 MHz)\n" +
" SU Beamformer\n" +
" SU Beamformee\n" +
" RX antenna pattern consistency\n" +
" TX antenna pattern consistency\n" +
" VHT RX MCS set:\n" +
" 1 streams: MCS 0-9\n" +
" 2 streams: MCS 0-9\n" +
" 3 streams: MCS 0-9\n" +
" 4 streams: not supported\n" +
" 5 streams: not supported\n" +
" 6 streams: not supported\n" +
" 7 streams: not supported\n" +
" 8 streams: not supported\n" +
" VHT RX highest supported: 0 Mbps\n" +
" VHT TX MCS set:\n" +
" 1 streams: MCS 0-9\n" +
" 2 streams: MCS 0-9\n" +
" 3 streams: MCS 0-9\n" +
" 4 streams: not supported\n" +
" 5 streams: not supported\n" +
" 6 streams: not supported\n" +
" 7 streams: not supported\n" +
" 8 streams: not supported\n" +
" VHT TX highest supported: 0 Mbps\n" +
" VHT operation:\n" +
" * channel width: 0 (20 or 40 MHz)\n" +
" * center freq segment 1: 0\n" +
" * center freq segment 2: 0\n" +
" * VHT basic MCS set: 0xfffc\n" +
" WMM: * Parameter version 1\n" +
" * BE: CW 15-1023, AIFSN 3, TXOP 2048 usec\n" +
" * BK: CW 15-1023, AIFSN 7\n" +
" * VI: CW 7-15, AIFSN 2, TXOP 3008 usec\n" +
" * VO: CW 3-7, AIFSN 2, TXOP 1504 usec\n" +
"BSS f4:0f:1b:b5:5b:4d(on wlan0)\n" +
" TSF: 337645123 usec (0d, 00:05:37)\n" +
" freq: 5260\n" +
" beacon interval: 102 TUs\n" +
" capability: ESS Privacy RadioMeasure (0x1011)\n" +
" signal: -59.00 dBm\n" +
" last seen: 4530 ms ago\n" +
" Information elements from Probe Response frame:\n" +
" SSID: Wink-Visitor\n" +
" Supported rates: 6.0* 9.0 12.0* 18.0 24.0* 36.0 48.0 54.0 \n" +
" Country: US Environment: Indoor/Outdoor\n" +
" Channels [36 - 48] @ 17 dBm\n" +
" Channels [52 - 64] @ 24 dBm\n" +
" Channels [100 - 116] @ 24 dBm\n" +
" Channels [132 - 140] @ 24 dBm\n" +
" Channels [149 - 165] @ 30 dBm\n" +
" BSS Load:\n" +
" * station count: 14\n" +
" * channel utilisation: 16/255\n" +
" * available admission capacity: 23437 [*32us]\n" +
" HT capabilities:\n" +
" Capabilities: 0x19ac\n" +
" HT20\n" +
" SM Power Save disabled\n" +
" RX HT20 SGI\n" +
" TX STBC\n" +
" RX STBC 1-stream\n" +
" Max AMSDU length: 7935 bytes\n" +
" DSSS/CCK HT40\n" +
" Maximum RX AMPDU length 65535 bytes (exponent: 0x003)\n" +
" Minimum RX AMPDU time spacing: 8 usec (0x06)\n" +
" HT RX MCS rate indexes supported: 0-23\n" +
" HT TX MCS rate indexes are undefined\n" +
" HT operation:\n" +
" * primary channel: 52\n" +
" * secondary channel offset: no secondary\n" +
" * STA channel width: 20 MHz\n" +
" * RIFS: 1\n" +
" * HT protection: no\n" +
" * non-GF present: 1\n" +
" * OBSS non-GF present: 0\n" +
" * dual beacon: 0\n" +
" * dual CTS protection: 0\n" +
" * STBC beacon: 0\n" +
" * L-SIG TXOP Prot: 0\n" +
" * PCO active: 0\n" +
" * PCO phase: 0\n" +
" Extended capabilities: Proxy ARP Service, WNM-Notification, 6\n" +
" VHT capabilities:\n" +
" VHT Capabilities (0x0f8379b2):\n" +
" Max MPDU length: 11454\n" +
" Supported Channel Width: neither 160 nor 80+80\n" +
" RX LDPC\n" +
" short GI (80 MHz)\n" +
" TX STBC\n" +
" SU Beamformer\n" +
" SU Beamformee\n" +
" VHT RX MCS set:\n" +
" 1 streams: MCS 0-9\n" +
" 2 streams: MCS 0-9\n" +
" 3 streams: MCS 0-9\n" +
" 4 streams: not supported\n" +
" 5 streams: not supported\n" +
" 6 streams: not supported\n" +
" 7 streams: not supported\n" +
" 8 streams: not supported\n" +
" VHT RX highest supported: 0 Mbps\n" +
" VHT TX MCS set:\n" +
" 1 streams: MCS 0-9\n" +
" 2 streams: MCS 0-9\n" +
" 3 streams: MCS 0-9\n" +
" 4 streams: not supported\n" +
" 5 streams: not supported\n" +
" 6 streams: not supported\n" +
" 7 streams: not supported\n" +
" 8 streams: not supported\n" +
" VHT TX highest supported: 0 Mbps\n" +
" VHT operation:\n" +
" * channel width: 0 (20 or 40 MHz)\n" +
" * center freq segment 1: 0\n" +
" * center freq segment 2: 0\n" +
" * VHT basic MCS set: 0x0000\n" +
" WPA: * Version: 1\n" +
" * Group cipher: CCMP\n" +
" * Pairwise ciphers: CCMP\n" +
" * Authentication suites: PSK\n" +
" * Capabilities: 1-PTKSA-RC 1-GTKSA-RC (0x0000)\n" +
" WMM: * Parameter version 1\n" +
" * u-APSD\n" +
" * BE: CW 15-1023, AIFSN 3\n" +
" * BK: CW 15-1023, AIFSN 7\n" +
" * VI: CW 7-15, AIFSN 2, TXOP 3008 usec\n" +
" * VO: CW 3-7, AIFSN 2, TXOP 1504 usec\n" +
"BSS f4:0f:1b:b5:5b:4e(on wlan0)\n" +
" TSF: 337645151 usec (0d, 00:05:37)\n" +
" freq: 5260\n" +
" beacon interval: 102 TUs\n" +
" capability: ESS RadioMeasure (0x1001)\n" +
" signal: -59.00 dBm\n" +
" last seen: 4530 ms ago\n" +
" Information elements from Probe Response frame:\n" +
" SSID: Flex-Visitor\n" +
" Supported rates: 6.0* 9.0 12.0* 18.0 24.0* 36.0 48.0 54.0 \n" +
" Country: US Environment: Indoor/Outdoor\n" +
" Channels [36 - 48] @ 17 dBm\n" +
" Channels [52 - 64] @ 24 dBm\n" +
" Channels [100 - 116] @ 24 dBm\n" +
" Channels [132 - 140] @ 24 dBm\n" +
" Channels [149 - 165] @ 30 dBm\n" +
" BSS Load:\n" +
" * station count: 14\n" +
" * channel utilisation: 16/255\n" +
" * available admission capacity: 23437 [*32us]\n" +
" HT capabilities:\n" +
" Capabilities: 0x19ac\n" +
" HT20\n" +
" SM Power Save disabled\n" +
" RX HT20 SGI\n" +
" TX STBC\n" +
" RX STBC 1-stream\n" +
" Max AMSDU length: 7935 bytes\n" +
" DSSS/CCK HT40\n" +
" Maximum RX AMPDU length 65535 bytes (exponent: 0x003)\n" +
" Minimum RX AMPDU time spacing: 8 usec (0x06)\n" +
" HT RX MCS rate indexes supported: 0-23\n" +
" HT TX MCS rate indexes are undefined\n" +
" HT operation:\n" +
" * primary channel: 52\n" +
" * secondary channel offset: no secondary\n" +
" * STA channel width: 20 MHz\n" +
" * RIFS: 1\n" +
" * HT protection: no\n" +
" * non-GF present: 1\n" +
" * OBSS non-GF present: 0\n" +
" * dual beacon: 0\n" +
" * dual CTS protection: 0\n" +
" * STBC beacon: 0\n" +
" * L-SIG TXOP Prot: 0\n" +
" * PCO active: 0\n" +
" * PCO phase: 0\n" +
" Extended capabilities: Proxy ARP Service, WNM-Notification, 6\n" +
" VHT capabilities:\n" +
" VHT Capabilities (0x0f8379b2):\n" +
" Max MPDU length: 11454\n" +
" Supported Channel Width: neither 160 nor 80+80\n" +
" RX LDPC\n" +
" short GI (80 MHz)\n" +
" TX STBC\n" +
" SU Beamformer\n" +
" SU Beamformee\n" +
" VHT RX MCS set:\n" +
" 1 streams: MCS 0-9\n" +
" 2 streams: MCS 0-9\n" +
" 3 streams: MCS 0-9\n" +
" 4 streams: not supported\n" +
" 5 streams: not supported\n" +
" 6 streams: not supported\n" +
" 7 streams: not supported\n" +
" 8 streams: not supported\n" +
" VHT RX highest supported: 0 Mbps\n" +
" VHT TX MCS set:\n" +
" 1 streams: MCS 0-9\n" +
" 2 streams: MCS 0-9\n" +
" 3 streams: MCS 0-9\n" +
" 4 streams: not supported\n" +
" 5 streams: not supported\n" +
" 6 streams: not supported\n" +
" 7 streams: not supported\n" +
" 8 streams: not supported\n" +
" VHT TX highest supported: 0 Mbps\n" +
" VHT operation:\n" +
" * channel width: 0 (20 or 40 MHz)\n" +
" * center freq segment 1: 0\n" +
" * center freq segment 2: 0\n" +
" * VHT basic MCS set: 0x0000\n" +
" WMM: * Parameter version 1\n" +
" * u-APSD\n" +
" * BE: CW 15-1023, AIFSN 3\n" +
" * BK: CW 15-1023, AIFSN 7\n" +
" * VI: CW 7-15, AIFSN 2, TXOP 3008 usec\n" +
" * VO: CW 3-7, AIFSN 2, TXOP 1504 usec\n" +
"BSS 6c:70:9f:e7:d8:b3(on wlan0)\n" +
" TSF: 337644811 usec (0d, 00:05:37)\n" +
" freq: 5180\n" +
" beacon interval: 100 TUs\n" +
" capability: ESS Privacy SpectrumMgmt RadioMeasure (0x1111)\n" +
" signal: -77.00 dBm\n" +
" last seen: 2110 ms ago\n" +
" Information elements from Probe Response frame:\n" +
" SSID: QA Lab 5GHz\n" +
" Supported rates: 6.0* 9.0 12.0* 18.0 24.0* 36.0 48.0 54.0 \n" +
" Country: US Environment: Indoor/Outdoor\n" +
" Channels [36 - 36] @ 17 dBm\n" +
" Channels [40 - 40] @ 17 dBm\n" +
" Channels [44 - 44] @ 17 dBm\n" +
" Channels [48 - 48] @ 17 dBm\n" +
" Channels [52 - 52] @ 24 dBm\n" +
" Channels [56 - 56] @ 24 dBm\n" +
" Channels [60 - 60] @ 24 dBm\n" +
" Channels [64 - 64] @ 24 dBm\n" +
" Channels [100 - 100] @ 24 dBm\n" +
" Channels [104 - 104] @ 24 dBm\n" +
" Channels [108 - 108] @ 24 dBm\n" +
" Channels [112 - 112] @ 24 dBm\n" +
" Channels [116 - 116] @ 24 dBm\n" +
" Channels [132 - 132] @ 24 dBm\n" +
" Channels [136 - 136] @ 24 dBm\n" +
" Channels [140 - 140] @ 24 dBm\n" +
" Channels [144 - 144] @ 24 dBm\n" +
" Channels [149 - 149] @ 30 dBm\n" +
" Channels [153 - 153] @ 30 dBm\n" +
" Channels [157 - 157] @ 30 dBm\n" +
" Channels [161 - 161] @ 30 dBm\n" +
" Channels [165 - 165] @ 30 dBm\n" +
" Power constraint: 0 dB\n" +
" TPC report: TX power: 17 dBm\n" +
" RSN: * Version: 1\n" +
" * Group cipher: CCMP\n" +
" * Pairwise ciphers: CCMP\n" +
" * Authentication suites: PSK\n" +
" * Capabilities: 1-PTKSA-RC 1-GTKSA-RC (0x0000)\n" +
" HT capabilities:\n" +
" Capabilities: 0x9ef\n" +
" RX LDPC\n" +
" HT20/HT40\n" +
" SM Power Save disabled\n" +
" RX HT20 SGI\n" +
" RX HT40 SGI\n" +
" TX STBC\n" +
" RX STBC 1-stream\n" +
" Max AMSDU length: 7935 bytes\n" +
" No DSSS/CCK HT40\n" +
" Maximum RX AMPDU length 65535 bytes (exponent: 0x003)\n" +
" Minimum RX AMPDU time spacing: 4 usec (0x05)\n" +
" HT RX MCS rate indexes supported: 0-23\n" +
" HT TX MCS rate indexes are undefined\n" +
" HT operation:\n" +
" * primary channel: 36\n" +
" * secondary channel offset: above\n" +
" * STA channel width: any\n" +
" * RIFS: 1\n" +
" * HT protection: no\n" +
" * non-GF present: 0\n" +
" * OBSS non-GF present: 0\n" +
" * dual beacon: 0\n" +
" * dual CTS protection: 0\n" +
" * STBC beacon: 0\n" +
" * L-SIG TXOP Prot: 0\n" +
" * PCO active: 0\n" +
" * PCO phase: 0\n" +
" Extended capabilities: 6\n" +
" VHT capabilities:\n" +
" VHT Capabilities (0x0f8259b2):\n" +
" Max MPDU length: 11454\n" +
" Supported Channel Width: neither 160 nor 80+80\n" +
" RX LDPC\n" +
" short GI (80 MHz)\n" +
" TX STBC\n" +
" SU Beamformer\n" +
" SU Beamformee\n" +
" VHT RX MCS set:\n" +
" 1 streams: MCS 0-9\n" +
" 2 streams: MCS 0-9\n" +
" 3 streams: MCS 0-9\n" +
" 4 streams: not supported\n" +
" 5 streams: not supported\n" +
" 6 streams: not supported\n" +
" 7 streams: not supported\n" +
" 8 streams: not supported\n" +
" VHT RX highest supported: 0 Mbps\n" +
" VHT TX MCS set:\n" +
" 1 streams: MCS 0-9\n" +
" 2 streams: MCS 0-9\n" +
" 3 streams: MCS 0-9\n" +
" 4 streams: not supported\n" +
" 5 streams: not supported\n" +
" 6 streams: not supported\n" +
" 7 streams: not supported\n" +
" 8 streams: not supported\n" +
" VHT TX highest supported: 0 Mbps\n" +
" VHT operation:\n" +
" * channel width: 1 (80 MHz)\n" +
" * center freq segment 1: 42\n" +
" * center freq segment 2: 0\n" +
" * VHT basic MCS set: 0x0000\n" +
" WMM: * Parameter version 1\n" +
" * u-APSD\n" +
" * BE: CW 15-1023, AIFSN 3\n" +
" * BK: CW 15-1023, AIFSN 7\n" +
" * VI: CW 7-15, AIFSN 2, TXOP 3008 usec\n" +
" * VO: CW 3-7, AIFSN 2, TXOP 1504 usec\n" +
"BSS 2c:30:33:ec:4b:24(on wlan0)\n" +
" TSF: 337644493 usec (0d, 00:05:37)\n" +
" freq: 2437\n" +
" beacon interval: 31 TUs\n" +
" capability: ESS Privacy ShortPreamble SpectrumMgmt ShortSlotTime RadioMeasure (0x1531)\n" +
" signal: -68.00 dBm\n" +
" last seen: 0 ms ago\n" +
" Information elements from Probe Response frame:\n" +
" SSID: NETGEAR03\n" +
" Supported rates: 1.0* 2.0* 5.5 11.0 18.0 24.0 36.0 54.0 \n" +
" DS Parameter set: channel 6\n" +
" Country: US Environment: Indoor/Outdoor\n" +
" Channels [1 - 11] @ 30 dBm\n" +
" Power constraint: 0 dB\n" +
" TPC report: TX power: 25 dBm\n" +
" ERP: <no flags>\n" +
" ERP D4.0: <no flags>\n" +
" RSN: * Version: 1\n" +
" * Group cipher: CCMP\n" +
" * Pairwise ciphers: CCMP\n" +
" * Authentication suites: PSK\n" +
" * Capabilities: 16-PTKSA-RC 1-GTKSA-RC (0x000c)\n" +
" Extended supported rates: 6.0 9.0 12.0 48.0 \n" +
" BSS Load:\n" +
" * station count: 1\n" +
" * channel utilisation: 166/255\n" +
" * available admission capacity: 0 [*32us]\n" +
" HT capabilities:\n" +
" Capabilities: 0x19b0\n" +
" HT20\n" +
" Static SM Power Save\n" +
" RX Greenfield\n" +
" RX HT20 SGI\n" +
" TX STBC\n" +
" RX STBC 1-stream\n" +
" Max AMSDU length: 7935 bytes\n" +
" DSSS/CCK HT40\n" +
" Maximum RX AMPDU length 65535 bytes (exponent: 0x003)\n" +
" Minimum RX AMPDU time spacing: 8 usec (0x06)\n" +
" HT RX MCS rate indexes supported: 0-15\n" +
" HT TX MCS rate indexes are undefined\n" +
" HT operation:\n" +
" * primary channel: 6\n" +
" * secondary channel offset: no secondary\n" +
" * STA channel width: 20 MHz\n" +
" * RIFS: 1\n" +
" * HT protection: no\n" +
" * non-GF present: 1\n" +
" * OBSS non-GF present: 0\n" +
" * dual beacon: 0\n" +
" * dual CTS protection: 0\n" +
" * STBC beacon: 0\n" +
" * L-SIG TXOP Prot: 0\n" +
" * PCO active: 0\n" +
" * PCO phase: 0\n" +
" Extended capabilities: Extended Channel Switching, BSS Transition, 6\n" +
" WPS: * Version: 1.0\n" +
" * Wi-Fi Protected Setup State: 2 (Configured)\n" +
" * Response Type: 3 (AP)\n" +
" * UUID: 00000000-0000-0000-0000-000000000000\n" +
" * Manufacturer: NETGEAR, Inc.\n" +
" * Model: VMB3010\n" +
" * Model Number: VMB3010\n" +
" * Serial Number: 01\n" +
" * Primary Device Type: 6-0050f204-1\n" +
" * Device name: NTGRBS\n" +
" * Config methods: Label, PBC\n" +
" * RF Bands: 0x1\n" +
" WMM: * Parameter version 1\n" +
" * u-APSD\n" +
" * BE: CW 15-1023, AIFSN 3\n" +
" * BK: CW 15-1023, AIFSN 7\n" +
" * VI: CW 7-15, AIFSN 2, TXOP 6016 usec\n" +
" * VO: CW 3-7, AIFSN 2, TXOP 3264 usec\n" +
"BSS 7c:0e:ce:b7:d7:90(on wlan0)\n" +
" TSF: 239785397355 usec (2d, 18:36:25)\n" +
" freq: 2412\n" +
" beacon interval: 102 TUs\n" +
" capability: ESS Privacy ShortPreamble ShortSlotTime RadioMeasure (0x1431)\n" +
" signal: -77.00 dBm\n" +
" last seen: 10 ms ago\n" +
" Information elements from Probe Response frame:\n" +
" SSID: Flex-Skynet\n" +
" Supported rates: 1.0* 2.0* 5.5* 6.0 9.0 11.0* 12.0 18.0 \n" +
" DS Parameter set: channel 1\n" +
" Country: US Environment: Indoor/Outdoor\n" +
" Channels [1 - 11] @ 30 dBm\n" +
" BSS Load:\n" +
" * station count: 2\n" +
" * channel utilisation: 201/255\n" +
" * available admission capacity: 23437 [*32us]\n" +
" ERP: <no flags>\n" +
" HT capabilities:\n" +
" Capabilities: 0x19ac\n" +
" HT20\n" +
" SM Power Save disabled\n" +
" RX HT20 SGI\n" +
" TX STBC\n" +
" RX STBC 1-stream\n" +
" Max AMSDU length: 7935 bytes\n" +
" DSSS/CCK HT40\n" +
" Maximum RX AMPDU length 65535 bytes (exponent: 0x003)\n" +
" Minimum RX AMPDU time spacing: 8 usec (0x06)\n" +
" HT RX MCS rate indexes supported: 0-23\n" +
" HT TX MCS rate indexes are undefined\n" +
" RSN: * Version: 1\n" +
" * Group cipher: CCMP\n" +
" * Pairwise ciphers: CCMP\n" +
" * Authentication suites: IEEE 802.1X\n" +
" * Capabilities: 4-PTKSA-RC 4-GTKSA-RC (0x0028)\n" +
" Extended supported rates: 24.0 36.0 48.0 54.0 \n" +
" HT operation:\n" +
" * primary channel: 1\n" +
" * secondary channel offset: no secondary\n" +
" * STA channel width: 20 MHz\n" +
" * RIFS: 0\n" +
" * HT protection: nonmember\n" +
" * non-GF present: 1\n" +
" * OBSS non-GF present: 0\n" +
" * dual beacon: 0\n" +
" * dual CTS protection: 0\n" +
" * STBC beacon: 0\n" +
" * L-SIG TXOP Prot: 0\n" +
" * PCO active: 0\n" +
" * PCO phase: 0\n" +
" Extended capabilities: Proxy ARP Service, WNM-Notification\n" +
" WMM: * Parameter version 1\n" +
" * u-APSD\n" +
" * BE: CW 15-1023, AIFSN 3\n" +
" * BK: CW 15-1023, AIFSN 7\n" +
" * VI: CW 7-15, AIFSN 2, TXOP 3008 usec\n" +
" * VO: CW 3-7, AIFSN 2, TXOP 1504 usec\n" +
"BSS cc:46:d6:3c:91:04(on wlan0)\n" +
" TSF: 337644462 usec (0d, 00:05:37)\n" +
" freq: 2412\n" +
" beacon interval: 102 TUs\n" +
" capability: ESS ShortPreamble ShortSlotTime RadioMeasure (0x1421)\n" +
" signal: -90.00 dBm\n" +
" last seen: 0 ms ago\n" +
" SSID: \\x00\n" +
" Supported rates: 1.0* 2.0* 5.5* 6.0 9.0 11.0* 12.0 18.0 \n" +
" DS Parameter set: channel 1\n" +
" TIM: DTIM Count 0 DTIM Period 1 Bitmap Control 0x0 Bitmap[0] 0x0\n" +
" Country: US Environment: Indoor/Outdoor\n" +
" Channels [1 - 11] @ 30 dBm\n" +
" BSS Load:\n" +
" * station count: 1\n" +
" * channel utilisation: 190/255\n" +
" * available admission capacity: 23437 [*32us]\n" +
" ERP: <no flags>\n" +
" HT capabilities:\n" +
" Capabilities: 0x19ac\n" +
" HT20\n" +
" SM Power Save disabled\n" +
" RX HT20 SGI\n" +
" TX STBC\n" +
" RX STBC 1-stream\n" +
" Max AMSDU length: 7935 bytes\n" +
" DSSS/CCK HT40\n" +
" Maximum RX AMPDU length 65535 bytes (exponent: 0x003)\n" +
" Minimum RX AMPDU time spacing: 8 usec (0x06)\n" +
" HT RX MCS rate indexes supported: 0-23\n" +
" HT TX MCS rate indexes are undefined\n" +
" Extended supported rates: 24.0 36.0 48.0 54.0 \n" +
" HT operation:\n" +
" * primary channel: 1\n" +
" * secondary channel offset: no secondary\n" +
" * STA channel width: 20 MHz\n" +
" * RIFS: 0\n" +
" * HT protection: nonmember\n" +
" * non-GF present: 1\n" +
" * OBSS non-GF present: 0\n" +
" * dual beacon: 0\n" +
" * dual CTS protection: 0\n" +
" * STBC beacon: 0\n" +
" * L-SIG TXOP Prot: 0\n" +
" * PCO active: 0\n" +
" * PCO phase: 0\n" +
" Extended capabilities: Proxy ARP Service, WNM-Notification\n" +
" WMM: * Parameter version 1\n" +
" * u-APSD\n" +
" * BE: CW 15-1023, AIFSN 3\n" +
" * BK: CW 15-1023, AIFSN 7\n" +
" * VI: CW 7-15, AIFSN 2, TXOP 3008 usec\n" +
" * VO: CW 3-7, AIFSN 2, TXOP 1504 usec\n" +
"BSS 14:91:82:bd:15:61(on wlan0)\n" +
" TSF: 337644716 usec (0d, 00:05:37)\n" +
" freq: 2457\n" +
" beacon interval: 100 TUs\n" +
" capability: ESS Privacy ShortSlotTime (0x0411)\n" +
" signal: -88.00 dBm\n" +
" last seen: 1070 ms ago\n" +
" Information elements from Probe Response frame:\n" +
" SSID: beast10\n" +
" Supported rates: 1.0* 2.0* 5.5* 11.0* 22.0 6.0 9.0 12.0 \n" +
" DS Parameter set: channel 10\n" +
" TIM: DTIM Count 1 DTIM Period 2 Bitmap Control 0x0 Bitmap[0] 0x0\n" +
" ERP: <no flags>\n" +
" Extended supported rates: 18.0 24.0 36.0 48.0 54.0 \n" +
" Extended capabilities: 6\n" +
" VHT capabilities:\n" +
" VHT Capabilities (0x33801831):\n" +
" Max MPDU length: 7991\n" +
" Supported Channel Width: neither 160 nor 80+80\n" +
" RX LDPC\n" +
" short GI (80 MHz)\n" +
" SU Beamformer\n" +
" SU Beamformee\n" +
" RX antenna pattern consistency\n" +
" TX antenna pattern consistency\n" +
" VHT RX MCS set:\n" +
" 1 streams: MCS 0-9\n" +
" 2 streams: MCS 0-9\n" +
" 3 streams: MCS 0-9\n" +
" 4 streams: not supported\n" +
" 5 streams: not supported\n" +
" 6 streams: not supported\n" +
" 7 streams: not supported\n" +
" 8 streams: not supported\n" +
" VHT RX highest supported: 0 Mbps\n" +
" VHT TX MCS set:\n" +
" 1 streams: MCS 0-9\n" +
" 2 streams: MCS 0-9\n" +
" 3 streams: MCS 0-9\n" +
" 4 streams: not supported\n" +
" 5 streams: not supported\n" +
" 6 streams: not supported\n" +
" 7 streams: not supported\n" +
" 8 streams: not supported\n" +
" VHT TX highest supported: 0 Mbps\n" +
" VHT operation:\n" +
" * channel width: 0 (20 or 40 MHz)\n" +
" * center freq segment 1: 0\n" +
" * center freq segment 2: 0\n" +
" * VHT basic MCS set: 0xfffc\n" +
" WMM: * Parameter version 1\n" +
" * BE: CW 15-1023, AIFSN 3, TXOP 2048 usec\n" +
" * BK: CW 15-1023, AIFSN 7\n" +
" * VI: CW 7-15, AIFSN 2, TXOP 3008 usec\n" +
" * VO: CW 3-7, AIFSN 2, TXOP 1504 usec\n"
describe('iw', function() {
describe('iw.scan(interface, callback)', function() {
it('should scan the specified interface', function(done) {
iw.exec = function(command, callback) {
should(command).eql('iw dev wlan0 scan');
callback(null, IW_SCAN_LINUX, '');
};
iw.scan('wlan0', function(err, status) {
should(status).eql([
{ frequency: 5260,
address: "f4:0f:1b:b5:5b:4d",
signal: -59,
lastSeenMs: 4530,
ssid: 'Wink-Visitor',
channel: 52,
security: 'wpa' },
{ frequency: 5260,
address: "f4:0f:1b:b5:5b:4e",
signal: -59,
lastSeenMs: 4530,
ssid: 'Flex-Visitor',
channel: 52,
security: 'open' },
{ frequency: 2437,
address: "2c:30:33:ec:4b:24",
signal: -68,
lastSeenMs: 0,
ssid: 'NETGEAR03',
channel: 6,
security: 'wpa2' },
{ frequency: 5180,
address: "6c:70:9f:e7:d8:b3",
signal: -77,
lastSeenMs: 2110,
ssid: 'QA Lab 5GHz',
channel: 36,
security: 'wpa2' },
{ frequency: 2412,
address: "7c:0e:ce:b7:d7:90",
signal: -77,
lastSeenMs: 10,
ssid: 'Flex-Skynet',
channel: 1,
security: 'wpa2' },
{ frequency: 2412,
address: "14:91:82:c7:76:b9",
signal: -87,
lastSeenMs: 0,
ssid: 'creamcorn',
channel: 1,
security: 'wpa2' },
{ frequency: 2457,
address: "14:91:82:bd:15:61",
signal: -88,
lastSeenMs: 1070,
ssid: 'beast10',
channel: 10,
security: 'wep' },
]);
done();
});
})
it('should scan the specified interface and show hidden ssid networks', function(done) {
iw.exec = function(command, callback) {
should(command).eql('iw dev wlan0 scan');
callback(null, IW_SCAN_LINUX, '');
};
var options = {
iface: 'wlan0',
show_hidden: true
};
iw.scan(options, function(err, status) {
should(status).eql([
{ frequency: 5260,
address: "f4:0f:1b:b5:5b:4d",
signal: -59,
lastSeenMs: 4530,
ssid: 'Wink-Visitor',
channel: 52,
security: 'wpa' },
{ frequency: 5260,
address: "f4:0f:1b:b5:5b:4e",
signal: -59,
lastSeenMs: 4530,
ssid: 'Flex-Visitor',
channel: 52,
security: 'open' },
{ frequency: 2437,
address: "2c:30:33:ec:4b:24",
signal: -68,
lastSeenMs: 0,
ssid: 'NETGEAR03',
channel: 6,
security: 'wpa2' },
{ frequency: 5180,
address: "6c:70:9f:e7:d8:b3",
signal: -77,
lastSeenMs: 2110,
ssid: 'QA Lab 5GHz',
channel: 36,
security: 'wpa2' },
{ frequency: 2412,
address: "7c:0e:ce:b7:d7:90",
signal: -77,
lastSeenMs: 10,
ssid: 'Flex-Skynet',
channel: 1,
security: 'wpa2' },
{ frequency: 2412,
address: "14:91:82:c7:76:b9",
signal: -87,
lastSeenMs: 0,
ssid: 'creamcorn',
channel: 1,
security: 'wpa2' },
{ frequency: 2457,
address: "14:91:82:bd:15:61",
signal: -88,
lastSeenMs: 1070,
ssid: 'beast10',
channel: 10,
security: 'wep' },
{ frequency: 2412,
address: "cc:46:d6:3c:91:04",
signal: -90,
lastSeenMs: 0,
channel: 1,
security: 'open' },
]);
done();
});
})
it('should scan the specified interface and not show hidden ssid networks', function(done) {
iw.exec = function(command, callback) {
should(command).eql('iw dev wlan0 scan');
callback(null, IW_SCAN_LINUX, '');
};
var options = {
iface: 'wlan0'
};
iw.scan(options, function(err, status) {
should(status).eql([
{ frequency: 5260,
address: "f4:0f:1b:b5:5b:4d",
signal: -59,
lastSeenMs: 4530,
ssid: 'Wink-Visitor',
channel: 52,
security: 'wpa' },
{ frequency: 5260,
address: "f4:0f:1b:b5:5b:4e",
signal: -59,
lastSeenMs: 4530,
ssid: 'Flex-Visitor',
channel: 52,
security: 'open' },
{ frequency: 2437,
address: "2c:30:33:ec:4b:24",
signal: -68,
lastSeenMs: 0,
ssid: 'NETGEAR03',
channel: 6,
security: 'wpa2' },
{ frequency: 5180,
address: "6c:70:9f:e7:d8:b3",
signal: -77,
lastSeenMs: 2110,
ssid: 'QA Lab 5GHz',
channel: 36,
security: 'wpa2' },
{ frequency: 2412,
address: "7c:0e:ce:b7:d7:90",
signal: -77,
lastSeenMs: 10,
ssid: 'Flex-Skynet',
channel: 1,
security: 'wpa2' },
{ frequency: 2412,
address: "14:91:82:c7:76:b9",
signal: -87,
lastSeenMs: 0,
ssid: 'creamcorn',
channel: 1,
security: 'wpa2' },
{ frequency: 2457,
address: "14:91:82:bd:15:61",
signal: -88,
lastSeenMs: 1070,
ssid: 'beast10',
channel: 10,
security: 'wep' },
]);
done();
});
})
it('should handle errors', function(done) {
iw.exec = function(command, callback) {
callback('error');
};
iw.scan('wlan0', function(err, status) {
should(err).eql('error');
done();
});
})
})
})

201
tests/node_modules/wireless-tools/test/iwconfig.js generated vendored Normal file
View File

@ -0,0 +1,201 @@
/*
* Copyright (c) 2015 Christopher M. Baker
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
var should = require('should');
var iwconfig = require('../iwconfig');
var IWCONFIG_STATUS_LINUX = [
'wlan0 IEEE 802.11bg ESSID:"RaspberryPi" Nickname:"<WIFI@REALTEK>"',
' Mode:Master Frequency:2.437 GHz Access Point: 00:0B:81:95:12:21',
' Bit Rate:54 Mb/s Sensitivity:0/0',
' Retry:off RTS thr:off Fragment thr:off',
' Power Management:off',
' Link Quality=18/100 Signal level=11/100 Noise level=0/100',
' Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0',
' Tx excessive retries:0 Invalid misc:0 Missed beacon:0',
'',
'',
'',
'wlan1 unassociated Nickname:"<WIFI@REALTEK>"',
' Mode:Auto Frequency=2.412 GHz Access Point: Not-Associated',
' Sensitivity:0/0',
' Retry:off RTS thr:off Fragment thr:off',
' Power Management:off',
' Link Quality:0 Signal level:0 Noise level:0',
' Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0',
' Tx excessive retries:0 Invalid misc:0 Missed beacon:0',
'',
'lo no wireless extensions.',
''
].join('\n');
var IWCONFIG_STATUS_INTERFACE_LINUX = [
'wlan0 IEEE 802.11bg ESSID:"RaspberryPi" Nickname:"<WIFI@REALTEK>"',
' Mode:Master Frequency:2.437 GHz Access Point: 00:0B:81:95:12:21',
' Bit Rate:54 Mb/s Sensitivity:0/0',
' Retry:off RTS thr:off Fragment thr:off',
' Power Management:off',
' Link Quality=18/100 Signal level=11/100 Noise level=0/100',
' Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0',
' Tx excessive retries:0 Invalid misc:0 Missed beacon:0',
''
].join('\n');
var IWCONFIG_STATUS_INTERFACE_LINUX2 = [
'wlan0 IEEE 802.11abgn ESSID:"FAKE-Wifi"',
' Mode:Managed Frequency:2.412 GHz Access Point: 00:0B:81:95:12:21',
' Bit Rate=36 Mb/s Tx-Power=22 dBm',
' Retry short limit:7 RTS thr:off Fragment thr:off',
' Encryption key:off',
' Power Management:on',
' Link Quality=63/70 Signal level=-47 dBm',
' Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0',
' Tx excessive retries:0 Invalid misc:0 Missed beacon:0',
''
].join('\n');
describe('iwconfig', function() {
describe('iwconfig.status(callback)', function() {
it('should get the status for each interface', function(done) {
iwconfig.exec = function(command, callback) {
should(command).eql('iwconfig');
callback(null, IWCONFIG_STATUS_LINUX, '');
};
iwconfig.status(function(err, status) {
should(status).eql([
{
interface: 'wlan0',
ssid: 'RaspberryPi',
access_point: '00:0b:81:95:12:21',
ieee: '802.11bg',
mode: 'master',
frequency: 2.437,
sensitivity: 0,
quality: 18,
signal: 11,
noise: 0
},
{
interface: 'wlan1',
unassociated: true,
mode: 'auto',
frequency: 2.412,
sensitivity: 0,
quality: 0,
signal: 0,
noise: 0
},
{
interface: 'lo'
}
]);
done();
});
})
it('should handle errors', function(done) {
iwconfig.exec = function(command, callback) {
callback('error');
};
iwconfig.status(function(err, status) {
should(err).eql('error');
done();
});
})
})
describe('iwconfig.status(interface, callback)', function() {
it('should get the status for the specified interface', function(done) {
iwconfig.exec = function(command, callback) {
should(command).eql('iwconfig wlan0');
callback(null, IWCONFIG_STATUS_INTERFACE_LINUX, '');
};
iwconfig.status('wlan0', function(err, status) {
should(status).eql({
interface: 'wlan0',
ssid: 'RaspberryPi',
access_point: '00:0b:81:95:12:21',
ieee: '802.11bg',
mode: 'master',
frequency: 2.437,
sensitivity: 0,
quality: 18,
signal: 11,
noise: 0
});
done();
});
})
it('should handle errors', function(done) {
iwconfig.exec = function(command, callback) {
callback('error');
};
iwconfig.status('wlan0', function(err, status) {
should(err).eql('error');
done();
});
})
})
describe('iwconfig.status(interface, callback)', function() {
it('should get the status for the specified interface', function(done) {
iwconfig.exec = function(command, callback) {
should(command).eql('iwconfig wlan0');
callback(null, IWCONFIG_STATUS_INTERFACE_LINUX2, '');
};
iwconfig.status('wlan0', function(err, status) {
should(status).eql({
interface: 'wlan0',
ssid: 'FAKE-Wifi',
access_point: '00:0b:81:95:12:21',
ieee: '802.11abgn',
mode: 'managed',
frequency: 2.412,
quality: 63,
signal: -47
});
done();
});
})
it('should handle errors', function(done) {
iwconfig.exec = function(command, callback) {
callback('error');
};
iwconfig.status('wlan0', function(err, status) {
should(err).eql('error');
done();
});
})
})
})

368
tests/node_modules/wireless-tools/test/iwlist.js generated vendored Normal file
View File

@ -0,0 +1,368 @@
/*
* Copyright (c) 2015 Christopher M. Baker
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
var should = require('should');
var iwlist = require('../iwlist');
var IWLIST_SCAN_LINUX = [
'Cell 01 - Address: 00:0B:81:95:12:21',
' ESSID:"RaspberryPi"',
' Protocol:IEEE 802.11bgn',
' Mode:Master',
' Frequency:2.437 GHz (Channel 6)',
' Encryption key:on',
' Bit Rates:144 Mb/s',
' Extra:rsn_ie=00000000000000000000000000000000000000000000',
' IE: IEEE 802.11i/WPA2 Version 1',
' Group Cipher : CCMP',
' Pairwise Ciphers (1) : CCMP',
' Authentication Suites (1) : PSK',
' IE: Unknown: 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
' Quality=58/100 Signal level=83/100',
'Cell 02 - Address: 00:0B:81:AB:14:22',
' ESSID:"BlueberryPi"',
' Protocol:IEEE 802.11bgn',
' Mode:Master',
' Frequency:2.437 GHz (Channel 6)',
' Encryption key:on',
' Bit Rates:144 Mb/s',
' IE: WPA Version 1',
' Group Cipher : TKIP',
' Pairwise Ciphers (2) : CCMP TKIP',
' Authentication Suites (1) : PSK',
' Extra:rsn_ie=0000000000000000000000000000000000000000000000000000',
' Quality=48/100 Signal level=87/100',
'Cell 03 - Address: 00:0B:81:CD:F2:04',
' ESSID:"BlackberryPi"',
' Protocol:IEEE 802.11bgn',
' Mode:Master',
' Frequency:2.437 GHz (Channel 6)',
' Encryption key:on',
' Bit Rates:144 Mb/s',
' IE: Unknown: 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
' Extra:rsn_ie=0000000000000000000000000000000000000000000000000000',
' Quality=48/100 Signal level=80/100',
'Cell 04 - Address: 00:0B:81:FD:42:14',
' ESSID:"CranberryPi"',
' Protocol:IEEE 802.11bgn',
' Mode:Master',
' Frequency:2.437 GHz (Channel 6)',
' Encryption key:off',
' Bit Rates:144 Mb/s',
' IE: Unknown: 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
' Quality:4/5 Signal level:-60 dBm Noise level:-92 dBm',
'Cell 05 - Address: 2C:C5:D3:02:AE:4C',
' Channel:100',
' Frequency:5.5 GHz (Channel 100)',
' Quality=65/70 Signal level=-45 dBm',
' Encryption key:on',
' ESSID:""',
' Bit Rates:24 Mb/s; 36 Mb/s; 48 Mb/s; 54 Mb/s',
' Mode:Master',
' Extra:tsf=0000003d2a54d03b',
' Extra: Last beacon: 3360ms ago',
' IE: Unknown: DD180050F20201018E0003A4000027A4000042435E0062322F00',
' IE: Unknown: 2D1AAD091BF8FE000000000000000000001000000000000000000000',
' IE: Unknown: 3D1664000000000000000000000000000000000000000000',
' IE: IEEE 802.11i/WPA2 Version 1',
' Group Cipher : CCMP',
' Pairwise Ciphers (1) : CCMP',
' Authentication Suites (1) : PSK'
].join('\n');
var IWLIST_SCAN_LINUX_ACTIVE_SCAN = [
'Cell 01 - Address: 00:0B:81:95:12:21',
' ESSID:"RaspberryPi"',
' Protocol:IEEE 802.11bgn',
' Mode:Master',
' Frequency:2.437 GHz (Channel 6)',
' Encryption key:on',
' Bit Rates:144 Mb/s',
' Extra:rsn_ie=00000000000000000000000000000000000000000000',
' IE: IEEE 802.11i/WPA2 Version 1',
' Group Cipher : CCMP',
' Pairwise Ciphers (1) : CCMP',
' Authentication Suites (1) : PSK',
' IE: Unknown: 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
' Quality=58/100 Signal level=83/100',
'Cell 02 - Address: 00:0B:81:AB:14:22',
' ESSID:"BlueberryPi"',
' Protocol:IEEE 802.11bgn',
' Mode:Master',
' Frequency:2.437 GHz (Channel 6)',
' Encryption key:on',
' Bit Rates:144 Mb/s',
' IE: WPA Version 1',
' Group Cipher : TKIP',
' Pairwise Ciphers (2) : CCMP TKIP',
' Authentication Suites (1) : PSK',
' Extra:rsn_ie=0000000000000000000000000000000000000000000000000000',
' Quality=48/100 Signal level=87/100',
'Cell 03 - Address: 00:0B:81:CD:F2:04',
' ESSID:"BlackberryPi"',
' Protocol:IEEE 802.11bgn',
' Mode:Master',
' Frequency:2.437 GHz (Channel 6)',
' Encryption key:on',
' Bit Rates:144 Mb/s',
' IE: Unknown: 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
' Extra:rsn_ie=0000000000000000000000000000000000000000000000000000',
' Quality=48/100 Signal level=80/100',
'Cell 04 - Address: 00:0B:81:FD:42:14',
' ESSID:"CranberryPi"',
' Protocol:IEEE 802.11bgn',
' Mode:Master',
' Frequency:2.437 GHz (Channel 6)',
' Encryption key:off',
' Bit Rates:144 Mb/s',
' IE: Unknown: 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
' Quality=32/100 Signal level=71/100',
'Cell 05 - Address: 2C:C5:D3:02:AE:4C',
' Channel:100',
' Frequency:5.5 GHz (Channel 100)',
' Quality=65/70 Signal level=-45 dBm',
' Encryption key:on',
' ESSID:"hidden-ssid"',
' Bit Rates:24 Mb/s; 36 Mb/s; 48 Mb/s; 54 Mb/s',
' Mode:Master',
' Extra:tsf=0000003d2a54d03b',
' Extra: Last beacon: 3360ms ago',
' IE: Unknown: DD180050F20201018E0003A4000027A4000042435E0062322F00',
' IE: Unknown: 2D1AAD091BF8FE000000000000000000001000000000000000000000',
' IE: Unknown: 3D1664000000000000000000000000000000000000000000',
' IE: IEEE 802.11i/WPA2 Version 1',
' Group Cipher : CCMP',
' Pairwise Ciphers (1) : CCMP',
' Authentication Suites (1) : PSK'
].join('\n');
describe('iwlist', function() {
describe('iwlist.scan(interface, callback)', function() {
it('should scan the specified interface', function(done) {
iwlist.exec = function(command, callback) {
should(command).eql('iwlist wlan0 scan');
callback(null, IWLIST_SCAN_LINUX, '');
};
iwlist.scan('wlan0', function(err, status) {
should(status).eql([
{
address: '00:0b:81:ab:14:22',
ssid: 'BlueberryPi',
mode: 'master',
frequency: 2.437,
channel: 6,
security: 'wpa',
quality: 48,
signal: 87
},
{
address: '00:0b:81:95:12:21',
ssid: 'RaspberryPi',
mode: 'master',
frequency: 2.437,
channel: 6,
security: 'wpa2',
quality: 58,
signal: 83
},
{
address: '00:0b:81:cd:f2:04',
ssid: 'BlackberryPi',
mode: 'master',
frequency: 2.437,
channel: 6,
security: 'wep',
quality: 48,
signal: 80
},
{
address: '00:0b:81:fd:42:14',
ssid: 'CranberryPi',
mode: 'master',
frequency: 2.437,
channel: 6,
security: 'open',
quality: 4,
signal: -60,
noise: -92
}
]);
done();
});
})
it('should scan the specified interface and show hidden ssid networks', function(done) {
iwlist.exec = function(command, callback) {
should(command).eql('iwlist wlan0 scan');
callback(null, IWLIST_SCAN_LINUX, '');
};
var options = {
iface: 'wlan0',
show_hidden: true
};
iwlist.scan(options, function(err, status) {
should(status).eql(
[
{
address: '00:0b:81:ab:14:22',
channel: 6,
frequency: 2.437,
mode: 'master',
quality: 48,
signal: 87,
ssid: 'BlueberryPi',
security: 'wpa'
},
{
address: '00:0b:81:95:12:21',
channel: 6,
frequency: 2.437,
mode: 'master',
quality: 58,
signal: 83,
ssid: 'RaspberryPi',
security: 'wpa2'
},
{
address: '00:0b:81:cd:f2:04',
channel: 6,
frequency: 2.437,
mode: 'master',
quality: 48,
signal: 80,
ssid: 'BlackberryPi',
security: 'wep'
},
{
address: '2c:c5:d3:02:ae:4c',
channel: 100,
frequency: 5.5,
mode: 'master',
quality: 65,
signal: -45,
security: 'wpa2'
},
{
address: '00:0b:81:fd:42:14',
channel: 6,
frequency: 2.437,
mode: 'master',
quality: 4,
signal: -60,
noise: -92,
ssid: 'CranberryPi',
security: 'open'
}
]);
done();
});
})
it('should scan the specified interface looking for hidden ssid', function(done) {
iwlist.exec = function(command, callback) {
should(command).eql('iwlist wlan0 scan essid hidden-ssid');
callback(null, IWLIST_SCAN_LINUX_ACTIVE_SCAN, '');
};
var options = {
iface: 'wlan0',
show_hidden: false,
ssid: 'hidden-ssid'
};
iwlist.scan(options, function(err, status) {
should(status).eql(
[
{
address: '00:0b:81:ab:14:22',
channel: 6,
frequency: 2.437,
mode: 'master',
quality: 48,
signal: 87,
ssid: 'BlueberryPi',
security: 'wpa'
},
{
address: '00:0b:81:95:12:21',
channel: 6,
frequency: 2.437,
mode: 'master',
quality: 58,
signal: 83,
ssid: 'RaspberryPi',
security: 'wpa2'
},
{
address: '00:0b:81:cd:f2:04',
channel: 6,
frequency: 2.437,
mode: 'master',
quality: 48,
signal: 80,
ssid: 'BlackberryPi',
security: 'wep'
},
{
address: '00:0b:81:fd:42:14',
channel: 6,
frequency: 2.437,
mode: 'master',
quality: 32,
signal: 71,
ssid: 'CranberryPi',
security: 'open'
},
{
address: '2c:c5:d3:02:ae:4c',
channel: 100,
frequency: 5.5,
mode: 'master',
quality: 65,
signal: -45,
ssid: 'hidden-ssid',
security: 'wpa2'
}
]);
done();
});
})
it('should handle errors', function(done) {
iwlist.exec = function(command, callback) {
callback('error');
};
iwlist.scan('wlan0', function(err, status) {
should(err).eql('error');
done();
});
})
})
})

87
tests/node_modules/wireless-tools/test/udhcpc.js generated vendored Normal file
View File

@ -0,0 +1,87 @@
/*
* Copyright (c) 2015 Christopher M. Baker
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
var should = require('should');
var udhcpc = require('../udhcpc');
describe('udhcpc', function() {
describe('udhcpc.disable(options, callback)', function() {
it('should stop the daemons', function(done) {
udhcpc.exec = function(command, callback) {
should(command).eql(
'kill `pgrep -f "^udhcpc -i wlan0"` || true');
callback(null, '', '');
};
udhcpc.disable('wlan0', function(err) {
should(err).not.be.ok;
done();
});
})
it('should handle errors', function(done) {
udhcpc.exec = function(command, callback) {
callback('error');
};
udhcpc.disable('wlan0', function(err) {
should(err).eql('error');
done();
});
})
})
describe('udhcpc.enable(options, callback)', function() {
it('should start the daemon', function(done) {
udhcpc.exec = function(command, callback) {
should(command).eql('udhcpc -i wlan0 -n');
callback(null, '', '');
};
var options = {
interface: 'wlan0'
};
udhcpc.enable(options, function(err) {
should(err).not.be.ok;
done();
});
})
it('should handle errors', function(done) {
udhcpc.exec = function(command, callback) {
callback('error');
};
var options = {
interface: 'wlan0'
};
udhcpc.enable(options, function(err) {
should(err).eql('error');
done();
});
})
})
})

111
tests/node_modules/wireless-tools/test/udhcpd.js generated vendored Normal file
View File

@ -0,0 +1,111 @@
/*
* Copyright (c) 2015 Christopher M. Baker
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
var should = require('should');
var udhcpd = require('../udhcpd');
describe('udhcpd', function() {
describe('udhcpd.disable(options, callback)', function() {
it('should stop the daemons', function(done) {
udhcpd.exec = function(command, callback) {
should(command).eql(
'kill `pgrep -f "^udhcpd wlan0-udhcpd.conf"` || true');
callback(null, '', '');
};
udhcpd.disable('wlan0', function(err) {
should(err).not.be.ok;
done();
});
})
it('should handle errors', function(done) {
udhcpd.exec = function(command, callback) {
callback('error');
};
udhcpd.disable('wlan0', function(err) {
should(err).eql('error');
done();
});
})
})
describe('udhcpd.enable(options, callback)', function() {
it('should start the daemon', function(done) {
udhcpd.exec = function(command, callback) {
should(command).eql('cat <<EOF >wlan0-udhcpd.conf' +
' && udhcpd wlan0-udhcpd.conf' +
' && rm -f wlan0-udhcpd.conf\n' +
'interface wlan0\n' +
'start 192.168.10.100\n' +
'end 192.168.10.200\n' +
'option router 192.168.10.1\n' +
'option subnet 255.255.255.0\n' +
'option dns 4.4.4.4\n' +
'option dns 8.8.8.8');
callback(null, '', '');
};
var options = {
interface: 'wlan0',
start: '192.168.10.100',
end: '192.168.10.200',
option: {
router: '192.168.10.1',
subnet: '255.255.255.0',
dns: [ '4.4.4.4', '8.8.8.8' ]
}
};
udhcpd.enable(options, function(err) {
should(err).not.be.ok;
done();
});
})
it('should handle errors', function(done) {
udhcpd.exec = function(command, callback) {
callback('error');
};
var options = {
interface: 'wlan0',
start: '192.168.10.100',
end: '192.168.10.200',
option: {
router: '192.168.10.1',
subnet: '255.255.255.0',
dns: [ '4.4.4.4', '8.8.8.8' ]
}
};
udhcpd.enable(options, function(err) {
should(err).eql('error');
done();
});
})
})
})

660
tests/node_modules/wireless-tools/test/wpa_cli.js generated vendored Normal file
View File

@ -0,0 +1,660 @@
/*
* Copyright (c) 2015 Christopher M. Baker
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
var should = require('should');
var wpa_cli = require('../wpa_cli');
var WPA_CLI_STATUS_SILENCE = '';
var WPA_CLI_STATUS_COMPLETED = [
'bssid=2c:f5:d3:02:ea:d9',
'freq=2412',
'ssid=Fake-Wifi',
'id=0',
'mode=station',
'pairwise_cipher=CCMP',
'group_cipher=CCMP',
'key_mgmt=WPA2-PSK',
'wpa_state=COMPLETED',
'ip_address=10.34.141.168',
'p2p_device_address=e4:28:9c:a8:53:72',
'address=e4:28:9c:a8:53:72',
'uuid=e1cda789-8c88-53e8-ffff-31c304580c1e'
].join('\n');
var WPA_CLI_STATUS_4WAY_HANDSHAKE = [
'bssid=2c:f5:d3:02:ea:d9',
'freq=2412',
'ssid=Fake-Wifi',
'id=0',
'mode=station',
'pairwise_cipher=CCMP',
'group_cipher=CCMP',
'key_mgmt=WPA2-PSK',
'wpa_state=4WAY_HANDSHAKE',
'ip_address=10.34.141.168',
'p2p_device_address=e4:28:9c:a8:53:72',
'address=e4:28:9c:a8:53:72',
'uuid=e1cda789-8c88-53e8-ffff-31c304580c1e'
].join('\n');
var WPA_CLI_STATUS_SCANNING = [
'wpa_state=SCANNING',
'ip_address=10.34.141.168',
'p2p_device_address=e4:28:9c:a8:53:72',
'address=e4:28:9c:a8:53:72',
'uuid=e1cda789-8c88-53e8-ffff-31c304580c1e'
].join('\n');
var WPA_CLI_SCAN_RESULTS = [
'bssid / frequency / signal level / flags / ssid',
'2c:f5:d3:02:ea:d9 2472 -31 [WPA-PSK-CCMP+TKIP][WPA2-PSK-CCMP+TKIP][ESS] FakeWifi',
'2c:f5:d3:02:ea:d9 2472 -31 [WPA-PSK-CCMP+TKIP][WPA2-PSK-CCMP+TKIP][ESS] FakeWifi2'
].join('\n');
var WPA_CLI_SCAN_NORESULTS = [
''
].join('\n');
var WPA_CLI_COMMAND_OK = 'OK\n';
var WPA_CLI_COMMAND_FAIL = 'FAIL\n';
var WPA_CLI_COMMAND_ID = '0\n';
describe('wpa_cli', function() {
describe('wpa_cli.status(iface, callback)', function() {
before(function() {
this.OUTPUT = '';
var self = this;
wpa_cli.exec = function(command, callback) {
should(command).eql('wpa_cli -i wlan0 status');
callback(null, self.OUTPUT);
};
});
it('status SILENCE', function (done) {
this.OUTPUT = WPA_CLI_STATUS_SILENCE;
wpa_cli.status('wlan0', function(err, status) {
should(status).eql({ });
done();
});
});
it('status COMPLETED', function(done) {
this.OUTPUT = WPA_CLI_STATUS_COMPLETED;
wpa_cli.status('wlan0', function(err, status) {
should(status).eql({
bssid: '2c:f5:d3:02:ea:d9',
frequency: 2412,
mode: 'station',
key_mgmt: 'wpa2-psk',
ssid: 'Fake-Wifi',
pairwise_cipher: 'CCMP',
group_cipher: 'CCMP',
p2p_device_address: 'e4:28:9c:a8:53:72',
wpa_state: 'COMPLETED',
ip: '10.34.141.168',
mac: 'e4:28:9c:a8:53:72',
uuid: 'e1cda789-8c88-53e8-ffff-31c304580c1e',
id: 0
});
done();
});
});
it('status 4WAY_HANDSHAKE', function(done) {
this.OUTPUT = WPA_CLI_STATUS_4WAY_HANDSHAKE;
wpa_cli.status('wlan0', function(err, status) {
should(status).eql({
bssid: '2c:f5:d3:02:ea:d9',
frequency: 2412,
mode: 'station',
key_mgmt: 'wpa2-psk',
ssid: 'Fake-Wifi',
pairwise_cipher: 'CCMP',
group_cipher: 'CCMP',
p2p_device_address: 'e4:28:9c:a8:53:72',
wpa_state: '4WAY_HANDSHAKE',
ip: '10.34.141.168',
mac: 'e4:28:9c:a8:53:72',
uuid: 'e1cda789-8c88-53e8-ffff-31c304580c1e',
id: 0
});
done();
});
});
it('status SCANNING', function(done) {
this.OUTPUT = WPA_CLI_STATUS_SCANNING;
wpa_cli.status('wlan0', function(err, status) {
should(status).eql({
p2p_device_address: 'e4:28:9c:a8:53:72',
wpa_state: 'SCANNING',
ip: '10.34.141.168',
mac: 'e4:28:9c:a8:53:72',
uuid: 'e1cda789-8c88-53e8-ffff-31c304580c1e' });
});
done();
});
it('should handle errors', function(done) {
wpa_cli.exec = function(command, callback) {
callback('error');
};
wpa_cli.status('wlan0', function(err, status) {
should(err).eql('error');
done();
});
});
});
describe('wpa_cli.bssid(iface, ap, ssid, callback)', function(){
it('OK result', function(done) {
wpa_cli.exec = function(command, callback) {
should(command).eql('wpa_cli -i wlan0 bssid Fake-Wifi 2c:f5:d3:02:ea:89');
callback(null, WPA_CLI_COMMAND_OK);
};
wpa_cli.bssid('wlan0', '2c:f5:d3:02:ea:89', 'Fake-Wifi', function(err, status) {
should(status).eql({
result: 'OK'
});
done();
});
});
it('FAIL result', function(done) {
wpa_cli.exec = function(command, callback) {
should(command).eql('wpa_cli -i wlan0 bssid 2c:f5:d3:02:ea:89 Fake-Wifi');
callback(null, WPA_CLI_COMMAND_FAIL);
};
wpa_cli.bssid('wlan0', 'Fake-Wifi', '2c:f5:d3:02:ea:89', function(err, status) {
should(err.message).eql('FAIL');
done();
});
});
it('Handle errors', function(done) {
wpa_cli.exec = function(command, callback) {
callback('error');
};
wpa_cli.bssid('wlan0', '2c:f5:d3:02:ea:89', 'Fake-Wifi', function(err, status) {
should(err).eql('error');
done();
});
});
});
describe('wpa_cli.reassociate(iface, callback)', function(){
it('OK result', function(done) {
wpa_cli.exec = function(command, callback) {
should(command).eql('wpa_cli -i wlan0 reassociate');
callback(null, WPA_CLI_COMMAND_OK);
};
wpa_cli.reassociate('wlan0', function(err, status) {
should(status).eql({
result: 'OK'
});
done();
});
});
it('FAIL result', function(done) {
wpa_cli.exec = function(command, callback) {
should(command).eql('wpa_cli -i wlan0 reassociate');
callback(null, WPA_CLI_COMMAND_FAIL);
};
wpa_cli.reassociate('wlan0', function(err, status) {
should(err.message).eql('FAIL');
done();
});
});
it('should handle errors', function(done) {
wpa_cli.exec = function(command, callback) {
callback('error');
};
wpa_cli.reassociate('wlan0', function(err, status) {
should(err).eql('error');
done();
});
});
});
describe('wpa_cli.set(iface, variable, value, callback)', function(){
it('OK result', function(done) {
wpa_cli.exec = function(command, callback) {
should(command).eql('wpa_cli -i wlan0 set ap_scan 1');
callback(null, WPA_CLI_COMMAND_OK);
};
wpa_cli.set('wlan0','ap_scan', 1, function(err, status) {
should(status).eql({
result: 'OK'
});
done();
});
});
it('FAIL result', function(done) {
wpa_cli.exec = function(command, callback) {
should(command).eql('wpa_cli -i wlan0 set ap_scan 1');
callback(null, WPA_CLI_COMMAND_FAIL);
};
wpa_cli.set('wlan0','ap_scan', 1, function(err, status) {
should(err.message).eql('FAIL');
done();
});
});
it('should handle errors', function(done) {
wpa_cli.exec = function(command, callback) {
callback('error');
};
wpa_cli.set('wlan0','ap_scan', 1, function(err, status) {
should(err).eql('error');
done();
});
});
});
describe('wpa_cli.add_network(iface, callback)', function(){
it('OK result', function(done) {
wpa_cli.exec = function(command, callback) {
should(command).eql('wpa_cli -i wlan0 add_network');
callback(null, WPA_CLI_COMMAND_ID);
};
wpa_cli.add_network('wlan0', function(err, status) {
should(status).eql({
result: '0'
});
done();
});
});
it('FAIL result', function(done) {
wpa_cli.exec = function(command, callback) {
should(command).eql('wpa_cli -i wlan0 add_network');
callback(null, WPA_CLI_COMMAND_FAIL);
};
wpa_cli.add_network('wlan0', function(err, status) {
should(err.message).eql('FAIL');
done();
});
});
it('should handle errors', function(done) {
wpa_cli.exec = function(command, callback) {
callback('error');
};
wpa_cli.add_network('wlan0', function(err, status) {
should(err).eql('error');
done();
});
});
});
describe('wpa_cli.set_network(iface, id, variable, value, callback)', function(){
it('OK result', function(done) {
wpa_cli.exec = function(command, callback) {
should(command).eql('wpa_cli -i wlan0 set_network 0 scan_ssid 1');
callback(null, WPA_CLI_COMMAND_OK);
};
wpa_cli.set_network('wlan0', 0, 'scan_ssid', 1, function(err, status) {
should(status).eql({
result: 'OK'
});
done();
});
});
it('FAIL result', function(done) {
wpa_cli.exec = function(command, callback) {
should(command).eql('wpa_cli -i wlan0 set_network 0 fake_variable 1');
callback(null, WPA_CLI_COMMAND_FAIL);
};
wpa_cli.set_network('wlan0', 0, 'fake_variable', 1, function(err, status) {
should(err.message).eql('FAIL');
done();
});
});
it('should handle errors', function(done) {
wpa_cli.exec = function(command, callback) {
callback('error');
};
wpa_cli.set_network('wlan0', 0, 'fake_variable', 1, function(err, status) {
should(err).eql('error');
done();
});
});
});
describe('wpa_cli.enable_network(iface, id, callback)', function(){
it('OK result', function(done) {
wpa_cli.exec = function(command, callback) {
should(command).eql('wpa_cli -i wlan0 enable_network 0');
callback(null, WPA_CLI_COMMAND_OK);
};
wpa_cli.enable_network('wlan0', 0, function(err, status) {
should(status).eql({
result: 'OK'
});
done();
});
});
it('FAIL result', function(done) {
wpa_cli.exec = function(command, callback) {
should(command).eql('wpa_cli -i wlan0 enable_network 28');
callback(null, WPA_CLI_COMMAND_FAIL);
};
wpa_cli.enable_network('wlan0', 28, function(err, status) {
should(err.message).eql('FAIL');
done();
});
});
it('should handle errors', function(done) {
wpa_cli.exec = function(command, callback) {
callback('error');
};
wpa_cli.enable_network('wlan0', 28, function(err, status) {
should(err).eql('error');
done();
});
});
});
describe('wpa_cli.disable_network(iface, id, callback)', function(){
it('OK result', function(done) {
wpa_cli.exec = function(command, callback) {
should(command).eql('wpa_cli -i wlan0 disable_network 0');
callback(null, WPA_CLI_COMMAND_OK);
};
wpa_cli.disable_network('wlan0', 0, function(err, status) {
should(status).eql({
result: 'OK'
});
done();
});
});
it('FAIL result', function(done) {
wpa_cli.exec = function(command, callback) {
should(command).eql('wpa_cli -i wlan0 disable_network 28');
callback(null, WPA_CLI_COMMAND_FAIL);
};
wpa_cli.disable_network('wlan0', 28, function(err, status) {
should(err.message).eql('FAIL');
done();
});
});
it('should handle errors', function(done) {
wpa_cli.exec = function(command, callback) {
callback('error');
};
wpa_cli.disable_network('wlan0', 28, function(err, status) {
should(err).eql('error');
done();
});
});
});
describe('wpa_cli.remove_network(iface, id, callback)', function(){
it('OK result', function(done) {
wpa_cli.exec = function(command, callback) {
should(command).eql('wpa_cli -i wlan0 remove_network 0');
callback(null, WPA_CLI_COMMAND_OK);
};
wpa_cli.remove_network('wlan0', 0, function(err, status) {
should(status).eql({
result: 'OK'
});
done();
});
});
it('FAIL result', function(done) {
wpa_cli.exec = function(command, callback) {
should(command).eql('wpa_cli -i wlan0 remove_network 28');
callback(null, WPA_CLI_COMMAND_FAIL);
};
wpa_cli.remove_network('wlan0', 28, function(err, status) {
should(err.message).eql('FAIL');
done();
});
});
it('should handle errors', function(done) {
wpa_cli.exec = function(command, callback) {
callback('error');
};
wpa_cli.remove_network('wlan0', 28, function(err, status) {
should(err).eql('error');
done();
});
});
});
describe('wpa_cli.select_network(iface, id, callback)', function(){
it('OK result', function(done) {
wpa_cli.exec = function(command, callback) {
should(command).eql('wpa_cli -i wlan0 select_network 0');
callback(null, WPA_CLI_COMMAND_OK);
};
wpa_cli.select_network('wlan0', 0, function(err, status) {
should(status).eql({
result: 'OK'
});
done();
});
});
it('FAIL result', function(done) {
wpa_cli.exec = function(command, callback) {
should(command).eql('wpa_cli -i wlan0 select_network 28');
callback(null, WPA_CLI_COMMAND_FAIL);
};
wpa_cli.select_network('wlan0', 28, function(err, status) {
should(err.message).eql('FAIL');
done();
});
});
it('should handle errors', function(done) {
wpa_cli.exec = function(command, callback) {
callback('error');
};
wpa_cli.select_network('wlan0', 28, function(err, status) {
should(err).eql('error');
done();
});
});
});
describe('wpa_cli.scan(iface, callback)', function(){
it('OK result', function(done) {
wpa_cli.exec = function(command, callback) {
should(command).eql('wpa_cli -i wlan0 scan');
callback(null, WPA_CLI_COMMAND_OK);
};
wpa_cli.scan('wlan0', function(err, scan) {
should(scan).eql({
result: 'OK'
});
done();
});
});
it('should handle errors', function(done) {
wpa_cli.exec = function(command, callback) {
callback('error');
};
wpa_cli.scan('wlan0', function(err, scan) {
should(err).eql('error');
done();
});
});
});
describe('wpa_cli.scan_results(iface, callback)', function(){
before(function() {
this.OUTPUT = '';
var self = this;
wpa_cli.exec = function(command, callback) {
should(command).eql('wpa_cli -i wlan0 scan_results');
callback(null, self.OUTPUT);
};
});
it('scan_results NORESULTS', function (done) {
this.OUTPUT = WPA_CLI_SCAN_NORESULTS;
wpa_cli.scan_results('wlan0', function(err, results) {
should(results).eql([]);
done();
});
});
it('scan_results COMPLETED', function(done) {
this.OUTPUT = WPA_CLI_SCAN_RESULTS;
wpa_cli.scan_results('wlan0', function(err, results) {
should(results).eql([
{
bssid: '2c:f5:d3:02:ea:d9',
frequency: 2472,
signalLevel: -31,
flags: '[WPA-PSK-CCMP+TKIP][WPA2-PSK-CCMP+TKIP][ESS]',
ssid: 'FakeWifi'
},
{
bssid: '2c:f5:d3:02:ea:d9',
frequency: 2472,
signalLevel: -31,
flags: '[WPA-PSK-CCMP+TKIP][WPA2-PSK-CCMP+TKIP][ESS]',
ssid: 'FakeWifi2'
}
]);
done();
});
});
it('should handle errors', function(done) {
wpa_cli.exec = function(command, callback) {
callback('error');
};
wpa_cli.scan_results('wlan0', function(err, results) {
should(err).eql('error');
done();
});
});
});
describe('wpa_cli.save_config(iface, callback)', function(){
it('OK result', function(done) {
wpa_cli.exec = function(command, callback) {
should(command).eql('wpa_cli -i wlan0 save_config');
callback(null, WPA_CLI_COMMAND_OK);
};
wpa_cli.save_config('wlan0', function(err, status) {
should(status).eql({
result: 'OK'
});
done();
});
});
it('FAIL result', function(done) {
wpa_cli.exec = function(command, callback) {
should(command).eql('wpa_cli -i wlan0 save_config');
callback(null, WPA_CLI_COMMAND_FAIL);
};
wpa_cli.save_config('wlan0', function(err, status) {
should(err.message).eql('FAIL');
done();
});
});
it('should handle errors', function(done) {
wpa_cli.exec = function(command, callback) {
callback('error');
};
wpa_cli.scan('wlan0', function(err, status) {
should(err).eql('error');
done();
});
});
});
});

View File

@ -0,0 +1,136 @@
/*
* Copyright (c) 2015 Christopher M. Baker
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
var should = require('should');
var wpa_supplicant = require('../wpa_supplicant');
describe('wpa_supplicant', function() {
describe('wpa_supplicant.disable(options, callback)', function() {
it('should stop the daemons', function(done) {
wpa_supplicant.exec = function(command, callback) {
should(command).eql(
'kill `pgrep -f "wpa_supplicant -i wlan0 .*"` || true');
callback(null, '', '');
};
wpa_supplicant.disable('wlan0', function(err) {
should(err).not.be.ok;
done();
});
})
it('should handle errors', function(done) {
wpa_supplicant.exec = function(command, callback) {
callback('error');
};
wpa_supplicant.disable('wlan0', function(err) {
should(err).eql('error');
done();
});
})
})
describe('wpa_supplicant.enable(options, callback)', function() {
it('should start the daemon', function(done) {
wpa_supplicant.exec = function(command, callback) {
should(command).eql('wpa_passphrase "RaspberryPi" "raspberry"' +
' > wlan0-wpa_supplicant.conf &&' +
' wpa_supplicant -i wlan0 -B -D wext -c wlan0-wpa_supplicant.conf' +
' && rm -f wlan0-wpa_supplicant.conf');
callback(null, '', '');
};
var options = {
interface: 'wlan0',
ssid: 'RaspberryPi',
passphrase: 'raspberry',
driver: 'wext'
};
wpa_supplicant.enable(options, function(err) {
should(err).not.be.ok;
done();
});
})
it('should handle errors', function(done) {
wpa_supplicant.exec = function(command, callback) {
callback('error');
};
var options = {
interface: 'wlan0',
ssid: 'RaspberryPi',
passphrase: 'raspberry',
driver: 'wext'
};
wpa_supplicant.enable(options, function(err) {
should(err).eql('error');
done();
});
})
})
describe('wpa_supplicant.manual(options, callback)', function() {
it('should start the daemon', function(done) {
wpa_supplicant.exec = function(command, callback) {
should(command).eql([
'wpa_supplicant -i wlan0 -s -B -P /run/wpa_supplicant/wlan0.pid',
'-D nl80211,wext -C /run/wpa_supplicant'
].join(' '));
callback(null, '', '');
};
var options = {
interface: 'wlan0',
drivers: [ 'nl80211', 'wext' ]
};
wpa_supplicant.manual(options, function(err) {
should(err).not.be.ok;
done();
});
})
it('should handle errors', function(done) {
wpa_supplicant.exec = function(command, callback) {
callback('error');
};
var options = {
interface: 'wlan0',
drivers: [ 'nl80211', 'wext' ]
};
wpa_supplicant.manual(options, function(err) {
should(err).eql('error');
done();
});
})
})
})

88
tests/node_modules/wireless-tools/udhcpc.js generated vendored Normal file
View File

@ -0,0 +1,88 @@
/*
* Copyright (c) 2015 Christopher M. Baker
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
var child_process = require('child_process');
/**
* The **udhcpc** command is used to configure a dhcp client for a
* network interface.
*
* @static
* @category udhcpc
*
*/
var udhcpc = module.exports = {
exec: child_process.exec,
disable: disable,
enable: enable
};
/**
* The **udhcpc disable** command is used to stop a dhcp client on a
* specific network interface.
*
* @static
* @category udhcpc
* @param {string} interface The network interface.
* @param {function} callback The callback function.
* @returns {process} The child process.
* @example
*
* var udhcpc = require('wireless-tools/udhcpc');
*
* udhcpc.disable('wlan0', function(err) {
* // the dhcp client was stopped
* });
*
*/
function disable(interface, callback) {
var command = 'kill `pgrep -f "^udhcpc -i ' + interface + '"` || true';
return this.exec(command, callback);
}
/**
* The **udhcpc enable** command is used to start a dhcp client on a
* specific network interface.
*
* @static
* @category udhcpc
* @param {object} options The dhcp client configuration.
* @param {function} callback The callback function.
* @returns {process} The child process.
* @example
*
* var udhcpc = require('wireless-tools/udhcpc');
*
* var options = {
* interface: 'wlan0'
* };
*
* udhcpc.enable(options, function(err) {
* // the dhcp client was started
* });
*
*/
function enable(options, callback) {
var command = 'udhcpc -i ' + options.interface + ' -n';
return this.exec(command, callback);
}

146
tests/node_modules/wireless-tools/udhcpd.js generated vendored Normal file
View File

@ -0,0 +1,146 @@
/*
* Copyright (c) 2015 Christopher M. Baker
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
var child_process = require('child_process');
/**
* The **udhcpd** command is used to configure a dhcp server for a
* network interface.
*
* @static
* @category udhcpd
*
*/
var udhcpd = module.exports = {
exec: child_process.exec,
disable: disable,
enable: enable
};
/**
* Recursively expand `options` into `lines` with a `prefix`.
*
* @private
* @static
* @category udhcpd
* @param {object} options The dhcp server configuration.
* @param {array} lines The lines of the configuration file.
* @param {array) prefix The key prefix.
*
*/
function expand_r(options, lines, prefix) {
Object.getOwnPropertyNames(options).forEach(function(key) {
var full = prefix.concat(key);
var value = options[key];
if (Array.isArray(value)) {
value.forEach(function(val) {
lines.push(full.concat(val).join(' '));
});
}
else if (typeof(value) == 'object') {
expand_r(value, lines, full);
}
else {
lines.push(full.concat(value).join(' '));
}
});
}
/**
* Convert dhcp server configuration options to a configuration file.
*
* @private
* @static
* @category udhcpd
* @param {object} options The dhcp server configuration.
* @returns {array} The lines of the configuration file.
*
*/
function expand(options) {
var lines = [];
expand_r(options, lines, []);
return lines;
}
/**
* The **udhcpd enable** command is used to start a dhcp server on a
* specific network interface.
*
* @static
* @category udhcpd
* @param {object} options The dhcp server configuration.
* @param {function} callback The callback function.
* @returns {process} The child process.
* @example
*
* var udhcpd = require('wireless-tools/udhcpd');
*
* var options = {
* interface: 'wlan0',
* start: '192.168.10.100',
* end: '192.168.10.200',
* option: {
* router: '192.168.10.1',
* subnet: '255.255.255.0',
* dns: [ '4.4.4.4', '8.8.8.8' ]
* }
* };
*
* udhcpd.enable(options, function(err) {
* // the dhcp server was started
* });
*
*/
function enable(options, callback) {
var file = options.interface + '-udhcpd.conf';
var commands = [].concat(
'cat <<EOF >' + file + ' && udhcpd ' + file + ' && rm -f ' + file,
expand(options));
return this.exec(commands.join('\n'), callback);
}
/**
* The **udhcpd disable** command is used to stop a dhcp server on a
* specific network interface.
*
* @static
* @category udhcpd
* @param {string} interface The network interface.
* @param {function} callback The callback function.
* @returns {process} The child process.
* @example
*
* var udhcpd = require('wireless-tools/udhcpd');
*
* udhcpd.disable('wlan0', function(err) {
* // the dhcp server was stopped
* });
*
*/
function disable(interface, callback) {
var file = interface + '-udhcpd.conf';
return this.exec('kill `pgrep -f "^udhcpd ' + file + '"` || true', callback);
}

34
tests/node_modules/wireless-tools/wireless-tools.js generated vendored Normal file
View File

@ -0,0 +1,34 @@
/*
* Copyright (c) 2015 Christopher M. Baker
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
var wireless_tools = module.exports = {
hostapd: require('./hostapd'),
ifconfig: require('./ifconfig'),
iwconfig: require('./iwconfig'),
iwlist: require('./iwlist'),
iw: require('./iw'),
udhcpc: require('./udhcpc'),
udhcpd: require('./udhcpd'),
wpa: require('./wpa_cli'),
wpa_supplicant: require('./wpa_supplicant')
};

416
tests/node_modules/wireless-tools/wpa_cli.js generated vendored Normal file
View File

@ -0,0 +1,416 @@
/*
* Copyright (c) 2015 Christopher M. Baker
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
var child_process = require('child_process');
/**
* The **wpa_cli** command is used to configure wpa network interfaces.
*
* @private
* @category wpa_cli
*
*/
var wpa_cli = module.exports = {
exec: child_process.exec,
status: status,
bssid: bssid,
reassociate: reassociate,
set: set,
add_network: add_network,
set_network: set_network,
enable_network: enable_network,
disable_network: disable_network,
remove_network: remove_network,
select_network: select_network,
scan: scan,
scan_results: scan_results,
save_config: save_config
};
/**
* Parses the status for a wpa network interface.
*
* @private
* @static
* @category wpa_cli
* @param {string} block The section of stdout for the interface.
* @returns {object} The parsed wpa status.
*
*/
function parse_status_block(block) {
var match;
var parsed = {};
if ((match = block.match(/bssid=([A-Fa-f0-9:]{17})/))) {
parsed.bssid = match[1].toLowerCase();
}
if ((match = block.match(/freq=([0-9]+)/))) {
parsed.frequency = parseInt(match[1], 10);
}
if ((match = block.match(/mode=([^\s]+)/))) {
parsed.mode = match[1];
}
if ((match = block.match(/key_mgmt=([^\s]+)/))) {
parsed.key_mgmt = match[1].toLowerCase();
}
if ((match = block.match(/[^b]ssid=([^\n]+)/))) {
parsed.ssid = match[1];
}
if ((match = block.match(/[^b]pairwise_cipher=([^\n]+)/))) {
parsed.pairwise_cipher = match[1];
}
if ((match = block.match(/[^b]group_cipher=([^\n]+)/))) {
parsed.group_cipher = match[1];
}
if ((match = block.match(/p2p_device_address=([A-Fa-f0-9:]{17})/))) {
parsed.p2p_device_address = match[1];
}
if ((match = block.match(/wpa_state=([^\s]+)/))) {
parsed.wpa_state = match[1];
}
if ((match = block.match(/ip_address=([^\n]+)/))) {
parsed.ip = match[1];
}
if ((match = block.match(/[^_]address=([A-Fa-f0-9:]{17})/))) {
parsed.mac = match[1].toLowerCase();
}
if ((match = block.match(/uuid=([^\n]+)/))) {
parsed.uuid = match[1];
}
if ((match = block.match(/[^s]id=([0-9]+)/))) {
parsed.id = parseInt(match[1], 10);
}
return parsed;
}
/**
* Parses the result for a wpa command over an interface.
*
* @private
* @static
* @category wpa_cli
* @param {string} block The section of stdout for the command.
* @returns {object} The parsed wpa command result.
*
*/
function parse_command_block(block) {
var match;
var parsed = {
result: block.match(/^([^\s]+)/)[1]
};
return parsed;
}
/**
* Parses the status for a wpa wireless network interface.
*
* @private
* @static
* @category wpa_cli
* @param {function} callback The callback function.
*
*/
function parse_status_interface(callback) {
return function(error, stdout, stderr) {
if (error) {
callback(error);
} else {
callback(error, parse_status_block(stdout.trim()));
}
};
}
/**
* Parses the result for a wpa command over an interface.
*
* @private
* @static
* @category wpa_cli
* @param {function} callback The callback function.
*
*/
function parse_command_interface(callback) {
return function(error, stdout, stderr) {
if (error) {
callback(error);
} else {
var output = parse_command_block(stdout.trim());
if (output.result === 'FAIL') {
callback(new Error(output.result));
} else {
callback(error, parse_command_block(stdout.trim()));
}
}
};
}
/**
* Parses the results of a scan_result request.
*
* @private
* @static
* @category wpa_cli
* @param {string} block The section of stdout for the interface.
* @returns {object} The parsed scan results.
*/
function parse_scan_results(block) {
var match;
var results = [];
var lines;
lines = block.split('\n').map(function(item) { return item + "\n"; });
lines.forEach(function(entry){
var parsed = {};
if ((match = entry.match(/([A-Fa-f0-9:]{17})\t/))) {
parsed.bssid = match[1].toLowerCase();
}
if ((match = entry.match(/\t([\d]+)\t+/))) {
parsed.frequency = parseInt(match[1], 10);
}
if ((match = entry.match(/([-][0-9]+)\t/))) {
parsed.signalLevel = parseInt(match[1], 10);
}
if ((match = entry.match(/\t(\[.+\])\t/))) {
parsed.flags = match[1];
}
if ((match = entry.match(/\t([^\t]{1,32}(?=\n))/))) {
parsed.ssid = match[1];
}
if(!(Object.keys(parsed).length === 0 && parsed.constructor === Object)){
results.push(parsed);
}
});
return results;
}
/**
* Parses the status for a scan_results request.
*
* @private
* @static
* @category wpa_cli
* @param {function} callback The callback function.
*
*/
function parse_scan_results_interface(callback) {
return function(error, stdout, stderr) {
if (error) {
callback(error);
} else {
callback(error, parse_scan_results(stdout.trim()));
}
};
}
/**
* Parses the status for wpa network interface.
*
* @private
* @static
* @category wpa
* @param {string} [interface] The wireless network interface.
* @param {function} callback The callback function.
* @example
*
* var wpa_cli = require('wireless-tools/wpa_cli');
*
* wpa_cli.status('wlan0', function(err, status) {
* console.dir(status);
* wpa_cli.bssid('wlan0', '2c:f5:d3:02:ea:dd', 'Fake-Wifi', function(err, data){
* console.dir(data);
* wpa_cli.bssid('wlan0', 'Fake-Wifi', '2c:f5:d3:02:ea:dd', function(err, data){
* if (err) {
* console.dir(err);
* wpa_cli.reassociate('wlan0', function(err, data) {
* console.dir(data);
* });
* }
* });
* });
* });
*
*
*
* // =>
* {
* bssid: '2c:f5:d3:02:ea:d9',
* frequency: 2412,
* mode: 'station',
* key_mgmt: 'wpa2-psk',
* ssid: 'Fake-Wifi',
* pairwise_cipher: 'CCMP',
* group_cipher: 'CCMP',
* p2p_device_address: 'e4:28:9c:a8:53:72',
* wpa_state: 'COMPLETED',
* ip: '10.34.141.168',
* mac: 'e4:28:9c:a8:53:72',
* uuid: 'e1cda789-8c88-53e8-ffff-31c304580c1e',
* id: 0
* }
*
* OK
*
* FAIL
*
* OK
*
*/
function status(interface, callback) {
var command = [ 'wpa_cli -i', interface, 'status'].join(' ');
return this.exec(command, parse_status_interface(callback));
}
function bssid(interface, ap, ssid, callback) {
var command = ['wpa_cli -i', interface, 'bssid', ssid, ap].join(' ');
return this.exec(command, parse_command_interface(callback));
}
function reassociate(interface, callback) {
var command = ['wpa_cli -i',
interface,
'reassociate'].join(' ');
return this.exec(command, parse_command_interface(callback));
}
/* others commands not tested
//ap_scan 1
// set_network 0 0 scan_ssid 1
// set: set,
// add_network: add_network,
// set_network: set_network,
// enable_network: enable_network
*/
function set(interface, variable, value, callback) {
var command = ['wpa_cli -i',
interface,
'set',
variable,
value ].join(' ');
return this.exec(command, parse_command_interface(callback));
}
function add_network(interface, callback) {
var command = ['wpa_cli -i',
interface,
'add_network' ].join(' ');
return this.exec(command, parse_command_interface(callback));
}
function set_network(interface, id, variable, value, callback) {
var command = ['wpa_cli -i',
interface,
'set_network',
id,
variable,
value ].join(' ');
return this.exec(command, parse_command_interface(callback));
}
function enable_network(interface, id, callback) {
var command = ['wpa_cli -i',
interface,
'enable_network',
id ].join(' ');
return this.exec(command, parse_command_interface(callback));
}
function disable_network(interface, id, callback) {
var command = ['wpa_cli -i',
interface,
'disable_network',
id ].join(' ');
return this.exec(command, parse_command_interface(callback));
}
function remove_network(interface, id, callback) {
var command = ['wpa_cli -i',
interface,
'remove_network',
id ].join(' ');
return this.exec(command, parse_command_interface(callback));
}
function select_network(interface, id, callback) {
var command = ['wpa_cli -i',
interface,
'select_network',
id ].join(' ');
return this.exec(command, parse_command_interface(callback));
}
function scan(interface, callback) {
var command = ['wpa_cli -i',
interface,
'scan'].join(' ');
return this.exec(command, parse_command_interface(callback));
}
function scan_results(interface, callback) {
var command = ['wpa_cli -i',
interface,
'scan_results'].join(' ');
return this.exec(command, parse_scan_results_interface(callback));
}
function save_config(interface, callback) {
var command = ['wpa_cli -i',
interface,
'save_config'].join(' ');
return this.exec(command, parse_command_interface(callback));
}

122
tests/node_modules/wireless-tools/wpa_supplicant.js generated vendored Normal file
View File

@ -0,0 +1,122 @@
/*
* Copyright (c) 2015 Christopher M. Baker
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
var child_process = require('child_process');
/**
* The **wpa_supplicant** command is used to configure a wireless
* network connection for a network interface.
*
* @static
* @category wpa_supplicant
*
*/
var wpa_supplicant = module.exports = {
exec: child_process.exec,
disable: disable,
enable: enable,
manual: manual
};
/**
* The **wpa_supplicant disable** command is used to disconnect from
* a wireless network on a specific network interface.
*
* @static
* @category wpa_supplicant
* @param {string} interface The network interface.
* @param {function} callback The callback function.
* @returns {process} The child process.
* @example
*
* var wpa_supplicant = require('wireless-tools/wpa_supplicant');
*
* wpa_supplicant.disable('wlan0', function(err) {
* // disconnected from wireless network
* });
*
*/
function disable(interface, callback) {
var command = 'kill `pgrep -f "wpa_supplicant -i ' +
interface + ' .*"` || true';
return this.exec(command, callback);
}
/**
* The **wpa_supplicant enable** command is used to join a wireless network
* on a specific network interface.
*
* @static
* @category wpa_supplicant
* @param {object} options The wireless network configuration.
* @param {function} callback The callback function.
* @returns {process} The child process.
* @example
*
* var wpa_supplicant = require('wireless-tools/wpa_supplicant');
*
* var options = {
* interface: 'wlan0',
* ssid: 'RaspberryPi',
* passphrase: 'raspberry',
* driver: 'wext'
* };
*
* wpa_supplicant.enable(options, function(err) {
* // connected to the wireless network
* });
*
*/
function enable(options, callback) {
var file = options.interface + '-wpa_supplicant.conf';
var command = 'wpa_passphrase "' + options.ssid + '" "' + options.passphrase
+ '" > ' + file + ' && wpa_supplicant -i ' + options.interface + ' -B -D '
+ options.driver + ' -c ' + file + ' && rm -f ' + file;
return this.exec(command, callback);
}
/**
* launchs wpa manually (as if it were launched by ifup if interface wpa setup
* was done in /network/interfaces)
* /sbin/wpa_supplicant -s -B -P /run/wpa_supplicant.wlan0.pid -i wlan0 -D nl80211,wext -C /run/wpa_supplicant
* options = {
* interface: 'wlan0',
* drivers: [ 'nl80211', 'wext' ]
* }
*/
function manual(options, callback) {
var command = [
'wpa_supplicant',
'-i', options.interface,
'-s -B -P /run/wpa_supplicant/' + options.interface + '.pid',
'-D', options.drivers.join(','),
'-C /run/wpa_supplicant'
].join(' ');
return this.exec(command, callback);
}

9
tests/package.json Normal file
View File

@ -0,0 +1,9 @@
{
"name": "wifi-setup-test",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"dependencies": {
"wireless-tools": "^0.19.0"
}
}

8
tests/yarn.lock Normal file
View File

@ -0,0 +1,8 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
wireless-tools@^0.19.0:
version "0.19.0"
resolved "https://registry.yarnpkg.com/wireless-tools/-/wireless-tools-0.19.0.tgz#67fb73cd371f2d9ba3b9ef253400a31f8c784b11"
integrity sha512-WlD5YsEx2FkjuDkQ05XuLmFMxe8r+Hf+EWitReXz44USu1Bi2BahFH7Qr7ttzTlHLLfnHezzHts5ruHRegbMEQ==