JustDucky
JustDucky

Reputation: 132

Getting wifi passwords with a mac

I'm trying to use the bash shell to get a wifi profile for a certain network, and from that, the password

What I'm looking for is basically a mac equivalent to netsh wlan show profile name="name" key=clear, which gets exactly what I want with windows

I have looked into the airport and networksetup commands on mac, but still have yet to find something that will either show me the network profiles or, even better, what's inside.

Does anyone have any ideas or at least something to point me in the right direction?

Upvotes: 2

Views: 4542

Answers (3)

Shivam Anand
Shivam Anand

Reputation: 1591

Simply run the command from terminal app

security find-generic-password -wa <WIFI_NAME>

Replace <WIFI_NAME> with your Wifi Name. A prompt will ask you for username and password.

Upvotes: 0

Thiago
Thiago

Reputation: 13302

The simple way is:

security find-generic-password -ga "ROUTERNAME" | grep "password:"

Add the WIFI name you are connected in the place of ROUTERNAME

Upvotes: 1

Golo Roden
Golo Roden

Reputation: 150684

If it's okay to use a Node.js script for this, you might have a look at wifi-password-cli which does exactly what you want:

$ wifi-password --help

  Usage
    $ wifi-password [network-name]

  Example
    $ wifi-password
    unicorns
    $ wifi-password foo-network
    foosecretpassword

(Sample taken from the tool's documenation)

To use it, simply run (supposed that Node.js has already been installed on your system before):

$ npm install -g wifi-password-cli

Upvotes: 2

Related Questions