Created
March 8, 2011 22:33
-
-
Save jjuarez/861240 to your computer and use it in GitHub Desktop.
A simple "Mac" utility for WLAN and JAZZTELL Wifi networks
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 -W0 | |
# | |
# See this article first: http://bit.ly/fKcVTR | |
# | |
require 'digest/md5' | |
if( __FILE__ == $0 ) | |
`airport --scan`.each_line do |line| | |
if( line =~ /(WLAN_|JAZZTEL_|Vodafone)(\w){4}/ ) | |
ssid, bssid = line.split( ' ' )[0..1].map { |s| s.strip } | |
puts "SSID: #{ssid} BSSID: #{bssid}" | |
if( bssid =~ /^00:1F:A4/ ) | |
bssidp = bssid.downcase.delete( ':' )[0..7] | |
puts Digest::MD5.hexdigest( "#{bssidp}#{ssid.downcase.reverse[0..3].reverse}" ).upcase[0..19] | |
else | |
head = ssid.sub( /(WLAN_|JAZZTEL_|Vodafone)/, '' ).upcase | |
bssid2 = bssid.delete( ':' ).upcase | |
bssidp = bssid.delete( ':' ).upcase[0..7] | |
puts Digest::MD5.hexdigest( "bcgbghgg#{bssidp}#{head}#{bssid2}" )[0..19] | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment