stealth_browser_automation 1.1.22 → 1.1.27
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/browserfactory.rb +29 -7
- data/lib/stealth_browser_automation.rb +17 -11
- 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: ed89e0a607d7dc698215170b54a766da1c7a51ee
|
4
|
+
data.tar.gz: 26c154e280f2f0d3fcb4e69faf3664f561e32baf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b68e5412c006a0282b7216e9629068d3bcb884f764419652c1e2622fe7c17497db19a4324fc647fe9d7891b1e6255ae42ed1c5fd8c665cd4fdca7bea60f6a695
|
7
|
+
data.tar.gz: f18e7cb71be0b2b2abe89963951982ac7fa76523c5f812e5e093b5a43a40568848bf0f639a00c01a4db9fee07d201b277deab472c0462d13e9301b1e2cbb711d
|
data/lib/browserfactory.rb
CHANGED
@@ -566,31 +566,53 @@ module BlackStack
|
|
566
566
|
end
|
567
567
|
|
568
568
|
elsif @@type == BlackStack::BrowserFactory::TYPE_MIMIC
|
569
|
+
=begin
|
570
|
+
puts ''
|
569
571
|
begin
|
570
|
-
|
571
|
-
|
572
|
+
print 'Close browser?... '
|
573
|
+
if !@@browser.nil?
|
574
|
+
puts 'yes'
|
575
|
+
print 'Close browser... '
|
576
|
+
@@browser.close
|
577
|
+
puts 'done'
|
578
|
+
else
|
579
|
+
puts 'no'
|
580
|
+
end
|
581
|
+
rescue => e
|
582
|
+
puts "error: #{e.to_s}"
|
572
583
|
end
|
573
|
-
|
584
|
+
=end
|
574
585
|
begin
|
575
586
|
# TODO: entender porque debo hacer esta llamada a start para que el perfil se cierre cuando ya estaba iniciado
|
576
|
-
|
587
|
+
puts ''
|
588
|
+
print 'Close browser?... '
|
589
|
+
if !@@profile_name.nil?
|
590
|
+
puts 'yes'
|
591
|
+
print 'Close browser... '
|
592
|
+
BlackStack::BrowserFactory.mimic(@@profile_name)
|
593
|
+
puts 'done'
|
594
|
+
else
|
595
|
+
puts 'no'
|
596
|
+
end
|
577
597
|
rescue
|
578
598
|
# nothing here
|
579
599
|
end
|
580
|
-
|
600
|
+
=begin
|
581
601
|
i = 0
|
582
602
|
max = 3
|
583
603
|
success = false
|
584
604
|
while i<max && !success
|
585
605
|
i+=1
|
606
|
+
print "Api Call #{i.to_s}... "
|
586
607
|
url = "http://127.0.0.1:#{BlackStack::StealthBrowserAutomation::Multilogin::mla_local_port}/api/v1/profile/stop?profileId=#{@@profile_name}"
|
587
608
|
uri = URI.parse(url)
|
588
609
|
body = Net::HTTP.get(uri)
|
589
610
|
res = JSON.parse(body)
|
590
611
|
success = true if res['status'].to_s == 'OK'
|
612
|
+
puts "response: #{res['status'].to_s}"
|
591
613
|
end # while i<max
|
592
|
-
raise
|
593
|
-
|
614
|
+
raise "Error requesting Mimic to stop (tried #{i.to_s} times)" if !success
|
615
|
+
=end
|
594
616
|
else
|
595
617
|
raise 'Cannot destroy browser due unknown browser type'
|
596
618
|
end
|
@@ -50,33 +50,39 @@ module BlackStack
|
|
50
50
|
|
51
51
|
# returns the profileId of the new Mimic profile
|
52
52
|
def self.remove_local_profile(profile_id)
|
53
|
-
url = "http://127.0.0.1:#{BlackStack::StealthBrowserAutomation::Multilogin::mla_local_port.to_s}/api/v2/localprofile/remove
|
53
|
+
url = "http://127.0.0.1:#{BlackStack::StealthBrowserAutomation::Multilogin::mla_local_port.to_s}/api/v2/localprofile/remove"
|
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
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stealth_browser_automation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.27
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Leandro Daniel Sardi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-06-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mini_magick
|