Socket
Socket
Sign inDemoInstall

osx-wifi-cli

Package Overview
Dependencies
2
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.3 to 1.1.0

.eslintignore

2

npm-shrinkwrap.json
{
"name": "osx-wifi-cli",
"version": "1.0.3",
"version": "1.1.0",
"dependencies": {

@@ -5,0 +5,0 @@ "commander": {

@@ -12,3 +12,3 @@ #!/usr/bin/env node

.version(version)
.usage('[on | off | restart | scan | <network> <password>]')
.usage('[on | off | restart | scan | pass | <network> <password>]')
.option('on', 'turn wifi on')

@@ -18,3 +18,4 @@ .option('off', 'turn wifi off')

.option('scan', 'show available networks')
.option('--device <device>', 'set device (default is en0)') //see ugly todo below.
.option('pass', 'show password for current network')
.option('--device <device>', 'set device (default is en0)') // see ugly todo below.
.parse(process.argv)

@@ -27,2 +28,3 @@

scan: '/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport scan',
pass: 'security find-generic-password -wa "PASS"',
connect: 'networksetup -setairportnetwork en0 "NETWORK_TOKEN" "PASSWORD_TOKEN"',

@@ -37,3 +39,3 @@ currentNetwork: '/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport -I | grep -e "\\bSSID:" | sed -e "s/^.*SSID: //"'

//This is very ugly!! TODO: check how to combine flags and "commands" properly. maybe use 'npm i cli'.
// This is very ugly!! TODO: check how to combine flags and "commands" properly. maybe use 'npm i cli'.
if (cli.device) {

@@ -48,4 +50,4 @@ Object.keys(utils).forEach(function(key) {

if (args[0] === 'on') {
execute(utils.on) //cli.on is a function
if (args[0] === 'on') {
execute(utils.on) // cli.on is a function
} else if (cli.off) {

@@ -57,2 +59,4 @@ execute(utils.off)

execute(utils.scan).then(console.log.bind(console))
} else if (cli.pass) {
execute(utils.currentNetwork).then(getPass).then(logTrim)
} else if (args.length === 2) {

@@ -66,11 +70,19 @@ execute(utils.connect.replace('NETWORK_TOKEN', args[0]).replace('PASSWORD_TOKEN', args[1]))

////////////////////////////////////////////////
// -----------------------------------------------------------------------------
function help(SSID) {
console.log(SSID.trim() ? 'you are connected to ' + SSID : 'you are not connected anywhere')
//TODO: add more help text
// TODO: add more help text
}
function getPass(SSID) {
return execute(utils.pass.replace('PASS', SSID.trim()))
}
function logTrim(str) {
console.log(str.trim())
}
function execute(cmd) {
//console.log('executing command:', cmd)
// console.log('executing command:', cmd)
var deferred = Q.defer()

@@ -88,7 +100,1 @@ exec(cmd, function(err, strout, strerr) {

}
////////////////////////////////////////////////////////////////////////////////
function pad(path, len, char) {
return (path.length >= len) ? path : pad(path + char[0], len, char)
}
{
"name": "osx-wifi-cli",
"version": "1.0.3",
"version": "1.1.0",
"description": "A command line tool for managing wifi connection in osx",

@@ -35,3 +35,3 @@ "keywords": [

"bugs": {
"url": "https://github.com/danyshaanan/osx-wifi-cli",
"url": "https://github.com/danyshaanan/osx-wifi-cli/issues",
"email": "danyshaanan@gmail.com"

@@ -41,4 +41,5 @@ },

"scripts": {
"start": "node .",
"test": "grunt"
"lint": "eslint .",
"test": "npm run lint",
"start": "npm test"
},

@@ -49,10 +50,11 @@ "bin": {

"dependencies": {
"q": "1.0.0",
"commander": "2.1.0"
"commander": "2.1.0",
"q": "1.0.0"
},
"devDependencies": {
"grunt": "0.4.5",
"grunt-bump": "0.0.16",
"grunt-eslint": "4.0.0"
"eslint": "2.7.0",
"eslint-config-standard": "5.1.0",
"eslint-plugin-promise": "1.1.0",
"eslint-plugin-standard": "1.3.2"
}
}

@@ -1,2 +0,2 @@

## osx-wifi-cli
# osx-wifi-cli

@@ -6,7 +6,9 @@ [![Build Status](https://travis-ci.org/danyshaanan/osx-wifi-cli.png)](https://travis-ci.org/danyshaanan/osx-wifi-cli)

[![License](http://img.shields.io/npm/l/osx-wifi-cli.svg?style=flat)](LICENSE)
[![Dependency Status](https://david-dm.org/danyshaanan/osx-wifi-cli.svg)](https://david-dm.org/danyshaanan/osx-wifi-cli)
[![devDependency Status](https://david-dm.org/danyshaanan/osx-wifi-cli/dev-status.svg)](https://david-dm.org/danyshaanan/osx-wifi-cli#info=devDependencies)
### A command line tool for managing wifi connections on OSX
A command line tool for managing wifi connections on OSX
* * *
#### Installation
### Installation
```bash

@@ -16,6 +18,8 @@ $ npm install -g osx-wifi-cli

* * *
#### Usage
### Usage
`osx-wifi-cli` shows you which network you are connected to, if you are.
`osx-wifi-cli pass` shows you the password for your current network.
`osx-wifi-cli scan` shows available networks.

@@ -28,6 +32,11 @@

* * *
#### Notes
* This has been so far developed to "Work on my machine". If it's not working on yours, please tell me what's up, and I'll try to fix it. (For instance, wifi device is assumed to be en0).
* For easier execution, add to your `.bashrc` file: `alias wifi='osx-wifi-cli'`
* This was developed in a way that should make implementing this for other operating systems easy. If you want to give it a shot, check out the code or send me a message.
### Notes
* For easier use, add to your `.bashrc` file: `alias wifi='osx-wifi-cli'`
* To connect to network without a password (bad idea!) use `osx-wifi-cli networkname " "`
* * *
### Feedback
* If you enjoyed this package, please star it [on Github](https://github.com/danyshaanan/osx-wifi-cli).
* You are invited to [Open an issue on Github](https://github.com/danyshaanan/osx-wifi-cli/issues).
* For other matters, my email address can be found on my [NpmJS page](https://www.npmjs.org/~danyshaanan), my [Github page](https://github.com/danyshaanan), or my [website](http://danyshaanan.com/).

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc