Created
May 4, 2019 17:34
-
-
Save ufo2mstar/6abb0f278bb8d456cebe65d03433baee to your computer and use it in GitHub Desktop.
Quick little tool to scrape through your saved wifi passwords
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
str = `netsh wlan show profile` | |
profile_names = [] | |
str.scan(/^.*Profile\s+: (.*)$/) {|x| profile_names << x[0]} | |
wifi_profiles = {} | |
nil_wifi_profiles = [] | |
profile_names.each do |name| | |
cmd = "netsh wlan show profile name=#{name} key=clear" | |
str = `#{cmd}` | |
pswd = str[/^\s+Key Content\s+: (.*)$/, 1] | |
pswd ? wifi_profiles[name] = pswd : nil_wifi_profiles << name | |
end | |
puts "{ \tProfile => Password\t }" | |
puts wifi_profiles | |
puts "\nNo Passwords found for Profiles" | |
p nil_wifi_profiles | |
# optional better printing version with 'awesome_print' gem... | |
# require 'ap' | |
# puts "{ \tProfile => Password\t }" | |
# ap wifi_profiles | |
# puts "\nNo Passwords found for Profiles" | |
# ap nil_wifi_profiles |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment