pwn 0.4.781 → 0.4.782
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 +2 -2
- data/bin/pwn_jenkins_install_plugin +45 -47
- data/lib/pwn/plugins/jenkins.rb +2 -10
- data/lib/pwn/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1450ae82baf714135135ab6704a4e64b727a2f736cae7e32f4a12e6f24fca5bf
|
4
|
+
data.tar.gz: 608fb1826e49e092b84872842d2c0c407a5d3993aaa64364714fcc9073ca61c4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 51cd7e78554f70f786fef5eab7025d8395fd954162887cfb4bd990abc36664b89198bc32f76bf68a22b665375c5b113cca3e8abf540d68d1270ec780310c76fc
|
7
|
+
data.tar.gz: 1686ea1951933bda3152f39293d9291bfde83ae49acdf6484094e6451c5e5a1a39091ab45a380da16c87339808bbcd45c166ba786be7fafb6108b3817958132f
|
data/README.md
CHANGED
@@ -37,7 +37,7 @@ $ rvm use ruby-3.2.2@pwn
|
|
37
37
|
$ rvm list gemsets
|
38
38
|
$ gem install --verbose pwn
|
39
39
|
$ pwn
|
40
|
-
pwn[v0.4.
|
40
|
+
pwn[v0.4.782]:001 >>> PWN.help
|
41
41
|
```
|
42
42
|
|
43
43
|
[](https://youtu.be/G7iLUY4FzsI)
|
@@ -52,7 +52,7 @@ $ rvm use ruby-3.2.2@pwn
|
|
52
52
|
$ gem uninstall --all --executables pwn
|
53
53
|
$ gem install --verbose pwn
|
54
54
|
$ pwn
|
55
|
-
pwn[v0.4.
|
55
|
+
pwn[v0.4.782]:001 >>> PWN.help
|
56
56
|
```
|
57
57
|
|
58
58
|
|
@@ -28,7 +28,7 @@ OptionParser.new do |options|
|
|
28
28
|
opts[:plugins] = plugins
|
29
29
|
end
|
30
30
|
|
31
|
-
options.on('-L', '--
|
31
|
+
options.on('-L', '--list-available', '<Optional - List Available Jenkins Plugins for Installation>') do |list_available_bool|
|
32
32
|
opts[:list_available_bool] = list_available_bool
|
33
33
|
end
|
34
34
|
|
@@ -42,54 +42,52 @@ if opts.empty?
|
|
42
42
|
exit 1
|
43
43
|
end
|
44
44
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
45
|
+
begin
|
46
|
+
ip = opts[:ip].to_s.scrub
|
47
|
+
port = opts[:port].to_i
|
48
|
+
username = opts[:username]
|
49
|
+
api_key = opts[:api_key]
|
50
|
+
plugins = opts[:plugins].to_s.scrub
|
51
|
+
list_available_bool = true if opts[:list_available_bool] ||= false
|
52
|
+
restart_jenkins = true if opts[:restart_jenkins] ||= false
|
53
|
+
|
54
|
+
if port.positive?
|
55
|
+
jenkins_obj = PWN::Plugins::Jenkins.connect(
|
56
|
+
ip: ip,
|
57
|
+
port: port,
|
58
|
+
username: username,
|
59
|
+
api_key: api_key
|
60
|
+
)
|
61
|
+
else
|
62
|
+
jenkins_obj = PWN::Plugins::Jenkins.connect(
|
63
|
+
ip: ip,
|
64
|
+
username: username,
|
65
|
+
api_key: api_key
|
66
|
+
)
|
67
|
+
end
|
55
68
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
end
|
69
|
+
if restart_jenkins
|
70
|
+
puts 'Restarting Jenkins...'
|
71
|
+
jenkins_obj.system.restart
|
72
|
+
exit 0
|
73
|
+
end
|
62
74
|
|
63
|
-
if
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
else
|
71
|
-
jenkins_obj = PWN::Plugins::Jenkins.connect(
|
72
|
-
ip: ip,
|
73
|
-
username: username,
|
74
|
-
api_key: api_key
|
75
|
-
)
|
76
|
-
end
|
75
|
+
if list_available_bool
|
76
|
+
puts jenkins_obj.plugin.list_available
|
77
|
+
else
|
78
|
+
plugin_arr = []
|
79
|
+
plugins.split(',').each do |p|
|
80
|
+
plugin_arr.push(p.strip.chomp)
|
81
|
+
end
|
77
82
|
|
78
|
-
|
79
|
-
puts jenkins_obj.plugin.list_available
|
80
|
-
else
|
81
|
-
plugin_arr = []
|
82
|
-
plugins.split(',').each do |p|
|
83
|
-
plugin_arr.push(p.strip.chomp)
|
83
|
+
jenkins_obj.plugin.install(plugin_arr)
|
84
84
|
end
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
85
|
+
rescue Interrupt
|
86
|
+
puts "\nGoodbye."
|
87
|
+
rescue JenkinsApi::Exceptions::ServiceUnavailable
|
88
|
+
puts 'Jenkins Server Unavailable.' unless restart_jenkins
|
89
|
+
rescue StandardError => e
|
90
|
+
raise e
|
91
|
+
ensure
|
92
|
+
PWN::Plugins::Jenkins.disconnect(jenkins_obj: jenkins_obj) unless restart_jenkins
|
93
93
|
end
|
94
|
-
|
95
|
-
PWN::Plugins::Jenkins.disconnect(jenkins_obj: jenkins_obj)
|
data/lib/pwn/plugins/jenkins.rb
CHANGED
@@ -23,20 +23,12 @@ module PWN
|
|
23
23
|
|
24
24
|
public_class_method def self.connect(opts = {})
|
25
25
|
ip = opts[:ip]
|
26
|
-
port =
|
27
|
-
opts[:port].to_i
|
28
|
-
else
|
29
|
-
8080
|
30
|
-
end
|
26
|
+
port = opts[:port].to_i ||= 8888
|
31
27
|
username = opts[:username].to_s.scrub
|
32
28
|
base_jenkins_api_uri = "https://#{ip}/ase/services".to_s.scrub
|
33
29
|
api_key = opts[:api_key].to_s.scrub
|
34
30
|
identity_file = opts[:identity_file].to_s.scrub
|
35
|
-
ssl_bool = if opts[:ssl]
|
36
|
-
opts[:ssl]
|
37
|
-
else
|
38
|
-
false
|
39
|
-
end
|
31
|
+
ssl_bool = true if opts[:ssl] ||= false
|
40
32
|
|
41
33
|
if opts[:proxy]
|
42
34
|
proxy = URI(opts[:proxy])
|
data/lib/pwn/version.rb
CHANGED