• Stars
    star
    213
  • Rank 185,410 (Top 4 %)
  • Language
    JavaScript
  • Created over 12 years ago
  • Updated over 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

DEFUNCT: Node.js: WiFi Connection Management

node-wireless

A utility for handling interactions with wireless interfaces on *nix distributions.

Goals

This Node.js module will eventually provide all of the following features:

  • Get a list of visible networks ✓
  • Display info about connected network ✓
  • Display different information about other networks, e.g. strength ✓
  • Disconnect from network ✓
  • Connect to open networks ✓
  • Connect to secure networks, providing credentials or certificate
  • Trigger an event when a new network appears ✓
  • Trigger an event when a network changes ✓
  • Trigger an event when a network disappears or lose connection ✓

Basically, this class should be able to do anything a user would be able to do using their OS's network configuration tools.

Currently there is a dependency on the tool wpa_supplicant being installed. This module actually executes that utility many times to get results. Eventually we'll move to a D-Bus based approach (#19) which will result in much quicker results and fewer dependencies.

Installation

npm install wireless

Usage

var wireless = new Wireless({
    iface: 'wlan0',
	updateFrequency: 10, // Optional, seconds to scan for networks
	connectionSpyFrequency: 2, // Optional, seconds to scan if connected
	vanishThreshold: 2 // Optional, how many scans before network considered gone
});

wireless.enable(function(err) {
	wireless.start();
});

Events

  • appear: A never-before seen network has appeared
  • change: A seen wireless network has changed properties (e.g. SSID or encryption)
  • signal: A seen wireless network has it's signal change (e.g. strength or quality)
  • vanish: A seen network has been determined to no longer be accessible
  • empty: A network scan was executed but nothing was discovered
  • error: Something bad has happened
  • command: Debugging: Emits the shell command about to be executed
  • batch: Debugging: Raw information about all networks from the last batch scan
  • join: The interface has connected to a new network
  • former: The interface had been connected to a network before Wireless ran
  • dhcp: An IP address has been assigned via DHCP
  • leave: The interface has left the network it was connected to
  • stop: The interface is no longer looking for networks

Methods

  • Constructor(config): Creates a new Wireless instance
  • enable(cb): Enables the wireless interface
  • start(): Begins the scanning
  • join(network, pwd, cb): Attempts to join the specified network
  • dhcp(cb): Attempts to enable DHCP for the interface and get an IP Address
  • dhcpStop(cb): Attempts to stop the DHCP process
  • leave(cb): Attempts to leave the specified network
  • stop(cb): Stops the scanning process
  • disable(cb): Disables the wireless interface
  • list(): Gets a list of all the currently visible networks

Current Status

Currently, enabling/disabling adapter works, finding new networks will trigger events, able to read encryption method and other data, and disappearing networks trigger events, able to enable and disable dhcp, able to connect to unsecure networks.

$ ./examples/scan-connect-disconnect.js wlan0
[PROGRESS] Enabling wireless card...
[PROGRESS] Wireless card enabled.
[PROGRESS] Starting wireless scan...
[PROGRESS] Wireless scanning has commenced.
[  APPEAR] Zen Buddhist Temple Public [00:27:22:14:DB:84] 64% -65 dBm NONE
[  APPEAR] ArborMesh-ch1 [0A:B3:85:5F:45:99] 62% -66 dBm NONE
[  APPEAR] AHOPS [00:23:A2:DE:4A:B0] 100% -14 dBm WPA&WPA2
[  APPEAR] ArborMesh [62:3D:28:71:4F:79] 100% -28 dBm NONE
[  APPEAR] dOpsInternal [00:0C:41:36:A3:F6] 100% -25 dBm WPA
[  APPEAR] Zen Buddhist Temple Public [F8:D1:11:47:EE:4A] 100% -17 dBm NONE
[  APPEAR] Zen Buddhist Temple Private [FA:D1:11:47:EE:4B] 100% -28 dBm WPA2
[  APPEAR] Zen Buddhist Temple Public [F8:D1:11:54:A9:DE] 100% -23 dBm NONE
[  APPEAR] Zen Buddhist Temple Private [FA:D1:11:54:A9:DF] 91% -46 dBm WPA2
[  APPEAR] ATT200 [CC:7D:37:81:0F:20] 68% -62 dBm WPA&WPA2
Yay, we connected! I will try to get an IP.
[    JOIN] Zen Buddhist Temple Public [00:27:22:14:DB:84] 
[    DHCP] Leased IP 10.88.0.58
Yay, I got an IP address (10.88.0.58)! I'm going to disconnect in 20 seconds.
[  LEVELS] Zen Buddhist Temple Public
[  LEVELS] ArborMesh-ch1
[  LEVELS] AHOPS
[  LEVELS] ArborMesh
[  LEVELS] dOpsInternal
[  LEVELS] Zen Buddhist Temple Public
[  LEVELS] Zen Buddhist Temple Private
[  LEVELS] Zen Buddhist Temple Public
[  LEVELS] ATT200
20 seconds are up! Attempting to turn off DHCP...
DHCP has been turned off. Leaving the network...
[   LEAVE] Left the network
[  LEVELS] Zen Buddhist Temple Public
[  LEVELS] ArborMesh-ch1
[  LEVELS] AHOPS
[  LEVELS] ArborMesh
[  LEVELS] dOpsInternal
[  LEVELS] Zen Buddhist Temple Public
[  LEVELS] Zen Buddhist Temple Public
[  APPEAR] Zen Buddhist Temple Private [02:27:22:14:DB:85] 100% -20 dBm WPA2
[  LEVELS] Zen Buddhist Temple Private
[  APPEAR] 2WIRE163 [00:1F:B3:6B:97:D9] 75% -57 dBm WEP
^C[PROGRESS] Gracefully shutting down from SIGINT (Ctrl+C)
[PROGRESS] Disabling Adapter...
[PROGRESS] Stopping Wireless App...
[PROGRESS] Exiting...

Requirements

Needs wpa_supplicant, a wireless card which can see a list of available networks.

Assumptions

  • We assume that DHCP isn't enabled on the wireless device by default.
  • I've only tried this on Arch and Debian Linux.
  • I've only tried this using a wireless card with the RTL8187 and rt2800usb chipsets.

License

Dual MIT/GPL

More Repositories

1

Cobalt-Calibur-3

DEFUNCT: HTML5 and Node.js multiplayer browser game from 2013
JavaScript
470
star
2

neoinvoice

DEFUNCT: PHP/MySQL: Multi-Tenant Invoice Web App
PHP
387
star
3

vimrc

Opinionated VIM Configuration
Vim Script
321
star
4

consumer-centric-api-design

Book on HTTP API Design, LaTeX, Creative Commons
TeX
320
star
5

distributed-node

Optional Companion Files for Distributed Systems with Node.js
JavaScript
184
star
6

spidermonkey

DEFUNCT: PHP Web Spider from 2011
PHP
99
star
7

node-arpad

An implementation of the ELO Rating System
JavaScript
96
star
8

i3-i3status-dmenu-configurator

Online Colorscheme Configurator for i3, i3status, dmenu
JavaScript
58
star
9

node-roguelike

Generate Top-Down 2D Dungeon Maps
JavaScript
51
star
10

game-of-life

JavaScript implementation of Conway's Game of Life but with Game Elements
JavaScript
50
star
11

mobile-game-skeleton

Cordova Skeleton Project, used for creating Strategic Game of Life
Objective-C
47
star
12

consul-haproxy-example

HAProxy load balancing Node.js apps discovered via Consul
JavaScript
44
star
13

sleekmvc-app

DEFUNCT: Sample Application using the SleekMVC Framework
PHP
33
star
14

whisper

This project has evolved into Radar Chat.
JavaScript
19
star
15

sleekmvc

DEFUNCT: Lightweight & Beginner Friendly PHP MVC Framework
PHP
18
star
16

mig

The Universal Database Migration Runner. Distributed as precompiled binaries.
Go
16
star
17

node-autotile

JavaScript Autotile Generator
JavaScript
14
star
18

node-grille

Google Spreadsheets CMS
JavaScript
12
star
19

node-news-daemon

Node.js app based on the book Daemon by Daniel Suarez
JavaScript
11
star
20

backbone-book

Code Samples for Instant Backbone.js Application Development
JavaScript
11
star
21

robot-onslaught

Entry into the PubNub 2014 Competition
JavaScript
10
star
22

node-gacha

Item drop distribution for Roguelikes
JavaScript
9
star
23

php-social-network-bot

DEFUNCT: AJAX social network bot I cobbled together in 2009
JavaScript
6
star
24

dotfiles

Configuration files for Linux and OS X
Shell
5
star
25

Cobalt-Calibur-2

DEFUNCT: PHP/MySQL AJAX Game Engine from 2006
PHP
5
star
26

facebook-squirrelify

DEFUNCT: This is a silly image editing Facebook app I built in 2009
PHP
5
star
27

plot-designer

Plot Designer: Drag and Drop Story Design
JavaScript
4
star
28

node-docs-pdf

Generate PDF docs from online Node.js documentation
JavaScript
4
star
29

php-and-redis-example

Example PHP and REDIS project for the Ann Arbor PHP MySQL Meetup
PHP
4
star
30

dumbpubsub

Allows non-evented apps to subscribe to Node.js events over HTTP
JavaScript
3
star
31

node-discovery

100 line Service Discovery example
JavaScript
3
star
32

nucleocide-gtk

BSM Simple Dark (GTK2) + Dorian (GTK3) Theme
CSS
3
star
33

node-rpc-playground

Benchmarking Node.js RPC Patterns
JavaScript
3
star
34

php-eve-crawler

DEFUNCT: PHP App for crawling EVE kill-mail websites and creating heatmaps. 2009
PHP
3
star
35

node-nextplayer

Redis backed Round-Robin player turn control
JavaScript
3
star
36

node-word-generator

Generate pseudo-English words
JavaScript
2
star
37

take-home-test-node-trie

Teaching a friend how to implement Tries in JS
JavaScript
2
star
38

php-wordpress-thomashunter-theme

Wordpress theme for ThomasHunter.name
PHP
2
star
39

tlhunter

GitHub Profile
2
star
40

take-home-test-httpd-logs

Real-time statistics from httpd log files
JavaScript
2
star
41

gqrx-bookmarks

Bookmarks for GQRX: Community Broadcast CB, Family Radio, etc.
JavaScript
2
star
42

interview-questions

JavaScript, Node, Web-related questions, one per file, open ended
JavaScript
2
star
43

http-euchre

1
star
44

php-batman

Batman Comic Generator
PHP
1
star
45

presentations

Presentations by Thomas Hunter II
JavaScript
1
star
46

rust-transactional-dictionary

Rust
1
star
47

obsceneart

DEFUNCT: PHP/CodeIgniter Project from 2011
PHP
1
star
48

acdbrn

DEFUNCT: Open Source PHP Content Management System from 2005
JavaScript
1
star
49

wifi-jiggle

Much like a toilet, sometimes those WiFi cards just need to have their handle jiggled
C
1
star
50

node-zipkin-lite

Node.js module supporting a subset of Zipkin features
JavaScript
1
star
51

ponzir

Anonymous Reputation-Based Distributed Worker Network
JavaScript
1
star
52

Cobalt-Calibur-1

DEFUNCT: Perl CLI game I made in 2004
Perl
1
star