pwn 0.4.429 → 0.4.430

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
  SHA256:
3
- metadata.gz: 101c2b7768232bb1ffc67b7304cd58d8d1968fd2549958dadd8d1fbfc79b9ac1
4
- data.tar.gz: 3a56e33451f7bf6868a2dbe124ae1c6cb9a03389a5af7dea8e1c567d46081fb2
3
+ metadata.gz: c31b2ac11c6feecd92b4cd5fb270270c7cf91794dec67257bd18b1ba5ce330f4
4
+ data.tar.gz: b774b6329c49e18d65720fad8e4ae0976cbce0507489e039b2b5745baf85055e
5
5
  SHA512:
6
- metadata.gz: 54c49f48521be56ba68642530ed280253a6835acbab991ee6bf9560e9912e103f34d17127be3dc4a27dcbddc03c426118705d2e4428d6753760a58d449f9f3ac
7
- data.tar.gz: 5f05900cb509d463f888852ea36a3c40a36d360912009c4c476a1deae04049e35e825aa5d75fc6c2afa22f9887a54a320f5108df5e424e3de84267c8acd6cb17
6
+ metadata.gz: '08fc344ede5c67f38ef52aba9ed5d6fa9a9fcc7d1ec6b0f0f8486520a118ca94bf8de5219a93d00286813d1174270793805b3866ea99841571c0ddceedaff00f'
7
+ data.tar.gz: 9061c5bd187b2c0c99229cd35dbe31aec1d1935c6465a07b5bfaa55691888d280f68eade1217e5a518d2ecfda5b2509a81dfe35b26d60f6dca8cffb7b302c6b6
data/README.md CHANGED
@@ -37,7 +37,7 @@ $ rvm use ruby-3.1.2@pwn
37
37
  $ rvm list gemsets
38
38
  $ gem install --verbose pwn
39
39
  $ pwn
40
- pwn[v0.4.429]:001 >>> PWN.help
40
+ pwn[v0.4.430]:001 >>> PWN.help
41
41
  ```
42
42
 
43
43
  [![Installing the pwn Security Automation Framework](https://raw.githubusercontent.com/0dayInc/pwn/master/documentation/pwn_install.png)](https://youtu.be/G7iLUY4FzsI)
@@ -52,7 +52,7 @@ $ rvm use ruby-3.1.2@pwn
52
52
  $ gem uninstall --all --executables pwn
53
53
  $ gem install --verbose pwn
54
54
  $ pwn
55
- pwn[v0.4.429]:001 >>> PWN.help
55
+ pwn[v0.4.430]:001 >>> PWN.help
56
56
  ```
57
57
 
58
58
 
@@ -31,8 +31,8 @@ OptionParser.new do |options|
31
31
  opts[:folder_name] = f
32
32
  end
33
33
 
34
- options.on('-sSCANNER', '--scanner=SCANNER', '<Optional - Scanner to Use (Defaults to "AUTO-ROUTED")>') do |s|
35
- opts[:scanner] = s
34
+ options.on('-sSCANNER', '--scanner-name=SCANNER', '<Optional - Scanner to Use (Defaults to "AUTO-ROUTED")>') do |s|
35
+ opts[:scanner_name] = s
36
36
  end
37
37
 
38
38
  options.on('-nTARGET', '--target-network=TARGET', '<Optional if --scanner other than AUTO-ROUTED, Otherwise Required - Network to Scan (Defaults to "default-network")>') do |n|
@@ -77,8 +77,8 @@ begin
77
77
  folder_name = opts[:folder_name]
78
78
  folder_name ||= 'main'
79
79
 
80
- scanner = opts[:scanner]
81
- scanner ||= 'AUTO-ROUTED'
80
+ scanner_name = opts[:scanner_name]
81
+ scanner_name ||= 'AUTO-ROUTED'
82
82
 
83
83
  target_network = opts[:target_network]
84
84
  target_network ||= '00000000-0000-0000-0000-000000000000'
@@ -94,30 +94,33 @@ begin
94
94
  secret_key: secret_key
95
95
  )
96
96
 
97
- scan_template_list = PWN::Plugins::NessusCloud.get_canned_scan_templates(
98
- nessus_obj: nessus_obj
97
+ scan_template = PWN::Plugins::NessusCloud.get_canned_scan_templates(
98
+ nessus_obj: nessus_obj,
99
+ title: scan_template
99
100
  )
101
+ scan_template_id = scan_template[:uuid]
102
+ puts scan_template_id
100
103
 
101
- selected_scan_template = scan_template_list[:templates].select do |sc|
102
- sc[:title] == scan_template
103
- end
104
-
105
- scan_template_id = selected_scan_template.first[:uuid]
106
-
107
- policy_list = PWN::Plugins::NessusCloud.get_policies(
108
- nessus_obj: nessus_obj
104
+ policy = PWN::Plugins::NessusCloud.get_policies(
105
+ nessus_obj: nessus_obj,
106
+ name: policy_name
109
107
  )
110
- puts policy_list.inspect
108
+ policy_id = policy[:id]
109
+ puts policy_id
111
110
 
112
- folder_list = PWN::Plugins::NessusCloud.get_folders(
113
- nessus_obj: nessus_obj
111
+ folder = PWN::Plugins::NessusCloud.get_folders(
112
+ nessus_obj: nessus_obj,
113
+ name: folder_name
114
114
  )
115
- puts folder_list.inspect
115
+ folder_id = folder[:id]
116
+ puts folder_id
116
117
 
117
- scanner_list = PWN::Plugins::NessusCloud.get_scanners(
118
- nessus_obj: nessus_obj
118
+ scanner = PWN::Plugins::NessusCloud.get_scanners(
119
+ nessus_obj: nessus_obj,
120
+ name: scanner_name
119
121
  )
120
- puts scanner_list.inspect
122
+ scanner_id = scanner[:id]
123
+ puts scanner_id
121
124
 
122
125
  target_network_list = PWN::Plugins::NessusCloud.get_target_networks(
123
126
  nessus_obj: nessus_obj
@@ -54,15 +54,11 @@ begin
54
54
  secret_key: secret_key
55
55
  )
56
56
 
57
- scan_list = PWN::Plugins::NessusCloud.get_scans(
58
- nessus_obj: nessus_obj
57
+ scan = PWN::Plugins::NessusCloud.get_scans(
58
+ nessus_obj: nessus_obj,
59
+ name: scan_name
59
60
  )
60
-
61
- selected_scan_to_launch = scan_list[:scans].select do |scan|
62
- scan[:name] == scan_name
63
- end
64
-
65
- scan_id = selected_scan_to_launch.first[:id]
61
+ scan_id = scan[:id]
66
62
 
67
63
  PWN::Plugins::NessusCloud.launch_scan(
68
64
  nessus_obj: nessus_obj,
@@ -99,13 +99,24 @@ module PWN
99
99
 
100
100
  public_class_method def self.get_canned_scan_templates(opts = {})
101
101
  nessus_obj = opts[:nessus_obj]
102
+ title = opts[:title]
102
103
 
103
104
  scan_templates_resp = nessus_cloud_rest_call(
104
105
  nessus_obj: nessus_obj,
105
106
  rest_call: 'editor/scan/templates'
106
107
  ).body
107
108
 
108
- JSON.parse(scan_templates_resp, symbolize_names: true)
109
+ scan_templates = JSON.parse(scan_templates_resp, symbolize_names: true)
110
+
111
+ if title
112
+ selected_scan_template = scan_templates[:templates].select do |sc|
113
+ sc[:title] == title
114
+ end
115
+ scan_templates = selected_scan_template.first if selected_scan_template.any?
116
+ scan_templates ||= {}
117
+ end
118
+
119
+ scan_templates
109
120
  rescue StandardError, SystemExit, Interrupt => e
110
121
  raise e
111
122
  end
@@ -117,13 +128,24 @@ module PWN
117
128
 
118
129
  public_class_method def self.get_policies(opts = {})
119
130
  nessus_obj = opts[:nessus_obj]
131
+ name = opts[:name]
120
132
 
121
133
  scan_templates_resp = nessus_cloud_rest_call(
122
134
  nessus_obj: nessus_obj,
123
135
  rest_call: 'policies'
124
136
  ).body
125
137
 
126
- JSON.parse(scan_templates_resp, symbolize_names: true)
138
+ policies = JSON.parse(scan_templates_resp, symbolize_names: true)
139
+
140
+ if name
141
+ selected_policy = policies[:policies].select do |p|
142
+ p[:name] == name
143
+ end
144
+ policies = selected_policy.first if selected_policy.any?
145
+ policies ||= {}
146
+ end
147
+
148
+ policies
127
149
  rescue StandardError, SystemExit, Interrupt => e
128
150
  raise e
129
151
  end
@@ -135,13 +157,24 @@ module PWN
135
157
 
136
158
  public_class_method def self.get_folders(opts = {})
137
159
  nessus_obj = opts[:nessus_obj]
160
+ name = opts[:name]
138
161
 
139
162
  scan_templates_resp = nessus_cloud_rest_call(
140
163
  nessus_obj: nessus_obj,
141
- rest_call: 'policies'
164
+ rest_call: 'folders'
142
165
  ).body
143
166
 
144
- JSON.parse(scan_templates_resp, symbolize_names: true)
167
+ folders = JSON.parse(scan_templates_resp, symbolize_names: true)
168
+
169
+ if name
170
+ selected_folder = folders[:folders].select do |f|
171
+ f[:name] == name
172
+ end
173
+ folders = selected_folder.first if selected_folder.any?
174
+ folders ||= {}
175
+ end
176
+
177
+ folders
145
178
  rescue StandardError, SystemExit, Interrupt => e
146
179
  raise e
147
180
  end
@@ -153,13 +186,24 @@ module PWN
153
186
 
154
187
  public_class_method def self.get_scanners(opts = {})
155
188
  nessus_obj = opts[:nessus_obj]
189
+ name = opts[:name]
156
190
 
157
191
  scan_templates_resp = nessus_cloud_rest_call(
158
192
  nessus_obj: nessus_obj,
159
193
  rest_call: 'scanners'
160
194
  ).body
161
195
 
162
- JSON.parse(scan_templates_resp, symbolize_names: true)
196
+ scanners = JSON.parse(scan_templates_resp, symbolize_names: true)
197
+
198
+ if name
199
+ selected_scanner = scanners[:scanners].select do |s|
200
+ s[:name] == name
201
+ end
202
+ scanners = selected_scanner.first if selected_scanner.any?
203
+ scanners ||= {}
204
+ end
205
+
206
+ scanners
163
207
  rescue StandardError, SystemExit, Interrupt => e
164
208
  raise e
165
209
  end
@@ -189,13 +233,24 @@ module PWN
189
233
 
190
234
  public_class_method def self.get_scans(opts = {})
191
235
  nessus_obj = opts[:nessus_obj]
236
+ name = opts[:name]
192
237
 
193
238
  scans_resp = nessus_cloud_rest_call(
194
239
  nessus_obj: nessus_obj,
195
240
  rest_call: 'scans'
196
241
  ).body
197
242
 
198
- JSON.parse(scans_resp, symbolize_names: true)
243
+ scans = JSON.parse(scans_resp, symbolize_names: true)
244
+
245
+ if name
246
+ selected_scan = scans[:scans].select do |s|
247
+ s[:name] == name
248
+ end
249
+ scans = selected_scan.first if selected_scan.any?
250
+ scans ||= {}
251
+ end
252
+
253
+ scans
199
254
  rescue StandardError, SystemExit, Interrupt => e
200
255
  raise e
201
256
  end
data/lib/pwn/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PWN
4
- VERSION = '0.4.429'
4
+ VERSION = '0.4.430'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pwn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.429
4
+ version: 0.4.430
5
5
  platform: ruby
6
6
  authors:
7
7
  - 0day Inc.