hidemyass2 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +9 -0
- data/README.md +9 -42
- data/lib/hidemyass.rb +11 -42
- data/lib/hidemyass/proxy/base.rb +120 -0
- data/lib/hidemyass/proxy/hide_me.rb +61 -0
- data/lib/hidemyass/proxy/hidester.rb +64 -0
- data/lib/hidemyass/proxy_list.rb +38 -30
- data/lib/hidemyass/version.rb +1 -1
- metadata +11 -65
- data/lib/hidemyass/proxy.rb +0 -160
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c9d36f59d586a6845e883c704d958e5f91693e6c
|
|
4
|
+
data.tar.gz: a1212be676cb5a41c2e28dba4cf325ef7cae027d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7889844bbebf875c8fba0e1da478056f5428022beccac7b121b59ab8a00b2065592e3ec3aa759b408a2594add6d44357bfe823e41ee38bc0f15ab1a64fc71dfe
|
|
7
|
+
data.tar.gz: ad173f6fe5eb7ed287a4b3b7636e38c2d03fa01ceadb4ff26a754e1c0b3be296258768a5b5779c3ac72466a4a1dd036f2f074f9e390db023697d38ed0fc3beb9
|
data/Gemfile
CHANGED
|
@@ -2,3 +2,12 @@ source 'https://rubygems.org'
|
|
|
2
2
|
|
|
3
3
|
# Specify your gem's dependencies in hidemyass.gemspec
|
|
4
4
|
gemspec
|
|
5
|
+
|
|
6
|
+
group :test do
|
|
7
|
+
gem 'rspec', '~> 3.5'
|
|
8
|
+
gem 'webmock', '~> 2.0'
|
|
9
|
+
gem 'timecop', '~> 0.8'
|
|
10
|
+
gem 'simplecov'
|
|
11
|
+
gem 'codeclimate-test-reporter'
|
|
12
|
+
gem 'pry-nav'
|
|
13
|
+
end
|
data/README.md
CHANGED
|
@@ -1,19 +1,13 @@
|
|
|
1
1
|
# HIDE MY ASS! /2 [](https://travis-ci.org/appPlant/hidemyass2) [](https://codeclimate.com/github/appPlant/hidemyass2) [](https://codeclimate.com/github/appPlant/hidemyass2/coverage) [](https://gemnasium.com/github.com/appPlant/hidemyass2)
|
|
2
2
|
|
|
3
|
-
Hide My Ass! /2 fetches
|
|
3
|
+
Hide My Ass! /2 fetches lots of proxies to allow everyone to surf privately from anywhere.
|
|
4
4
|
|
|
5
|
-
-
|
|
5
|
+
- Around __3.200__ proxies
|
|
6
6
|
|
|
7
|
-
-
|
|
7
|
+
- Fetched in real time within __2.5 sec__
|
|
8
8
|
|
|
9
9
|
- Sortable by speed, country, anonymity and many more
|
|
10
10
|
|
|
11
|
-
The graph shows the amount of change dynamics in the proxy list for the last 2 days.
|
|
12
|
-
|
|
13
|
-
<p align="left">
|
|
14
|
-
<img src="https://incloak.com/images/last_2days_mini.png"></img>
|
|
15
|
-
</p>
|
|
16
|
-
|
|
17
11
|
## Installation
|
|
18
12
|
|
|
19
13
|
Add this line to your application's Gemfile:
|
|
@@ -50,44 +44,17 @@ For Ruby run:
|
|
|
50
44
|
```ruby
|
|
51
45
|
require 'hidemyass'
|
|
52
46
|
|
|
53
|
-
HideMyAss.proxies
|
|
54
|
-
#<HideMyAss::ProxyList:0x00000000000000 @
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
__Note:__ To reuse that list instead of fetching a new one use `HideMyAss.proxies!`.
|
|
58
|
-
|
|
59
|
-
#### Filter proxies
|
|
60
|
-
|
|
61
|
-
```ruby
|
|
62
|
-
require 'hidemyass'
|
|
63
|
-
|
|
64
|
-
# start - Offset. Defaults to 0.
|
|
65
|
-
# end - Max. number of proxies to fetch. Defaults to 2000.
|
|
66
|
-
# countries - Country. Defaults to all countries.
|
|
67
|
-
# ports - Port. Defaults to any port.
|
|
68
|
-
# type - Protocol. h = HTTP, s = HTTPS, 4 = SOCKS4, 5 = SOCKS5
|
|
69
|
-
# anon - Anonymity level. 1..4 = None, Low, Medium, High
|
|
70
|
-
# maxtime - Speed in milliseconds.
|
|
47
|
+
HideMyAss.proxies { |p| p.country == 'germany' && p.https? }
|
|
48
|
+
#<HideMyAss::ProxyList:0x00000000000000 @proxies=[...]>
|
|
71
49
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
proxies.first.country
|
|
75
|
-
# => 'france'
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
Visit https://incloak.com/proxy-list/ for more informations how to filter.
|
|
79
|
-
|
|
80
|
-
#### Get the url of each proxy
|
|
81
|
-
|
|
82
|
-
```ruby
|
|
83
|
-
require 'hidemyass'
|
|
84
|
-
|
|
85
|
-
urls = HideMyAss.proxies.map(&:url)
|
|
86
|
-
# => ['https://178.22.148.122:3129',...]
|
|
50
|
+
HideMyAss.proxies!.first
|
|
51
|
+
#<HideMyAss::Proxy:0x00000000000000 https://103.253.146.197:8080>
|
|
87
52
|
```
|
|
88
53
|
|
|
89
54
|
Refer to the [Proxy](https://github.com/appPlant/hidemyass2/blob/master/lib/hidemyass/proxy.rb) class for more advanced usage and a complete list of properties like `speed`, `ip`, `ssl?`, `anonym?` or `secure?`.
|
|
90
55
|
|
|
56
|
+
__Tip:__ Use `proxies!` to fetch the proxies just one time.
|
|
57
|
+
|
|
91
58
|
## Development
|
|
92
59
|
|
|
93
60
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/lib/hidemyass.rb
CHANGED
|
@@ -14,9 +14,9 @@ require 'hidemyass/version'
|
|
|
14
14
|
# HideMyAss.proxies!
|
|
15
15
|
# # => HideMyAss::ProxyList
|
|
16
16
|
#
|
|
17
|
-
# @example Limit proxies to only available in
|
|
17
|
+
# @example Limit proxies to only available in Germany.
|
|
18
18
|
#
|
|
19
|
-
# HideMyAss.proxies
|
|
19
|
+
# HideMyAss.proxies { country == 'Germany' }
|
|
20
20
|
# # => HideMyAss::ProxyList
|
|
21
21
|
#
|
|
22
22
|
module HideMyAss
|
|
@@ -27,15 +27,15 @@ module HideMyAss
|
|
|
27
27
|
# # => HideMyAss::ProxyList
|
|
28
28
|
#
|
|
29
29
|
# @example Limit proxies to only available in Europe.
|
|
30
|
-
# HideMyAss.proxies
|
|
30
|
+
# HideMyAss.proxies { country == 'Germany' }
|
|
31
31
|
# # => HideMyAss::ProxyList
|
|
32
32
|
#
|
|
33
|
-
# @param [
|
|
33
|
+
# @param [ Proc ] block Optional where clause to filter out proxies.
|
|
34
34
|
#
|
|
35
35
|
# @return [ HideMyAss::ProxyList> ]
|
|
36
|
-
def self.proxies(
|
|
36
|
+
def self.proxies(&block)
|
|
37
37
|
@proxies = nil
|
|
38
|
-
proxies!(
|
|
38
|
+
proxies!(&block)
|
|
39
39
|
end
|
|
40
40
|
|
|
41
41
|
# List of proxies found at hidemyass.com but returns former search result
|
|
@@ -45,45 +45,14 @@ module HideMyAss
|
|
|
45
45
|
# HideMyAss.proxies!
|
|
46
46
|
# # => HideMyAss::ProxyList
|
|
47
47
|
#
|
|
48
|
-
# @example Limit proxies to only available in
|
|
49
|
-
# HideMyAss.proxies
|
|
48
|
+
# @example Limit proxies to only available in Germany.
|
|
49
|
+
# HideMyAss.proxies { country == 'Germany' }
|
|
50
50
|
# # => HideMyAss::ProxyList
|
|
51
51
|
#
|
|
52
|
-
# @param [
|
|
52
|
+
# @param [ Proc ] block Optional where clause to filter out proxies.
|
|
53
53
|
#
|
|
54
54
|
# @return [ HideMyAss::ProxyList> ]
|
|
55
|
-
def self.proxies!(
|
|
56
|
-
|
|
57
|
-
@proxies ||= ProxyList.new(form_data)
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
# Set form data to support custom searches.
|
|
61
|
-
#
|
|
62
|
-
# @param [ Hash ] data See form_data for more info.
|
|
63
|
-
#
|
|
64
|
-
# @return [ Void ]
|
|
65
|
-
def self.form_data=(data)
|
|
66
|
-
raise ArgumentError, 'form data has to be a hash' unless data.is_a? Hash
|
|
67
|
-
@form_data = data
|
|
68
|
-
end
|
|
69
|
-
|
|
70
|
-
# Get form data for custom search.
|
|
71
|
-
#
|
|
72
|
-
# start - Offset. Defaults to 0.
|
|
73
|
-
# end - Max. number of proxies to fetch. Defaults to 2000.
|
|
74
|
-
# countries - Country. Defaults to all countries.
|
|
75
|
-
# ports - Port. Defaults to any port.
|
|
76
|
-
# type - Protocol. h = HTTP, s = HTTPS, 4 = SOCKS4, 5 = SOCKS5
|
|
77
|
-
# anon - Anonymity level. 1..4 = None, Low, Medium, High
|
|
78
|
-
# maxtime - Speed in milliseconds.
|
|
79
|
-
#
|
|
80
|
-
# @return [ Hash ]
|
|
81
|
-
def self.form_data
|
|
82
|
-
@form_data ||= { start: 0,
|
|
83
|
-
end: 2000,
|
|
84
|
-
anon: nil,
|
|
85
|
-
type: nil,
|
|
86
|
-
ports: nil,
|
|
87
|
-
maxtime: nil }
|
|
55
|
+
def self.proxies!(&block)
|
|
56
|
+
@proxies ||= ProxyList.new(&block)
|
|
88
57
|
end
|
|
89
58
|
end
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
|
|
2
|
+
module HideMyAss
|
|
3
|
+
module Proxy
|
|
4
|
+
# Interface for the attributes of each proxy. Such attributes
|
|
5
|
+
# include the ip, port and protocol.
|
|
6
|
+
#
|
|
7
|
+
# @example Get the proxy's ip address.
|
|
8
|
+
# proxy.ip
|
|
9
|
+
# # => '178.22.148.122'
|
|
10
|
+
#
|
|
11
|
+
# @example Get the proxy's port.
|
|
12
|
+
# proxy.port
|
|
13
|
+
# # => 3129
|
|
14
|
+
#
|
|
15
|
+
# @example Get the proxy's protocol.
|
|
16
|
+
# proxy.protocol
|
|
17
|
+
# # => 'HTTPS'
|
|
18
|
+
#
|
|
19
|
+
# @example Get the hosted country.
|
|
20
|
+
# proxy.country
|
|
21
|
+
# # => 'FRANCE'
|
|
22
|
+
#
|
|
23
|
+
# @example Get the complete url.
|
|
24
|
+
# proxy.url
|
|
25
|
+
# # => 'https://178.22.148.122:3129'
|
|
26
|
+
class Base
|
|
27
|
+
# Initializes the proxy instance by passing a single row of the fetched
|
|
28
|
+
# result list. All attribute readers are lazy implemented.
|
|
29
|
+
#
|
|
30
|
+
# @param [ Object ] row Pre-parsed row element.
|
|
31
|
+
#
|
|
32
|
+
# @return [ HideMyAss::Proxy::Base ]
|
|
33
|
+
def initialize(row)
|
|
34
|
+
@row = row
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# Raw data of the row element.
|
|
38
|
+
#
|
|
39
|
+
# @return [ Object ]
|
|
40
|
+
attr_reader :row
|
|
41
|
+
|
|
42
|
+
# The network protocol in in downcase letters.
|
|
43
|
+
# (https or http or socks)
|
|
44
|
+
#
|
|
45
|
+
# @return [ String ]
|
|
46
|
+
def protocol
|
|
47
|
+
type
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# The relative URL without the leading protocol.
|
|
51
|
+
#
|
|
52
|
+
# @return [ String ]
|
|
53
|
+
def rel_url
|
|
54
|
+
"#{ip}:#{port}"
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# The complete URL of that proxy server.
|
|
58
|
+
#
|
|
59
|
+
# @return [ String ]
|
|
60
|
+
def url
|
|
61
|
+
"#{protocol}://#{rel_url}"
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# If the proxy's network protocol is HTTP.
|
|
65
|
+
#
|
|
66
|
+
# @return [ Boolean ]
|
|
67
|
+
def http?
|
|
68
|
+
protocol == 'http'
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
# If the proxy's network protocol is HTTPS.
|
|
72
|
+
#
|
|
73
|
+
# @return [ Boolean ]
|
|
74
|
+
def https?
|
|
75
|
+
protocol == 'https'
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
# If the proxy's network protocol is SOCKS.
|
|
79
|
+
#
|
|
80
|
+
# @return [ Boolean ]
|
|
81
|
+
def socks?
|
|
82
|
+
protocol.start_with? 'socks'
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
# If the proxy supports SSL encryption.
|
|
86
|
+
#
|
|
87
|
+
# @return [ Boolean ]
|
|
88
|
+
def ssl?
|
|
89
|
+
https? || socks?
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
# If the proxy's anonymity is high or even higher.
|
|
93
|
+
#
|
|
94
|
+
# @return [ Boolean ]
|
|
95
|
+
def anonym?
|
|
96
|
+
anonymity.start_with? 'high'
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
# If the proxy's anonymity is at least high and protocol is encrypted.
|
|
100
|
+
#
|
|
101
|
+
# @return [ Boolean ]
|
|
102
|
+
def secure?
|
|
103
|
+
anonym? && ssl?
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
# Custom inspect method.
|
|
107
|
+
#
|
|
108
|
+
# @example
|
|
109
|
+
# inspect
|
|
110
|
+
# => '<HideMyAss::Proxy http://123.57.52.171:80>'
|
|
111
|
+
#
|
|
112
|
+
# @return [ String ]
|
|
113
|
+
# :nocov:
|
|
114
|
+
def inspect
|
|
115
|
+
"<#{self.class.name} #{url}>"
|
|
116
|
+
end
|
|
117
|
+
# :nocov:
|
|
118
|
+
end
|
|
119
|
+
end
|
|
120
|
+
end
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
require 'hidemyass/proxy/base'
|
|
2
|
+
|
|
3
|
+
module HideMyAss
|
|
4
|
+
module Proxy
|
|
5
|
+
# Represent one proxy instance from http://hideme.ru/proxy-list
|
|
6
|
+
class HideMe < Base
|
|
7
|
+
# The IP of the proxy server.
|
|
8
|
+
#
|
|
9
|
+
# @return [ String ]
|
|
10
|
+
def ip
|
|
11
|
+
@ip ||= @row.at_xpath('td[1]/text()').text.strip
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
# The port for the proxy.
|
|
15
|
+
#
|
|
16
|
+
# @return [ Int ]
|
|
17
|
+
def port
|
|
18
|
+
@port ||= @row.at_xpath('td[2]/text()').text.strip.to_i
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# The country where the proxy is hosted in downcase letters.
|
|
22
|
+
#
|
|
23
|
+
# @return [ String ]
|
|
24
|
+
def country
|
|
25
|
+
@country ||= @row.at_xpath('td[3]/div/text()')
|
|
26
|
+
.text.strip.downcase!.scan(/[[:word:]]+$/).last
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# The average response time in milliseconds.
|
|
30
|
+
#
|
|
31
|
+
# @return [ Int ]
|
|
32
|
+
def speed
|
|
33
|
+
@speed ||= @row.at_xpath('td[4]/div/div/p/text()')
|
|
34
|
+
.text.scan(/^\d+/)[0].to_i
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# The network protocol in in downcase letters.
|
|
38
|
+
# (https or http or socks)
|
|
39
|
+
#
|
|
40
|
+
# @return [ String ]
|
|
41
|
+
def type
|
|
42
|
+
@type ||= @row.at_xpath('td[5]/text()').text.strip.split.last.downcase!
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# The level of anonymity in downcase letters.
|
|
46
|
+
# (low, medium, high, ...)
|
|
47
|
+
#
|
|
48
|
+
# @return [ String ]
|
|
49
|
+
def anonymity
|
|
50
|
+
@anonymity ||= @row.at_xpath('td[6]').text.strip.downcase!
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# Time in minutes when its been last checked.
|
|
54
|
+
#
|
|
55
|
+
# @return [ Int ]
|
|
56
|
+
def last_check
|
|
57
|
+
@last_check ||= @row.at_xpath('td[7]/text()').text.scan(/^\d+/)[0].to_i
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
require 'hidemyass/proxy/base'
|
|
2
|
+
|
|
3
|
+
module HideMyAss
|
|
4
|
+
module Proxy
|
|
5
|
+
# Represent one proxy instance from https://hidester.com/proxylist
|
|
6
|
+
class Hidester < Base
|
|
7
|
+
# The IP of the proxy server.
|
|
8
|
+
#
|
|
9
|
+
# @return [ String ]
|
|
10
|
+
def ip
|
|
11
|
+
@row['IP']
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
# The port for the proxy.
|
|
15
|
+
#
|
|
16
|
+
# @return [ Int ]
|
|
17
|
+
def port
|
|
18
|
+
@row['PORT']
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# The country where the proxy is hosted in downcase letters.
|
|
22
|
+
#
|
|
23
|
+
# @return [ String ]
|
|
24
|
+
def country
|
|
25
|
+
@row['country'].downcase
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# The average response time in milliseconds.
|
|
29
|
+
#
|
|
30
|
+
# @return [ Int ]
|
|
31
|
+
def speed
|
|
32
|
+
@row['ping']
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# The network protocol in in downcase letters.
|
|
36
|
+
# (https or http or socks)
|
|
37
|
+
#
|
|
38
|
+
# @return [ String ]
|
|
39
|
+
def type
|
|
40
|
+
@row['type']
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# The level of anonymity in downcase letters.
|
|
44
|
+
# (low, medium, high, ...)
|
|
45
|
+
#
|
|
46
|
+
# @return [ String ]
|
|
47
|
+
def anonymity
|
|
48
|
+
case @row['anonymity']
|
|
49
|
+
when 'Elite' then 'high'
|
|
50
|
+
when 'Anonymous' then 'medium'
|
|
51
|
+
else 'no'
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# Time in minutes when its been last checked.
|
|
56
|
+
#
|
|
57
|
+
# @return [ Int ]
|
|
58
|
+
def last_check
|
|
59
|
+
require 'time'
|
|
60
|
+
((Time.now - Time.at(@row['latest_check'])) / 60).round
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
data/lib/hidemyass/proxy_list.rb
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
require 'forwardable'
|
|
2
2
|
require 'open-uri'
|
|
3
|
-
require 'net/http'
|
|
4
|
-
require 'nokogiri'
|
|
5
|
-
require 'hidemyass/proxy'
|
|
6
3
|
|
|
7
4
|
module HideMyAss
|
|
8
5
|
# Represent a list of proxies that match the specified search properties.
|
|
9
6
|
#
|
|
10
7
|
# @example Iterate over all proxy server hosted in the US.
|
|
11
|
-
# ProxyList.new
|
|
8
|
+
# ProxyList.new { country == 'US'}.each { |proxy| ... }
|
|
12
9
|
#
|
|
13
10
|
# @example List of all proxy server URLs
|
|
14
11
|
# ProxyList.new.map(&:url)
|
|
@@ -17,48 +14,59 @@ module HideMyAss
|
|
|
17
14
|
include Enumerable
|
|
18
15
|
extend Forwardable
|
|
19
16
|
|
|
20
|
-
ENDPOINT = 'https://incloak.com/proxy-list/?start=0&end=2000'.freeze
|
|
21
|
-
|
|
22
|
-
private_constant :ENDPOINT
|
|
23
|
-
|
|
24
17
|
# Represent a list of proxies that match the specified search properties.
|
|
25
18
|
#
|
|
26
|
-
# @param [
|
|
19
|
+
# @param [ Proc ] block Optional where clause to filter out proxies.
|
|
27
20
|
#
|
|
28
21
|
# @return [ HideMyAss::ProxyList ]
|
|
29
|
-
def initialize(
|
|
30
|
-
|
|
31
|
-
@proxies = fetch
|
|
22
|
+
def initialize(&block)
|
|
23
|
+
@proxies = fetch(&block)
|
|
32
24
|
end
|
|
33
25
|
|
|
34
26
|
def_delegator :@proxies, :each
|
|
35
27
|
|
|
36
|
-
|
|
37
|
-
#
|
|
38
|
-
# @return [ Hash ]
|
|
39
|
-
attr_accessor :form_data
|
|
28
|
+
private
|
|
40
29
|
|
|
41
|
-
#
|
|
30
|
+
# Fetch proxies from all backends.
|
|
42
31
|
#
|
|
43
|
-
# @
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
32
|
+
# @param [ Proc ] block Optional where clause to filter out proxies.
|
|
33
|
+
#
|
|
34
|
+
# @return [ Array<HideMyAss::Proxy::Base> ]
|
|
35
|
+
def fetch(&block)
|
|
36
|
+
proxies = hidester_proxies.concat(hide_me_proxies)
|
|
37
|
+
proxies.uniq!(&:ip)
|
|
49
38
|
|
|
50
|
-
|
|
39
|
+
block_given? ? proxies.keep_if(&block) : proxies
|
|
40
|
+
end
|
|
51
41
|
|
|
52
|
-
# Fetch
|
|
42
|
+
# Fetch all proxies from hideme.ru/proxy-list
|
|
53
43
|
#
|
|
54
|
-
# @return [ Array<HideMyAss::Proxy> ]
|
|
55
|
-
def
|
|
56
|
-
|
|
44
|
+
# @return [ Array<HideMyAss::Proxy::HideMe> ]
|
|
45
|
+
def hide_me_proxies
|
|
46
|
+
require 'hidemyass/proxy/hide_me'
|
|
47
|
+
require 'nokogiri'
|
|
48
|
+
|
|
49
|
+
body = open('https://incloak.com/proxy-list/?end=5000')
|
|
57
50
|
page = Nokogiri::HTML(body, nil, 'UTF-8')
|
|
58
51
|
sel = '//*[@id="content-section"]/section[1]/div/table/tbody/tr'
|
|
59
52
|
|
|
60
|
-
page.xpath(sel).map { |row| Proxy.new(row) }
|
|
61
|
-
rescue Timeout::Error
|
|
53
|
+
page.xpath(sel).map { |row| Proxy::HideMe.new(row) }
|
|
54
|
+
rescue Timeout::Error, LoadError, OpenURI::HTTPError
|
|
55
|
+
[]
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# Fetch all proxies from hidester.com/proxylist
|
|
59
|
+
#
|
|
60
|
+
# @return [ Array<HideMyAss::Proxy::Hidester> ]
|
|
61
|
+
def hidester_proxies
|
|
62
|
+
require 'hidemyass/proxy/hidester'
|
|
63
|
+
require 'json'
|
|
64
|
+
|
|
65
|
+
body = open('https://hidester.com/proxydata/php/data.php?mykey=data&limit=5000&orderBy=latest_check&sortOrder=DESC')
|
|
66
|
+
page = JSON.load(body)
|
|
67
|
+
|
|
68
|
+
page.map { |row| Proxy::Hidester.new(row) }
|
|
69
|
+
rescue Timeout::Error, LoadError, OpenURI::HTTPError
|
|
62
70
|
[]
|
|
63
71
|
end
|
|
64
72
|
end
|
data/lib/hidemyass/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: hidemyass2
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sebastián Katzer
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2016-07-
|
|
11
|
+
date: 2016-07-13 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -39,89 +39,33 @@ dependencies:
|
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
40
|
version: '11.1'
|
|
41
41
|
- !ruby/object:Gem::Dependency
|
|
42
|
-
name:
|
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
|
44
|
-
requirements:
|
|
45
|
-
- - "~>"
|
|
46
|
-
- !ruby/object:Gem::Version
|
|
47
|
-
version: '3.5'
|
|
48
|
-
type: :development
|
|
49
|
-
prerelease: false
|
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
-
requirements:
|
|
52
|
-
- - "~>"
|
|
53
|
-
- !ruby/object:Gem::Version
|
|
54
|
-
version: '3.5'
|
|
55
|
-
- !ruby/object:Gem::Dependency
|
|
56
|
-
name: webmock
|
|
42
|
+
name: nokogiri
|
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|
|
58
44
|
requirements:
|
|
59
45
|
- - "~>"
|
|
60
46
|
- !ruby/object:Gem::Version
|
|
61
|
-
version: '
|
|
47
|
+
version: '1.6'
|
|
62
48
|
type: :development
|
|
63
49
|
prerelease: false
|
|
64
50
|
version_requirements: !ruby/object:Gem::Requirement
|
|
65
51
|
requirements:
|
|
66
52
|
- - "~>"
|
|
67
53
|
- !ruby/object:Gem::Version
|
|
68
|
-
version: '
|
|
69
|
-
- !ruby/object:Gem::Dependency
|
|
70
|
-
name: simplecov
|
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
|
72
|
-
requirements:
|
|
73
|
-
- - ">="
|
|
74
|
-
- !ruby/object:Gem::Version
|
|
75
|
-
version: '0'
|
|
76
|
-
type: :development
|
|
77
|
-
prerelease: false
|
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
-
requirements:
|
|
80
|
-
- - ">="
|
|
81
|
-
- !ruby/object:Gem::Version
|
|
82
|
-
version: '0'
|
|
83
|
-
- !ruby/object:Gem::Dependency
|
|
84
|
-
name: codeclimate-test-reporter
|
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
|
86
|
-
requirements:
|
|
87
|
-
- - ">="
|
|
88
|
-
- !ruby/object:Gem::Version
|
|
89
|
-
version: '0'
|
|
90
|
-
type: :development
|
|
91
|
-
prerelease: false
|
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
93
|
-
requirements:
|
|
94
|
-
- - ">="
|
|
95
|
-
- !ruby/object:Gem::Version
|
|
96
|
-
version: '0'
|
|
54
|
+
version: '1.6'
|
|
97
55
|
- !ruby/object:Gem::Dependency
|
|
98
|
-
name:
|
|
56
|
+
name: json
|
|
99
57
|
requirement: !ruby/object:Gem::Requirement
|
|
100
58
|
requirements:
|
|
101
59
|
- - ">="
|
|
102
60
|
- !ruby/object:Gem::Version
|
|
103
61
|
version: '0'
|
|
104
|
-
type: :
|
|
62
|
+
type: :runtime
|
|
105
63
|
prerelease: false
|
|
106
64
|
version_requirements: !ruby/object:Gem::Requirement
|
|
107
65
|
requirements:
|
|
108
66
|
- - ">="
|
|
109
67
|
- !ruby/object:Gem::Version
|
|
110
68
|
version: '0'
|
|
111
|
-
- !ruby/object:Gem::Dependency
|
|
112
|
-
name: nokogiri
|
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
|
114
|
-
requirements:
|
|
115
|
-
- - "~>"
|
|
116
|
-
- !ruby/object:Gem::Version
|
|
117
|
-
version: '1.6'
|
|
118
|
-
type: :runtime
|
|
119
|
-
prerelease: false
|
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
121
|
-
requirements:
|
|
122
|
-
- - "~>"
|
|
123
|
-
- !ruby/object:Gem::Version
|
|
124
|
-
version: '1.6'
|
|
125
69
|
description: Allows everyone to surf privately from anywhere.
|
|
126
70
|
email:
|
|
127
71
|
- katzer@appplant.de
|
|
@@ -140,14 +84,16 @@ files:
|
|
|
140
84
|
- bin/setup
|
|
141
85
|
- exe/hidemyass
|
|
142
86
|
- lib/hidemyass.rb
|
|
143
|
-
- lib/hidemyass/proxy.rb
|
|
87
|
+
- lib/hidemyass/proxy/base.rb
|
|
88
|
+
- lib/hidemyass/proxy/hide_me.rb
|
|
89
|
+
- lib/hidemyass/proxy/hidester.rb
|
|
144
90
|
- lib/hidemyass/proxy_list.rb
|
|
145
91
|
- lib/hidemyass/version.rb
|
|
146
92
|
homepage: https://github.com/appPlant/hidemyass2
|
|
147
93
|
licenses:
|
|
148
94
|
- MIT
|
|
149
95
|
metadata: {}
|
|
150
|
-
post_install_message:
|
|
96
|
+
post_install_message: Install nokogiri for additional proxies.
|
|
151
97
|
rdoc_options: []
|
|
152
98
|
require_paths:
|
|
153
99
|
- lib
|
data/lib/hidemyass/proxy.rb
DELETED
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
module HideMyAss
|
|
3
|
-
# Interface for the attributes of each proxy. Such attributes
|
|
4
|
-
# include the ip, port and protocol.
|
|
5
|
-
#
|
|
6
|
-
# @example Get the proxy's ip address.
|
|
7
|
-
# proxy.ip
|
|
8
|
-
# # => '178.22.148.122'
|
|
9
|
-
#
|
|
10
|
-
# @example Get the proxy's port.
|
|
11
|
-
# proxy.port
|
|
12
|
-
# # => 3129
|
|
13
|
-
#
|
|
14
|
-
# @example Get the proxy's protocol.
|
|
15
|
-
# proxy.protocol
|
|
16
|
-
# # => 'HTTPS'
|
|
17
|
-
#
|
|
18
|
-
# @example Get the hosted country.
|
|
19
|
-
# proxy.country
|
|
20
|
-
# # => 'FRANCE'
|
|
21
|
-
#
|
|
22
|
-
# @example Get the complete url.
|
|
23
|
-
# proxy.url
|
|
24
|
-
# # => 'https://178.22.148.122:3129'
|
|
25
|
-
class Proxy
|
|
26
|
-
# Initializes the proxy instance by passing a single row of the fetched
|
|
27
|
-
# result list. All attribute readers are lazy implemented.
|
|
28
|
-
#
|
|
29
|
-
# @param [ Nokogiri::XML ] row Pre-parsed row element.
|
|
30
|
-
#
|
|
31
|
-
# @return [ HideMyAss::Proxy ]
|
|
32
|
-
def initialize(row)
|
|
33
|
-
@row = row
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
# The IP of the proxy server.
|
|
37
|
-
#
|
|
38
|
-
# @return [ String ]
|
|
39
|
-
def ip
|
|
40
|
-
@ip ||= @row.at_xpath('td[1]/text()').text.strip
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
# The port for the proxy.
|
|
44
|
-
#
|
|
45
|
-
# @return [ Int ]
|
|
46
|
-
def port
|
|
47
|
-
@port ||= @row.at_xpath('td[2]/text()').text.strip.to_i
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
# The country where the proxy is hosted in downcase letters.
|
|
51
|
-
#
|
|
52
|
-
# @return [ String ]
|
|
53
|
-
def country
|
|
54
|
-
@country ||= @row.at_xpath('td[3]/div/text()')
|
|
55
|
-
.text.strip.downcase!.scan(/[[:word:]]+$/).last
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
# The average response time in milliseconds.
|
|
59
|
-
#
|
|
60
|
-
# @return [ Int ]
|
|
61
|
-
def speed
|
|
62
|
-
@speed ||= @row.at_xpath('td[4]/div/div/p/text()')
|
|
63
|
-
.text.scan(/^\d+/)[0].to_i
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
# The network protocol in in downcase letters.
|
|
67
|
-
# (https or http or socks)
|
|
68
|
-
#
|
|
69
|
-
# @return [ String ]
|
|
70
|
-
def type
|
|
71
|
-
@type ||= @row.at_xpath('td[5]/text()').text.strip.split.last.downcase!
|
|
72
|
-
end
|
|
73
|
-
|
|
74
|
-
alias protocol type
|
|
75
|
-
|
|
76
|
-
# The level of anonymity in downcase letters.
|
|
77
|
-
# (low, medium, high, ...)
|
|
78
|
-
#
|
|
79
|
-
# @return [ String ]
|
|
80
|
-
def anonymity
|
|
81
|
-
@anonymity ||= @row.at_xpath('td[6]').text.strip.downcase!
|
|
82
|
-
end
|
|
83
|
-
|
|
84
|
-
# Time in minutes when its been last checked.
|
|
85
|
-
#
|
|
86
|
-
# @return [ Int ]
|
|
87
|
-
def last_check
|
|
88
|
-
@last_check ||= @row.at_xpath('td[7]/text()').text.scan(/^\d+/)[0].to_i
|
|
89
|
-
end
|
|
90
|
-
|
|
91
|
-
# The relative URL without the leading protocol.
|
|
92
|
-
#
|
|
93
|
-
# @return [ String ]
|
|
94
|
-
def rel_url
|
|
95
|
-
"#{ip}:#{port}"
|
|
96
|
-
end
|
|
97
|
-
|
|
98
|
-
# The complete URL of that proxy server.
|
|
99
|
-
#
|
|
100
|
-
# @return [ String ]
|
|
101
|
-
def url
|
|
102
|
-
"#{protocol}://#{rel_url}"
|
|
103
|
-
end
|
|
104
|
-
|
|
105
|
-
# If the proxy's network protocol is HTTP.
|
|
106
|
-
#
|
|
107
|
-
# @return [ Boolean ]
|
|
108
|
-
def http?
|
|
109
|
-
protocol == 'http'
|
|
110
|
-
end
|
|
111
|
-
|
|
112
|
-
# If the proxy's network protocol is HTTPS.
|
|
113
|
-
#
|
|
114
|
-
# @return [ Boolean ]
|
|
115
|
-
def https?
|
|
116
|
-
protocol == 'https'
|
|
117
|
-
end
|
|
118
|
-
|
|
119
|
-
# If the proxy's network protocol is SOCKS.
|
|
120
|
-
#
|
|
121
|
-
# @return [ Boolean ]
|
|
122
|
-
def socks?
|
|
123
|
-
protocol.start_with? 'socks'
|
|
124
|
-
end
|
|
125
|
-
|
|
126
|
-
# If the proxy supports SSL encryption.
|
|
127
|
-
#
|
|
128
|
-
# @return [ Boolean ]
|
|
129
|
-
def ssl?
|
|
130
|
-
https? || socks?
|
|
131
|
-
end
|
|
132
|
-
|
|
133
|
-
# If the proxy's anonymity is high or even higher.
|
|
134
|
-
#
|
|
135
|
-
# @return [ Boolean ]
|
|
136
|
-
def anonym?
|
|
137
|
-
anonymity.start_with? 'high'
|
|
138
|
-
end
|
|
139
|
-
|
|
140
|
-
# If the proxy's anonymity is at least high and protocol is encrypted.
|
|
141
|
-
#
|
|
142
|
-
# @return [ Boolean ]
|
|
143
|
-
def secure?
|
|
144
|
-
anonym? && ssl?
|
|
145
|
-
end
|
|
146
|
-
|
|
147
|
-
# Custom inspect method.
|
|
148
|
-
#
|
|
149
|
-
# @example
|
|
150
|
-
# inspect
|
|
151
|
-
# => '<HideMyAss::Proxy http://123.57.52.171:80>'
|
|
152
|
-
#
|
|
153
|
-
# @return [ String ]
|
|
154
|
-
# :nocov:
|
|
155
|
-
def inspect
|
|
156
|
-
"<#{self.class.name} #{url}>"
|
|
157
|
-
end
|
|
158
|
-
# :nocov:
|
|
159
|
-
end
|
|
160
|
-
end
|