stealth_browser_automation 1.1.34 → 1.2.38

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5660c0a8cfac17724f1aad4e21b85c7f0de2e543
4
- data.tar.gz: 92d1a4ef326a140a89c3eee26cd99e8b7b9d0e2d
3
+ metadata.gz: 4e0724c65c5e9b2ba3cac47a2c1dc03eec05feb7
4
+ data.tar.gz: a3219482f992c116ec77cd886be6396e093a7e8c
5
5
  SHA512:
6
- metadata.gz: 5fc9c6e5b0a50fdceee053b5e3fe9ebee2e5d6685fcf7af4a2cd047e84957d788540e71868bdb037e31c2f2c8a50cb0cd2a70fc869f18750fe19e730872b6e72
7
- data.tar.gz: 654463e6de3e88b7c21c90663968a4cf10a46be96f9dc1d393b5ff7336da475bac14046cd599447bedc4004492f499cbccc8c38537ead21a8df2281281bf3478
6
+ metadata.gz: 30482c1c81718f78a70dd2861c56c4ca11dad27cfb2c77aa6b9a81a19401f4be6d9572d2d115ff3825a7b105f73aa16c09bce43d3245f2dfaa2d4beab024be85
7
+ data.tar.gz: 24bb6b8a536929c277d84eee07703df2612cc96e5d16204832019e7b70538e53e677df7eb768427260bb4a186ab8a030ad370f7148a06c28c66e0d21e395a05e
data/lib/baseproxy.rb CHANGED
@@ -1,7 +1,31 @@
1
1
  module BlackStack
2
2
 
3
3
  module BaseProxy
4
-
4
+
5
+ ##
6
+ # creates new connection to google.com using +Faraday+ lib. Uses CGI::Cookie class
7
+ # to parse the cookie returned in the response. It then checks for the presense of
8
+ # "NID" cookie set by Google. If the cookie exists, proxy server is working just fine.
9
+ #
10
+ # references:
11
+ # - https://github.com/apoorvparijat/proxy-test
12
+ # - https://github.com/lostisland/faraday
13
+ #
14
+ def self.test(proxy_str)
15
+ begin
16
+ f = Faraday.new(:proxy => { :uri => "http://" + proxy_str})
17
+ response = f.get "http://www.google.com"
18
+ cookie = CGI::Cookie.parse(response.headers["set-cookie"])
19
+ if(cookie["NID"].empty?)
20
+ raise "#{proxy_str} is NOT working."
21
+ else
22
+ return true
23
+ end
24
+ rescue
25
+ raise "Connection to #{proxy_str} timed out"
26
+ end
27
+ end
28
+
5
29
  #
6
30
  def chrome_switches
7
31
  return ["--proxy-server=#{self.ip}:#{self.port}","--proxy-user-and-password=#{self.user}:#{self.password}"]