pwn 0.4.741 → 0.4.742

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: 7d584af8d0758445720f5d35b48ce3f518f57c18fca496626ad5e170d1d4d6d6
4
- data.tar.gz: 67695c0f58e76ac3ffee236312e2dcf45a2df36ef58f61f6a089bdd764e55641
3
+ metadata.gz: f03ccf5285b9493395a67e0b5b51843362dbfc39ba2326128beec08a9cae11e1
4
+ data.tar.gz: 48c793f00f5c0be3965bd431562bb8e8f30684b328dc9eced35ea920d745889b
5
5
  SHA512:
6
- metadata.gz: e12c51833606be3cc64c6a492ab4bc1999299c71f4fe2d0071bfc5aba1d77404445b30ed156156eeee3203a9b287a787425e3624136b77b9acf451ba5ad4b773
7
- data.tar.gz: 92ece1165b579ea8792122699d91d88f977945c4ea8e4d0a2f9095eca43c6d07b150bea49ec6edec280357c05d956cf4e76868ce9d707b37ba2393fa74d1fc3b
6
+ metadata.gz: 8a1516cc7f528b8775563dcfa0e835ac9764775b38b494da666bd2a9bcd86a7a7ac640c80a78fbd19a690645a9d9759dc48b3b346615f2222325f35d9c4f4572
7
+ data.tar.gz: 6b651741cecc34f0f23d3b0d6ec994dbabfba7febe50f3eec18b9d55f6d6f8c010dca588948b139d6affbc3b8433b63c81789b03c66d459f1dcc058f80f212cd
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.741]:001 >>> PWN.help
40
+ pwn[v0.4.742]: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.2.2@pwn
52
52
  $ gem uninstall --all --executables pwn
53
53
  $ gem install --verbose pwn
54
54
  $ pwn
55
- pwn[v0.4.741]:001 >>> PWN.help
55
+ pwn[v0.4.742]:001 >>> PWN.help
56
56
  ```
57
57
 
58
58
 
@@ -0,0 +1,66 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: false
3
+
4
+ require 'optparse'
5
+ require 'pwn'
6
+ require 'yaml'
7
+
8
+ opts = {}
9
+ OptionParser.new do |options|
10
+ options.banner = "USAGE:
11
+ #{$PROGRAM_NAME} [opts]
12
+ "
13
+
14
+ options.on('-cCONFIG', '--config=CONFG', '<Required - Black Duck Binary Analysis YAML config>') do |c|
15
+ opts[:config] = c
16
+ end
17
+
18
+ options.on('-CGROUP', '--create=GROUP', '<Required - Black Duck Binary Analysis Group/Sub-Group to Create>') do |g|
19
+ opts[:group_name] = g
20
+ end
21
+
22
+ options.on('-pNAME', '--parent-group=NAME', '<Optional - Black Duck Binary Analysis Parent Group Name to Associate with Group>') do |p|
23
+ opts[:parent_group_name] = p
24
+ end
25
+ end.parse!
26
+
27
+ if opts.empty?
28
+ puts `#{$PROGRAM_NAME} --help`
29
+ exit 1
30
+ end
31
+
32
+ begin
33
+ pwn_provider = 'ruby-gem'
34
+ pwn_provider = ENV.fetch('PWN_PROVIDER') if ENV.keys.any? { |s| s == 'PWN_PROVIDER' }
35
+
36
+ config = opts[:config]
37
+ raise "ERROR: BDBA YAML Config File Not Found: #{config}" unless File.exist?(config)
38
+
39
+ yaml_config = YAML.load_file(config, symbolize_names: true)
40
+
41
+ token = yaml_config[:token]
42
+ raise "ERROR: BDBA Token Not Found: #{token}" if token.nil?
43
+
44
+ group_name = opts[:group_name]
45
+ raise "ERROR: BDBA Group Name Not Provided: #{group_name}" if group_name.nil?
46
+
47
+ parent_group_name = opts[:parent_group_name]
48
+
49
+ if parent_group_name
50
+ groups_resp = PWN::Plugins::BlackDuckBinaryAnalysis.get_groups(
51
+ token: token
52
+ )
53
+
54
+ parent_id = groups_resp[:data].find { |g| g[:name] == parent_group_name }[:id]
55
+ end
56
+
57
+ PWN::Plugins::BlackDuckBinaryAnalysis.create_group(
58
+ token: token,
59
+ name: group_name,
60
+ parent: parent_id
61
+ )
62
+ rescue SystemExit, Interrupt
63
+ puts "\nGoodbye."
64
+ rescue StandardError => e
65
+ raise e
66
+ end
data/bin/pwn_bdba_scan ADDED
@@ -0,0 +1,105 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: false
3
+
4
+ require 'optparse'
5
+ require 'pwn'
6
+ require 'yaml'
7
+
8
+ opts = {}
9
+ OptionParser.new do |options|
10
+ options.banner = "USAGE:
11
+ #{$PROGRAM_NAME} [opts]
12
+ "
13
+
14
+ options.on('-cCONFIG', '--config=CONFG', '<Required - Black Duck Binary Analysis YAML config>') do |g|
15
+ opts[:config] = g
16
+ end
17
+
18
+ options.on('-pNAME', '--parent-group=NAME', '<Required - Black Duck Binary Analysis Parent Group Name to Associate with Binary Scan>') do |p|
19
+ opts[:parent_group_name] = p
20
+ end
21
+
22
+ options.on('-sFILE', '--scan=FILE', '<Required - File to Scan in Black Duck Binary Analysis>') do |f|
23
+ opts[:target_file] = f
24
+ end
25
+
26
+ options.on('-rPATH', '--report=PATH', '<Required - Path to Save Black Duck Binary Analysis Scan Report>') do |r|
27
+ opts[:report_path] = r
28
+ end
29
+
30
+ options.on('-tTYPE', '--report-type=TYPE', '<Optional - Black Duck Binary Analysis Scan Report Type csv_libs|csv_vulns|pdf (Default: csv_vulns)>') do |t|
31
+ opts[:report_type] = t
32
+ end
33
+ end.parse!
34
+
35
+ if opts.empty?
36
+ puts `#{$PROGRAM_NAME} --help`
37
+ exit 1
38
+ end
39
+
40
+ begin
41
+ pwn_provider = 'ruby-gem'
42
+ pwn_provider = ENV.fetch('PWN_PROVIDER') if ENV.keys.any? { |s| s == 'PWN_PROVIDER' }
43
+
44
+ config = opts[:config]
45
+ raise "ERROR: BDBA YAML Config File Not Found: #{config}" unless File.exist?(config)
46
+
47
+ yaml_config = YAML.load_file(config, symbolize_names: true)
48
+
49
+ token = yaml_config[:token]
50
+ raise "ERROR: BDBA Token Not Found: #{token}" if token.nil?
51
+
52
+ parent_group_name = opts[:parent_group_name]
53
+ raise "ERROR: BDBA Parent Group Name Not Provided: #{parent_group_name}" if parent_group_name.nil?
54
+
55
+ target_file = opts[:target_file]
56
+ raise "ERROR: BDBA Target File Not Found: #{target_file}" unless File.exist?(target_file)
57
+
58
+ report_path = opts[:report_path]
59
+ raise "ERROR: BDBA Report Path Not Provided: #{report_path}" if report_path.nil?
60
+
61
+ report_type_str = opts[:report_type] ||= 'csv_vulns'
62
+ report_type = report_type_str.to_s.to_sym
63
+
64
+ groups_resp = PWN::Plugins::BlackDuckBinaryAnalysis.get_groups(
65
+ token: token
66
+ )
67
+
68
+ parent_id = groups_resp[:data].find { |g| g[:name] == parent_group_name }[:id]
69
+
70
+ PWN::Plugins::BlackDuckBinaryAnalysis.upload_file(
71
+ token: token,
72
+ file: target_file,
73
+ group_id: parent_id
74
+ )
75
+
76
+ scan_progress_resp = {}
77
+ loop do
78
+ scan_progress_resp = PWN::Plugins::BlackDuckBinaryAnalysis.get_apps_by_group(
79
+ token: token,
80
+ group_id: parent_id
81
+ )
82
+
83
+ 30.times do
84
+ print '.'
85
+ sleep 1
86
+ end
87
+
88
+ break if scan_progress_resp[:products].none? { |p| p[:status] == 'B' }
89
+ end
90
+
91
+ product_id = scan_progress_resp[:products].find { |p| p[:name] == File.basename(target_file) }[:product_id]
92
+
93
+ scan_report_resp = PWN::Plugins::BlackDuckBinaryAnalysis.generate_product_report(
94
+ token: token,
95
+ product_id: product_id,
96
+ type: report_type,
97
+ output_path: report_path
98
+ )
99
+
100
+ puts "Report Saved to: #{report_path}"
101
+ rescue SystemExit, Interrupt
102
+ puts "\nGoodbye."
103
+ rescue StandardError => e
104
+ raise e
105
+ 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.741'
4
+ VERSION = '0.4.742'
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.741
4
+ version: 0.4.742
5
5
  platform: ruby
6
6
  authors:
7
7
  - 0day Inc.
@@ -1138,6 +1138,8 @@ executables:
1138
1138
  - pwn_android_war_dialer
1139
1139
  - pwn_autoinc_version
1140
1140
  - pwn_aws_describe_resources
1141
+ - pwn_bdba_groups
1142
+ - pwn_bdba_scan
1141
1143
  - pwn_burp_suite_pro_active_scan
1142
1144
  - pwn_char_base64_encoding
1143
1145
  - pwn_char_dec_encoding
@@ -1203,6 +1205,8 @@ files:
1203
1205
  - bin/pwn_android_war_dialer
1204
1206
  - bin/pwn_autoinc_version
1205
1207
  - bin/pwn_aws_describe_resources
1208
+ - bin/pwn_bdba_groups
1209
+ - bin/pwn_bdba_scan
1206
1210
  - bin/pwn_burp_suite_pro_active_scan
1207
1211
  - bin/pwn_char_base64_encoding
1208
1212
  - bin/pwn_char_dec_encoding