Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

airdrome

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

airdrome - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

lib/airdrome.js

2

bin/index.js
#!/usr/bin/env node
var path = require('path');
require(path.join('../index'));
require(path.join('../airdrome'));

@@ -1,99 +0,1 @@

var program = require('commander');
var packageJson = require('./package.json');
var spawn = require('child_process').spawn;
var child;
var airportBin = '/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport';
// Specific verion: '/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport'
var networkSetupBin = '/usr/sbin/networksetup';
var device = 'en0';
program
.version(packageJson.version)
.option('scan, list', 'List available networks')
.option('preferred', 'List preferred networks')
.option('preferred add <network name> <security type> [password]', 'Add preferred network')
.option('preferred remove <network name>', 'Remove preferred network')
.option('connect <ssid> [password]', 'Connect to network')
.option('info', 'Display current network info')
.option('power [on|off]', 'Turn wifi on or off')
.option('disconnect', 'Disconnect from current network (may require root)')
.option('channel [channel]', 'Change channel of current network (may require root)')
.option('network', 'Display current network name')
.option('hardwareports', 'List all hardware ports (useful for finding device interface name)')
.parse(process.argv);
if (program.list) {
console.log('This may take a few seconds...\n');
child = spawn(airportBin,
['scan']); // -s also works
}
if (program.info) {
child = spawn(airportBin,
['--getinfo']); // -I also works
}
if (program.connect) {
var ssid = program.connect;
var password = program.args[0];
console.log('This may take a few seconds...\n');
child = spawn(networkSetupBin,
['-setairportnetwork', device, ssid].concat(password||[]));
}
if (program.power) {
var state = program.power;
child = spawn(networkSetupBin,
['-setairportpower', device, state]);
}
if (program.hardwareports) {
child = spawn(networkSetupBin,
['-listallhardwareports']);
}
if (program.network) {
child = spawn(networkSetupBin,
['-getairportnetwork', device]);
}
if (program.disconnect) {
child = spawn(airportBin,
['--disassociate']); // -z also works
}
if (program.channel) {
var channel = program.channel;
child = spawn(airportBin,
['--channel'.concat(channel ? '=' + channel : '')]); // -c also works
}
if (program.preferred) {
if (program.add) {
var network = program.add;
var securityType = program.args[0];
var password = program.args[1];
var index = 0;
child = spawn(networkSetupBin,
['-addpreferredwirelessnetworkatindex', device, network, index, securityType].concat(password||[]));
} else if (program.remove) {
var network = program.remove;
if (network === 'all') {
child = spawn(networkSetupBin,
['-removeallpreferredwirelessnetworks', device]);
} else {
child = spawn(networkSetupBin,
['-removepreferredwirelessnetwork', device, network]);
}
} else {
child = spawn(networkSetupBin,
['-listpreferredwirelessnetworks', device]);
}
}
if (program.rawArgs.length > 2) {
child.stdout.pipe(process.stdout);
child.stderr.pipe(process.stderr);
}
require('./lib/airdrome');
{
"name": "airdrome",
"version": "0.0.1",
"description": "CLI for Wifi management",
"main": "index.js",
"version": "0.0.2",
"description": "CLI for wifi management",
"main": "airdrome.js",
"scripts": {

@@ -10,3 +10,3 @@ "test": "tape test/*.js"

"bin": {
"airdrome": "bin/index.js"
"airdrome": "bin/airdrome.js"
},

@@ -13,0 +13,0 @@ "repository": {

# Airdrome
CLI for Wi-Fi management. Basically a wrapper for `airport` and `networksetup` on Mac OS X.
CLI for wifi management. Basically a wrapper for `airport` and `networksetup` on Mac OS X.

@@ -16,23 +16,41 @@ # Install

Usage: index [options]
Usage: index [options] [command]
Commands:
list|scan List available networks
preferred [options] [action] List preferred networks. Or add or remove preferred network
connect [options] <ssid> Connect to network
info Display current network info
power [options] [on|off] Turn wifi on or off
disconnect Disconnect from current network (may require root)
network [options] Display current network name
hardwareports List all hardware ports (useful for finding device interface name)
channel [channel] Change channel of current network (may require root)
Options:
-h, --help output usage information
-V, --version output the version number
scan, list List available networks
preferred List preferred networks
preferred add <network name> <security type> [password] Add preferred network
preferred remove <network name> Remove preferred network
connect <ssid> [password] Connect to network
info Display current network info
power [on|off] Turn wifi on or off
disconnect Disconnect from current network (may require root)
channel [channel] Change channel of current network (may require root)
network Display current network name
hardwareports List all hardware ports (useful for finding device interface name)
-h, --help output usage information
-V, --version output the version number
```
More help for a command:
```
$ airdrome connect --help
Usage: connect [options] <ssid>
Connect to network
Options:
-h, --help output usage information
-d, --device [device] Device interface to use (default is en0)
-p, --password [password] Network Password
```
# License
MIT
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc