Giter Site home page Giter Site logo

wifi-password's Introduction

wifi-password

Get current wifi password

Install

$ npm install wifi-password

Usage

const wifiPassword = require('wifi-password');

wifiPassword().then(password => {
	console.log(password);
	//=> 'johndoesecretpassword'
});

API

wifiPassword([name])

Returns a promise that resolves to a string containing the password.

name

Type: string

Get the wifi password for a specified known network.

Related

License

MIT © Kevin Mårtensson

wifi-password's People

Contributors

kevva avatar sindresorhus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wifi-password's Issues

No `iwgetid` on Linux

The following happens, seems like it's trying to use a tool that's not (always) installed by default:

sven@linux-etoq:~> wifi-password
spawn iwgetid ENOENT

Platform: openSUSE 13.1, x86_64, XFCE

Error on Windows 10

I'm having this error on Windows 10, with node v6.6.0:

Error: Promise rejected with value: 'Could not get password'
    at C:\Users\Antonio\AppData\Roaming\npm\node_modules\wifi-password-cli\node_modules\loud-rejection\index.js:27:12
    at Array.forEach (native)
    at EventEmitter.<anonymous> (C:\Users\Antonio\AppData\Roaming\npm\node_modules\wifi-password-cli\node_modules\loud-rejection\index.js:23:24)
    at emitTwo (events.js:106:13)
    at EventEmitter.emit (events.js:191:7)
    at emit (C:\Users\Antonio\AppData\Roaming\npm\node_modules\wifi-password-cli\node_modules\signal-exit\index.js:68:11)
    at processEmit [as emit] (C:\Users\Antonio\AppData\Roaming\npm\node_modules\wifi-password-cli\node_modules\signal-exit\index.js:141:5)

Command failed

I get this error when I execute wifi-password:

Command failed: /bin/sh: -c: line 0: unexpected EOF while looking for matching `"'
/bin/sh: -c: line 1: syntax error: unexpected end of file

Cannot read property 'indexOf' of undefined

I'm using WIndows x64, and Node 4.4.7.

When I using CLI, is returning fallowing error for me.

$ wifi-password
TypeError: Cannot read property 'indexOf' of undefined
at C:\Users\myUser\AppData\Roaming\npm\node_modules\wifi-password\cli.js18:18
at process.tickCallback (node.js369.9)

Error when SSID contains directory characters

When I try to retrieve the password of the SSID /\/\r.g33l< I get the following error:

$ wifi-password
Error: Command failed: sudo cat /etc/NetworkManager/system-connections//\/\r.g33l<
cat: '/etc/NetworkManager/system-connections//\/\r.g33l<': No such file or directory

    at Promise.all.then.arr (/usr/lib/node_modules/wifi-password-cli/node_modules/execa/index.js:231:11)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)

I originally posted this issue to wifi-password-cli but the concatenation happens in this library

Win7 x64 CLI error

C:\Program Files\nodejs\node_modules\wifi-password\index.js:43
cb(null, ret);
^
TypeError: undefined is not a function
at C:\Program Files\nodejs\node_modules\wifi-password\index.js:43:3
at ChildProcess.exithandler (child_process.js:635:7)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:743:16)
at Process.ChildProcess._handle.onexit (child_process.js:810:5)

Windows codepage issues should be documented

The module cannot work on Windows if the Windows is running in some languages, e.g. Chinese.

The problem is that netsh outputs differently under different codepages. On Chinese Windows, the default codepage is 936. Only after I run chcp 65001 can I get the proper password. Without that, I get an error Error: Could not get password.

I think it should be documented in README or somewhere.

Could not get SSID

After installing an running:

$ wifi-password

I get the following message:

Could not get SSID

I'm on OS X 10.10.1

access system

Why do I have to enter the username and password to access the system?

Not able retrivew password.

○ → wifi-password 
Your network doesn't have a password

On 14.0.0 Darwin Kernel Version am I missing something?

Connected to a n/w with WPA2 secured password.

Return error when doesn't have a password.

When I'm connected on a public wifi and execute the wifi-password, returns:

Error: Your network doesn't have a password
    at ChildProcess.exithandler (child_process.js:203:12)
    at emitTwo (events.js:87:13)
    at ChildProcess.emit (events.js:172:7)
    at maybeClose (internal/child_process.js:818:16)
    at Socket.<anonymous> (internal/child_process.js:319:11)
    at emitOne (events.js:77:13)
    at Socket.emit (events.js:169:7)
    at Pipe._onclose (net.js:469:12)

I believe this is not a error and it should return to the screen. This is normal behavior.

What do you think about this? Maybe we can predict the behavior inside the code and sending a report with a better way..

Linux Mint - no such directory /etc/NetworkManager/system-connections/' + ssid

in wifi-password/node_modules/linux-wifi-password/index.js, I needed to change line 7 from

var args = ['cat', '/etc/NetworkManager/system-connections ' + ssid];

to

var args = ['cat', '/etc/NetworkManager/system-connections/Auto\ ' + ssid];

(the difference being /Auto\)

I appreciate that this package has taught me where this info is located. I'm not sure which other systems this fix might be needed in as well.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.