Skip to content

Instantly share code, notes, and snippets.

@jjuarez
Created March 8, 2011 22:33
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jjuarez/861240 to your computer and use it in GitHub Desktop.
Save jjuarez/861240 to your computer and use it in GitHub Desktop.
A simple "Mac" utility for WLAN and JAZZTELL Wifi networks
#!/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