hidemyass2 1.0.1 → 1.1.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/README.md +37 -25
- data/lib/hidemyass/proxy.rb +23 -62
- data/lib/hidemyass/proxy_list.rb +20 -13
- data/lib/hidemyass/version.rb +1 -1
- data/lib/hidemyass.rb +13 -20
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3cc56ceea3c002eea107248fe58041e11b466189
|
|
4
|
+
data.tar.gz: 0ac795de36bd83039765d57dc6d9155d5a13d55e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8322738781cefcf98cc7fbe7628202995b11a6aa539bea9396473cc261705cb32b4aa47863d52797f14a5fd793324b64f9cb633eaebc5549c37c25245d902e64
|
|
7
|
+
data.tar.gz: 00a2454206d63cb9df488256bffea114653208f54539f9f475d1b9bbb2dbcf5c59fde108ae5d8eb2750d076689d1fff90af43cbbb8178505d157c7445b8aae15
|
data/README.md
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
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 proxies at
|
|
3
|
+
Hide My Ass! /2 fetches proxies at https://incloak.com to allow everyone to surf privately from anywhere.
|
|
4
4
|
|
|
5
5
|
- Proxy lists are checked in real time
|
|
6
6
|
|
|
7
|
-
-
|
|
7
|
+
- Around __1.000__ proxies at all
|
|
8
8
|
|
|
9
|
-
- Sortable by country, anonymity
|
|
9
|
+
- Sortable by speed, country, anonymity and many more
|
|
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>
|
|
10
16
|
|
|
11
17
|
## Installation
|
|
12
18
|
|
|
@@ -26,42 +32,52 @@ Or install it yourself as:
|
|
|
26
32
|
|
|
27
33
|
## Usage
|
|
28
34
|
|
|
29
|
-
|
|
35
|
+
From terminal execute:
|
|
36
|
+
|
|
37
|
+
$ bundle exec hidemyass
|
|
38
|
+
|
|
39
|
+
https://188.166.233.171:8080
|
|
40
|
+
http://187.85.207.47:3128
|
|
41
|
+
http://201.22.213.7:8080
|
|
42
|
+
https://103.253.146.197:8080
|
|
43
|
+
https://139.59.226.223:8080
|
|
44
|
+
socks4://80.255.139.145:1080
|
|
45
|
+
socks5://5.135.151.28:60088
|
|
46
|
+
...
|
|
47
|
+
|
|
48
|
+
For Ruby run:
|
|
30
49
|
|
|
31
50
|
```ruby
|
|
32
51
|
require 'hidemyass'
|
|
33
52
|
|
|
34
|
-
|
|
35
|
-
|
|
53
|
+
HideMyAss.proxies
|
|
54
|
+
#<HideMyAss::ProxyList:0x00000000000000 @uri="..." @proxies=[...]>
|
|
36
55
|
```
|
|
37
56
|
|
|
38
|
-
To reuse that list instead of fetching a new one use `HideMyAss.proxies!`.
|
|
57
|
+
__Note:__ To reuse that list instead of fetching a new one use `HideMyAss.proxies!`.
|
|
39
58
|
|
|
40
|
-
|
|
59
|
+
#### Filter proxies
|
|
41
60
|
|
|
42
61
|
```ruby
|
|
43
62
|
require 'hidemyass'
|
|
44
63
|
|
|
45
|
-
#
|
|
46
|
-
#
|
|
47
|
-
#
|
|
48
|
-
#
|
|
49
|
-
#
|
|
50
|
-
#
|
|
51
|
-
#
|
|
52
|
-
# o - Order. 0, 1 = DESC, ASC.
|
|
53
|
-
# pp - Per Page. 0..3 = 10, 25, 50, 100.
|
|
54
|
-
# sortBy - Sort by. Defaults to date.
|
|
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.
|
|
55
71
|
|
|
56
|
-
proxies = HideMyAss.proxies
|
|
72
|
+
proxies = HideMyAss.proxies countries: 'FR', type: 'hs'
|
|
57
73
|
|
|
58
74
|
proxies.first.country
|
|
59
75
|
# => 'france'
|
|
60
76
|
```
|
|
61
77
|
|
|
62
|
-
Visit
|
|
78
|
+
Visit https://incloak.com/proxy-list/ for more informations how to filter.
|
|
63
79
|
|
|
64
|
-
|
|
80
|
+
#### Get the url of each proxy
|
|
65
81
|
|
|
66
82
|
```ruby
|
|
67
83
|
require 'hidemyass'
|
|
@@ -72,10 +88,6 @@ urls = HideMyAss.proxies.map(&:url)
|
|
|
72
88
|
|
|
73
89
|
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?`.
|
|
74
90
|
|
|
75
|
-
Print out all proxy urls on command line:
|
|
76
|
-
|
|
77
|
-
$ bundle exec hidemyass
|
|
78
|
-
|
|
79
91
|
## Development
|
|
80
92
|
|
|
81
93
|
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/proxy.rb
CHANGED
|
@@ -33,62 +33,34 @@ module HideMyAss
|
|
|
33
33
|
@row = row
|
|
34
34
|
end
|
|
35
35
|
|
|
36
|
-
# Time in seconds when the last ping was made.
|
|
37
|
-
#
|
|
38
|
-
# @return [ Int ]
|
|
39
|
-
def last_updated
|
|
40
|
-
@last_updated ||= begin
|
|
41
|
-
@row.at_xpath('td[1]').text.strip.split(' ').map do |it|
|
|
42
|
-
case it
|
|
43
|
-
when /sec/ then it.scan(/\d+/)[0].to_i
|
|
44
|
-
when /min/ then it.scan(/\d+/)[0].to_i * 60
|
|
45
|
-
when /h/ then it.scan(/\d+/)[0].to_i * 3_600
|
|
46
|
-
when /d/ then it.scan(/\d+/)[0].to_i * 86_400
|
|
47
|
-
end
|
|
48
|
-
end.reduce(&:+)
|
|
49
|
-
end
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
alias last_test last_updated
|
|
53
|
-
|
|
54
36
|
# The IP of the proxy server.
|
|
55
37
|
#
|
|
56
38
|
# @return [ String ]
|
|
57
39
|
def ip
|
|
58
|
-
@ip ||= @row.at_xpath('td[
|
|
59
|
-
.select { |el| ip_block? el }
|
|
60
|
-
.map! { |el| el.text.strip }
|
|
61
|
-
.join('')
|
|
40
|
+
@ip ||= @row.at_xpath('td[1]/text()').text.strip
|
|
62
41
|
end
|
|
63
42
|
|
|
64
43
|
# The port for the proxy.
|
|
65
44
|
#
|
|
66
45
|
# @return [ Int ]
|
|
67
46
|
def port
|
|
68
|
-
@port ||= @row.at_xpath('td[
|
|
47
|
+
@port ||= @row.at_xpath('td[2]/text()').text.strip.to_i
|
|
69
48
|
end
|
|
70
49
|
|
|
71
50
|
# The country where the proxy is hosted in downcase letters.
|
|
72
51
|
#
|
|
73
52
|
# @return [ String ]
|
|
74
53
|
def country
|
|
75
|
-
@country ||= @row.at_xpath('td[
|
|
54
|
+
@country ||= @row.at_xpath('td[3]/div/text()')
|
|
55
|
+
.text.strip.downcase!.scan(/[[:word:]]+$/).last
|
|
76
56
|
end
|
|
77
57
|
|
|
78
58
|
# The average response time in milliseconds.
|
|
79
59
|
#
|
|
80
60
|
# @return [ Int ]
|
|
81
61
|
def speed
|
|
82
|
-
@speed ||= @row.at_xpath('td[
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
alias response_time speed
|
|
86
|
-
|
|
87
|
-
# The average connection time in milliseconds.
|
|
88
|
-
#
|
|
89
|
-
# @return [ Int ]
|
|
90
|
-
def connection_time
|
|
91
|
-
@connection_time ||= @row.at_xpath('td[6]/div')[:value].to_i
|
|
62
|
+
@speed ||= @row.at_xpath('td[4]/div/div/p/text()')
|
|
63
|
+
.text.scan(/^\d+/)[0].to_i
|
|
92
64
|
end
|
|
93
65
|
|
|
94
66
|
# The network protocol in in downcase letters.
|
|
@@ -96,7 +68,7 @@ module HideMyAss
|
|
|
96
68
|
#
|
|
97
69
|
# @return [ String ]
|
|
98
70
|
def type
|
|
99
|
-
@type ||= @row.at_xpath('td[
|
|
71
|
+
@type ||= @row.at_xpath('td[5]/text()').text.strip.split.last.downcase!
|
|
100
72
|
end
|
|
101
73
|
|
|
102
74
|
alias protocol type
|
|
@@ -106,21 +78,28 @@ module HideMyAss
|
|
|
106
78
|
#
|
|
107
79
|
# @return [ String ]
|
|
108
80
|
def anonymity
|
|
109
|
-
@anonymity ||= @row.at_xpath('td[
|
|
81
|
+
@anonymity ||= @row.at_xpath('td[6]').text.strip.downcase!
|
|
110
82
|
end
|
|
111
83
|
|
|
112
|
-
#
|
|
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.
|
|
113
92
|
#
|
|
114
93
|
# @return [ String ]
|
|
115
|
-
def
|
|
116
|
-
"#{
|
|
94
|
+
def rel_url
|
|
95
|
+
"#{ip}:#{port}"
|
|
117
96
|
end
|
|
118
97
|
|
|
119
|
-
#
|
|
98
|
+
# The complete URL of that proxy server.
|
|
120
99
|
#
|
|
121
|
-
# @return [
|
|
122
|
-
def
|
|
123
|
-
|
|
100
|
+
# @return [ String ]
|
|
101
|
+
def url
|
|
102
|
+
"#{protocol}://#{rel_url}"
|
|
124
103
|
end
|
|
125
104
|
|
|
126
105
|
# If the proxy's network protocol is HTTP.
|
|
@@ -165,7 +144,6 @@ module HideMyAss
|
|
|
165
144
|
anonym? && ssl?
|
|
166
145
|
end
|
|
167
146
|
|
|
168
|
-
# :nocov:
|
|
169
147
|
# Custom inspect method.
|
|
170
148
|
#
|
|
171
149
|
# @example
|
|
@@ -173,27 +151,10 @@ module HideMyAss
|
|
|
173
151
|
# => '<HideMyAss::Proxy http://123.57.52.171:80>'
|
|
174
152
|
#
|
|
175
153
|
# @return [ String ]
|
|
154
|
+
# :nocov:
|
|
176
155
|
def inspect
|
|
177
156
|
"<#{self.class.name} #{url}>"
|
|
178
157
|
end
|
|
179
158
|
# :nocov:
|
|
180
|
-
|
|
181
|
-
private
|
|
182
|
-
|
|
183
|
-
# To find out if the element is a part of the IP.
|
|
184
|
-
#
|
|
185
|
-
# @param [ Nokogiri::XML ] el
|
|
186
|
-
#
|
|
187
|
-
# @return [ Boolean ]
|
|
188
|
-
def ip_block?(el)
|
|
189
|
-
return el[:style].include? 'in' if el[:style]
|
|
190
|
-
|
|
191
|
-
@clss ||= @row.at_xpath('td[2]/span/style').text.split
|
|
192
|
-
.map! { |it| it[1..4] if it !~ /none/ }.compact
|
|
193
|
-
|
|
194
|
-
cls = el[:class].to_s
|
|
195
|
-
|
|
196
|
-
el.name == 'text' || @clss.include?(cls) || cls =~ /^\d+$/
|
|
197
|
-
end
|
|
198
159
|
end
|
|
199
160
|
end
|
data/lib/hidemyass/proxy_list.rb
CHANGED
|
@@ -17,7 +17,7 @@ module HideMyAss
|
|
|
17
17
|
include Enumerable
|
|
18
18
|
extend Forwardable
|
|
19
19
|
|
|
20
|
-
ENDPOINT = '
|
|
20
|
+
ENDPOINT = 'https://incloak.com/proxy-list/?start=0&end=2000'.freeze
|
|
21
21
|
|
|
22
22
|
private_constant :ENDPOINT
|
|
23
23
|
|
|
@@ -27,30 +27,37 @@ module HideMyAss
|
|
|
27
27
|
#
|
|
28
28
|
# @return [ HideMyAss::ProxyList ]
|
|
29
29
|
def initialize(form_data = HideMyAss.form_data)
|
|
30
|
-
self.form_data = form_data.
|
|
31
|
-
@proxies = fetch
|
|
30
|
+
self.form_data = form_data.reject { |_, v| v.nil? }
|
|
31
|
+
@proxies = fetch
|
|
32
32
|
end
|
|
33
33
|
|
|
34
|
+
def_delegator :@proxies, :each
|
|
35
|
+
|
|
34
36
|
# Form data to support custom searches
|
|
37
|
+
#
|
|
38
|
+
# @return [ Hash ]
|
|
35
39
|
attr_accessor :form_data
|
|
36
40
|
|
|
37
|
-
|
|
41
|
+
# Build URI for endpoint including all search form params.
|
|
42
|
+
#
|
|
43
|
+
# @return [ URI ]
|
|
44
|
+
def uri
|
|
45
|
+
uri = URI(ENDPOINT)
|
|
46
|
+
uri.query = URI.encode_www_form(form_data)
|
|
47
|
+
uri
|
|
48
|
+
end
|
|
38
49
|
|
|
39
50
|
private
|
|
40
51
|
|
|
41
52
|
# Fetch list of all proxies.
|
|
42
53
|
#
|
|
43
54
|
# @return [ Array<HideMyAss::Proxy> ]
|
|
44
|
-
def fetch
|
|
45
|
-
|
|
46
|
-
page
|
|
47
|
-
|
|
48
|
-
sel_lnk = 'section > section.section-component > section.hma-pagination li.arrow.next:not(.unavailable) > a' # rubocop:disable Metrics/LineLength
|
|
49
|
-
|
|
50
|
-
proxies = page.xpath(sel_row).map { |row| Proxy.new(row) }
|
|
51
|
-
link = page.at_css(sel_lnk)
|
|
55
|
+
def fetch
|
|
56
|
+
body = Net::HTTP.get(uri)
|
|
57
|
+
page = Nokogiri::HTML(body, nil, 'UTF-8')
|
|
58
|
+
sel = '//*[@id="content-section"]/section[1]/div/table/tbody/tr'
|
|
52
59
|
|
|
53
|
-
|
|
60
|
+
page.xpath(sel).map { |row| Proxy.new(row) }
|
|
54
61
|
rescue Timeout::Error
|
|
55
62
|
[]
|
|
56
63
|
end
|
data/lib/hidemyass/version.rb
CHANGED
data/lib/hidemyass.rb
CHANGED
|
@@ -69,28 +69,21 @@ module HideMyAss
|
|
|
69
69
|
|
|
70
70
|
# Get form data for custom search.
|
|
71
71
|
#
|
|
72
|
-
#
|
|
73
|
-
#
|
|
74
|
-
#
|
|
75
|
-
#
|
|
76
|
-
#
|
|
77
|
-
#
|
|
78
|
-
#
|
|
79
|
-
# o - Order. 0, 1 = DESC, ASC.
|
|
80
|
-
# pp - Per Page. 0..3 = 10, 25, 50, 100.
|
|
81
|
-
# sortBy - Sort by. Defaults to date.
|
|
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.
|
|
82
79
|
#
|
|
83
80
|
# @return [ Hash ]
|
|
84
81
|
def self.form_data
|
|
85
|
-
@form_data ||= {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
's' => 1,
|
|
92
|
-
'o' => 0,
|
|
93
|
-
'pp' => 3,
|
|
94
|
-
'sortBy' => 'response_time' }
|
|
82
|
+
@form_data ||= { start: 0,
|
|
83
|
+
end: 2000,
|
|
84
|
+
anon: nil,
|
|
85
|
+
type: nil,
|
|
86
|
+
ports: nil,
|
|
87
|
+
maxtime: nil }
|
|
95
88
|
end
|
|
96
89
|
end
|
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.0
|
|
4
|
+
version: 1.1.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-09 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|