Created
June 14, 2011 09:37
-
-
Save christos/1024587 to your computer and use it in GitHub Desktop.
jazzfonica
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
#!/usr/bin/env ruby | |
# jazzfonica.rb for Mac OS X | |
# Scans the visible networks for JAZZTEL_XXXX or WLAN_XXXX and calculates the password | |
# Ported from PHP example at http://kz.ath.cx/wlan/codigo.txt | |
# Download and execute with ruby (e.g. ruby jazzfonica.rb) from a Terminal | |
require 'digest/md5' | |
messages = [] | |
unless !File.exists?('/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport') | |
IO.popen("/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport -s | sed -e 's/^[ \t]*//g' | egrep '^(WLAN|JAZZTEL)_' | awk '{print $1\"|\"$2}'") do |output| | |
puts "Buscando redes…" | |
output.each { |line| messages << "Red: #{line.split("|")[0]}\nClave: #{Digest::MD5.hexdigest('bcgbghgg' << line.split("|")[1].split.join("\n").upcase.gsub( /:/, '')[0,8] << line.split("|")[0].split("_")[1].upcase << line.split("|")[1].split.join("\n").upcase.gsub( /:/, ''))[0,20]}\n" unless line.split("|")[0].split("_")[1].length != 4 } | |
puts messages.length <= 0 ? "No se han encontrado redes WLAN_XXXX o JAZZTEL_XXXX" : messages.each { |msg| msg } | |
end | |
else | |
puts "No se ha encontrado la herramienta aiport ¿estás en Mac OS X? ;)" and exit | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment