stealth_browser_automation 1.1.22 → 1.1.23
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/stealth_browser_automation.rb +16 -10
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5d6faad7a5e569cccff434a14bfb1eff858b861d
|
4
|
+
data.tar.gz: a59900bf05b6c0c49d85c9552e8b9a10d125a3d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ea31855118dcf73ca711841e337f18be379bb4a6b1caedcdb7a743d314063bb33e649abb004c3b9972a938dfbc1ffa9392c7313e31f245e2728e854fddcecc9f
|
7
|
+
data.tar.gz: ebc2208d2ab49018a6b0cbe84028c68f585a1d1fe4c44f15744707be65eb1b140e102f5d1fd037f056335f920f3be07d32b615d0fd8fac564b86354ccad4c90b
|
@@ -52,31 +52,37 @@ module BlackStack
|
|
52
52
|
def self.remove_local_profile(profile_id)
|
53
53
|
url = "http://127.0.0.1:#{BlackStack::StealthBrowserAutomation::Multilogin::mla_local_port.to_s}/api/v2/localprofile/remove?profileId=#{profile_id}"
|
54
54
|
uri = URI.parse(url)
|
55
|
-
req = Net::HTTP::Post.new(uri)
|
56
|
-
req['Content-Type'] = 'application/json'
|
57
55
|
res = Net::HTTP.start(uri.host, uri.port, :use_ssl => false, :verify_mode => OpenSSL::SSL::VERIFY_NONE) {|http|
|
58
56
|
req = Net::HTTP::Post.new(uri)
|
59
57
|
req['Content-Type'] = 'application/json'
|
60
58
|
req.body = [profile_id].to_json
|
61
59
|
res = JSON.parse(http.request(req).body)
|
62
60
|
raise "Error creating Multilogin local profile: #{res.to_s}" if res['status'] != 'OK'
|
63
|
-
return
|
61
|
+
return
|
64
62
|
}
|
65
63
|
end # def self.delete_profile
|
66
64
|
|
67
65
|
# returns the profileId of the new Mimic profile
|
66
|
+
# TODO: validar posibles errores
|
68
67
|
def self.local_profiles()
|
69
68
|
url = "http://127.0.0.1:#{BlackStack::StealthBrowserAutomation::Multilogin::mla_local_port.to_s}/api/v2/localprofile/list"
|
70
69
|
uri = URI.parse(url)
|
71
|
-
req = Net::HTTP::Post.new(uri)
|
72
|
-
req['Content-Type'] = 'application/json'
|
73
70
|
res = Net::HTTP.start(uri.host, uri.port, :use_ssl => false, :verify_mode => OpenSSL::SSL::VERIFY_NONE) {|http|
|
74
|
-
|
71
|
+
req = Net::HTTP::Get.new(uri)
|
72
|
+
#req['Content-Type'] = 'application/json'
|
73
|
+
#req.body = {}.to_json
|
74
|
+
res = JSON.parse(http.request(req).body)
|
75
|
+
#raise "Error creating Multilogin local profile: #{res.to_s}" if res['status'] != 'OK'
|
76
|
+
return res
|
75
77
|
}
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
78
|
+
end # def self.delete_profile
|
79
|
+
|
80
|
+
# returns the profile_id from its name.
|
81
|
+
# If not exists a profile with such name, it returns nil.
|
82
|
+
def self.local_profile_id(name)
|
83
|
+
h = self.local_profiles.select { |h| h['name'] == name }.first
|
84
|
+
return nil if h.nil?
|
85
|
+
h['sid']
|
80
86
|
end # def self.delete_profile
|
81
87
|
|
82
88
|
# returns the profileId of the new Mimic profile
|