-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfile.rb
88 lines (56 loc) · 1.37 KB
/
file.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# require 'file'
require 'mysql'
require 'whois-parser'
require 'socket'
require 'socksify/http'
file = File.open("0654321.0.txt")
lines = File.open("0654321.0.txt", "r"){ |datafile|
datafile.readlines
}
i = 0
puts lines
while i < lines.length - 3
line = file.readline
puts line
if line!='\0'
line[0..5] = ""
line[line.length-1] = ""
url = line
#url = line
#puts url
#uri = URI.parse(URI.encode(url))
#uri = URI.parse("https://www."+line)
#puts uri
#url1 = URI(uri)
r= Whois.whois(url)
#p=r.parser
puts r
#res = Net::HTTP.get_response(uri)
# res['Set-Cookie'] # => String
#res.get_fields('set-cookie') # => Array
#res.to_hash['set-cookie'] # => Array
# Status
#puts res.code # => '200'
#puts res.message # => 'OK'
#
end
# url = line
# puts url
# ip = IPSocket::getaddress(url)
# puts ip
i = i+1
end
# File.open("0654321.0.txt").readlines.each do |line|
# while i < lines.length - 3
# #line[0..5] = ""
# end
# end
#my = Mysql.new(hostname, username, password, databasename)
con = Mysql.new('localhost', 'root', '123456', 'whois')
rs = con.query('select * from proxies')
rs.each_hash { |h| puts h['IP']}
con.close
uri = URI.parse('http://rubyforge.org/')
Net::HTTP.SOCKSProxy('127.0.0.1', 9050).start(uri.host, uri.port) do |http|
http.get(uri.path)
end