npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

wpa-wifi

v0.4.4

Published

wpa wifi controller

Downloads

7

Readme

Wpa-wifi

WpaCli to control wpa_supplicant

Install:

npm install wpa-wifi --save

Note:

This only works on linux, tested on ubuntu 14.4 and debian jesse. you need to have wpa_supplicant installed , run using sudo and running with wpa_spplicant having config : ctrl_interface=/var/run/wpa_supplicant

For More example see test directory for p2p and wifi connection samples. This is a very basic library, it is nessary to write another wrapper over this.

Reference: http://w1.fi/wpa_supplicant/devel/ctrl_iface_page.html

Example: Wifi Connection

  'use strict';
  const WpaCli = require('wpa-wifi');
  var wpa = new WpaCli('wlan0');
  wpa.on('ready', function() {
      console.log('ready');
      wpa.listNetworks();
      wpa.addNetwork();
      wpa.setSSID(0, 'ssid');
      wpa.setPassword(0, 'password');
      wpa.enableNetwork(0);
      wpa.selectNetwork(0);
  });

  wpa.connect();


  wpa.on('status', function(status) {
      console.log(status);
  });
  wpa.on('scan_results', function(scanResults) {
      console.log(scanResults);
  });
  wpa.on('list_network', function(networks) {
      console.log(networks);
  });
  wpa.on('raw_msg', function(msg) {
      console.log(msg);
  });

API Documention:

WpaCli

WpaCli to control wpa_supplicant

Kind: global class

new WpaCli(ifName)

constructs WpaCli

| Param | Type | Description | | --- | --- | --- | | ifName | String | interface name eg. wlan0 |

wpaCli.connect()

connect to wpa control interface

Kind: instance method of WpaCli

wpaCli._onConnect()

connect event handler

Kind: instance method of WpaCli

wpaCli._onMessage(msg)

message event handler

Kind: instance method of WpaCli

| Param | Type | Description | | --- | --- | --- | | msg | Buffer | message recieved from wpa_ctrl |

wpaCli._onCtrlEvent(msg)

control event handler

Kind: instance method of WpaCli

| Param | Type | Description | | --- | --- | --- | | msg | String | control event messages |

wpaCli._onError(err)

error event handler

Kind: instance method of WpaCli

| Param | Type | Description | | --- | --- | --- | | err | String | error message |

wpaCli._onCongestion(err)

congestion event handler

Kind: instance method of WpaCli

| Param | Type | Description | | --- | --- | --- | | err | String | congestion error message |

wpaCli._onListening()

listening event handler

Kind: instance method of WpaCli

wpaCli.sendCmd(msg)

send request to wpa_cli

Kind: instance method of WpaCli

| Param | Type | Description | | --- | --- | --- | | msg | String | wpa_cli commands |

wpaCli.scan()

scan for wifi AP

Kind: instance method of WpaCli

wpaCli.scanResults()

request for wifi scan results

Kind: instance method of WpaCli

wpaCli._onScanResult(msg)

scan results handler

Kind: instance method of WpaCli

| Param | Type | Description | | --- | --- | --- | | msg | String | scan results message |

wpaCli._onRawMsg(msg)

raw message handler from wpa_cli, captures all messages by default for debuging purposes

Kind: instance method of WpaCli

| Param | Type | Description | | --- | --- | --- | | msg | String | wpa messages |

wpaCli._onListNetwork(msg)

list network handler, list all configured networks or devices

Kind: instance method of WpaCli

| Param | Type | Description | | --- | --- | --- | | msg | String | network or devices list |

wpaCli.addNetwork()

add new network

Kind: instance method of WpaCli

wpaCli.listNetworks()

request to list networks

Kind: instance method of WpaCli

wpaCli.status()

request for status

Kind: instance method of WpaCli

wpaCli._onStatus(msg)

status handler, parses status messages and emits status event

Kind: instance method of WpaCli

| Param | Type | Description | | --- | --- | --- | | msg | String | status message |

wpaCli.setSSID(networkId, add)

set network ssid

Kind: instance method of WpaCli

| Param | Type | Description | | --- | --- | --- | | networkId | String | network id recieved from list networks | | add | String | ssid to network |

wpaCli.setPassword(networkId, password)

set network password

Kind: instance method of WpaCli

| Param | Type | Description | | --- | --- | --- | | networkId | String | networkId network id recieved from list networks | | password | String | add ssid to network |

wpaCli.enableNetwork(networkId)

enable configured network

Kind: instance method of WpaCli

| Param | Type | Description | | --- | --- | --- | | networkId | string | networkId network id recieved from list networks |

wpaCli.selectNetwork(networkId)

select network to connect

Kind: instance method of WpaCli

| Param | Type | Description | | --- | --- | --- | | networkId | String | networkId network id recieved from list networks |

wpaCli._onApConnected()

AP connected event handler

Kind: instance method of WpaCli

wpaCli._onApDisconnected()

AP disconnect event handler

Kind: instance method of WpaCli

wpaCli.startDhclient()

start dhclient for interface

Kind: instance method of WpaCli

wpaCli.stopDhclient()

stop dhclient for interface

Kind: instance method of WpaCli

wpaCli.disconnectAP()

disconnect from AP

Kind: instance method of WpaCli

wpaCli.peerFind()

search for peers

Kind: instance method of WpaCli

wpaCli.peerList()

list avaliable peers

Kind: instance method of WpaCli

wpaCli.peerStopFind()

stop peer search

Kind: instance method of WpaCli

wpaCli.peerInfo(peerAddress)

fetch Peer Information

Kind: instance method of WpaCli

| Param | Type | Description | | --- | --- | --- | | peerAddress | String | peer device address |

wpaCli.peerConnectPBC(peerAddress, isOwner)

connect to peer with PBC(Push Button Control) authentication mechanism

Kind: instance method of WpaCli

| Param | Type | Description | | --- | --- | --- | | peerAddress | String | Mac Address of peer | | isOwner | Boolean | Your role, are you group owner? if yes then true else false |

wpaCli.peerConnectPIN(peerAddress, pin, isOwner)

connect to peer with PIN(password) authentication mechanism

Kind: instance method of WpaCli

| Param | Type | Description | | --- | --- | --- | | peerAddress | String | Mac Address of peer | | pin | String | password for authentication | | isOwner | Boolean | Your role, are you group owner? if yes then true else false |

wpaCli._onNewPeerFound(msg)

new peer event handler

Kind: instance method of WpaCli

| Param | Type | Description | | --- | --- | --- | | msg | String | event message |

wpaCli._onPeerDisconnect(msg)

peer disconnection event handler

Kind: instance method of WpaCli

| Param | Type | Description | | --- | --- | --- | | msg | String | event message |

wpaCli._onPeerInfo(msg)

peer info event handler

Kind: instance method of WpaCli

| Param | Type | Description | | --- | --- | --- | | msg | String | event message |

wpaCli.listInterfaces(callback)

list network interfaces on system

Kind: instance method of WpaCli

| Param | Type | Description | | --- | --- | --- | | callback | function | callback with list of interface |

wpaCli._onPeerConnected()

peer connected handler

Kind: instance method of WpaCli