Skip to content

Commit d931efa

Browse files
authored
Merge pull request #490 from ninp0/master
PWN::Plugins::BlackDuckBinaryAnalysis module - duplicate behavior or …
2 parents 37b7968 + 41c081e commit d931efa

File tree

3 files changed

+20
-8
lines changed

3 files changed

+20
-8
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ $ cd /opt/pwn
3737
$ ./install.sh
3838
$ ./install.sh ruby-gem
3939
$ pwn
40-
pwn[v0.4.989]:001 >>> PWN.help
40+
pwn[v0.4.990]:001 >>> PWN.help
4141
```
4242

4343
[![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.3.0@pwn
5252
$ gem uninstall --all --executables pwn
5353
$ gem install --verbose pwn
5454
$ pwn
55-
pwn[v0.4.989]:001 >>> PWN.help
55+
pwn[v0.4.990]:001 >>> PWN.help
5656
```
5757

5858
If you're using a multi-user install of RVM do:
@@ -62,7 +62,7 @@ $ rvm use ruby-3.3.0@pwn
6262
$ rvmsudo gem uninstall --all --executables pwn
6363
$ rvmsudo gem install --verbose pwn
6464
$ pwn
65-
pwn[v0.4.989]:001 >>> PWN.help
65+
pwn[v0.4.990]:001 >>> PWN.help
6666
```
6767

6868
PWN periodically upgrades to the latest version of Ruby which is reflected in `/opt/pwn/.ruby-version`. The easiest way to upgrade to the latest version of Ruby from a previous PWN installation is to run the following script:

lib/pwn/plugins/black_duck_binary_analysis.rb

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,15 @@ module BlackDuckBinaryAnalysis
6060

6161
when :post, :put
6262
if http_body.is_a?(Hash)
63-
headers[:content_type] = 'multipart/form-data' if http_body.key?(:multipart)
64-
http_body = http_body.to_json unless http_body.key?(:multipart)
63+
case http_body.key?
64+
when :multipart
65+
headers[:content_type] = 'multipart/form-data'
66+
when :raw
67+
headers[:content_type] = nil
68+
http_body = http_body[:file]
69+
else
70+
http_body = http_body.to_json unless http_body.key?(:multipart)
71+
end
6572
end
6673

6774
response = rest_client.execute(
@@ -178,9 +185,14 @@ module BlackDuckBinaryAnalysis
178185
replace: product_id
179186
}
180187

188+
# http_body = {
189+
# multipart: true,
190+
# file: File.new(file, 'rb')
191+
# }
192+
181193
http_body = {
182-
multipart: true,
183-
file: File.new(file, 'rb')
194+
raw: true,
195+
file: File.binread(file)
184196
}
185197

186198
response = bd_bin_analysis_rest_call(

lib/pwn/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
22

33
module PWN
4-
VERSION = '0.4.989'
4+
VERSION = '0.4.990'
55
end

0 commit comments

Comments
 (0)