Skip to content

Commit

Permalink
PWN::Plugins::XXD module - #bugfix in #reverse_dump method when last …
Browse files Browse the repository at this point in the history
…line in hexdump is less than 16 bytes
  • Loading branch information
ninp0 committed Feb 1, 2024
1 parent 277711e commit 1dc3aca
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ gem 'savon', '2.14.0'
gem 'selenium-devtools', '0.121.0'
gem 'serialport', '1.3.2'
# gem 'sinatra', '4.0.0'
gem 'slack-ruby-client', '2.2.0'
gem 'slack-ruby-client', '2.3.0'
gem 'socksify', '1.7.1'
gem 'spreadsheet', '1.3.1'
gem 'sqlite3', '1.7.1'
gem 'sqlite3', '1.7.2'
gem 'thin', '1.8.2'
gem 'tty-prompt', '0.23.1'
gem 'tty-spinner', '0.9.3'
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ $ cd /opt/pwn
$ ./install.sh
$ ./install.sh ruby-gem
$ pwn
pwn[v0.5.6]:001 >>> PWN.help
pwn[v0.5.7]:001 >>> PWN.help
```

[![Installing the pwn Security Automation Framework](https://raw.githubusercontent.com/0dayInc/pwn/master/documentation/pwn_install.png)](https://youtu.be/G7iLUY4FzsI)
Expand All @@ -52,7 +52,7 @@ $ rvm use ruby-3.3.0@pwn
$ gem uninstall --all --executables pwn
$ gem install --verbose pwn
$ pwn
pwn[v0.5.6]:001 >>> PWN.help
pwn[v0.5.7]:001 >>> PWN.help
```

If you're using a multi-user install of RVM do:
Expand All @@ -62,7 +62,7 @@ $ rvm use ruby-3.3.0@pwn
$ rvmsudo gem uninstall --all --executables pwn
$ rvmsudo gem install --verbose pwn
$ pwn
pwn[v0.5.6]:001 >>> PWN.help
pwn[v0.5.7]:001 >>> PWN.help
```

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:
Expand Down
11 changes: 8 additions & 3 deletions lib/pwn/plugins/xxd.rb
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,10 @@ def self.reverse_dump(opts = {})
s3: v[:ascii]
)
end.join
puts hexdump
end

puts hexdump

# Useful for testing which chunk(s)
# trigger malware detection engines
if byte_chunks.to_i.positive?
Expand All @@ -184,7 +185,9 @@ def self.reverse_dump(opts = {})
chunk_file = "#{file}.#{start_chunk_addr}-#{end_chunk_addr}"

binary_data = chunk.map do |line|
line.split[1..8].map do |hex|
hex_line = line.split[1..8]
hex_line = line.split[1..-2] if hex_line.length < 8
hex_line.map do |hex|
[hex].pack('H*')
end.join
end.join
Expand All @@ -193,7 +196,9 @@ def self.reverse_dump(opts = {})
end
else
binary_data = hexdump.lines.map do |line|
line.split[1..8].map do |hex|
hex_line = line.split[1..8]
hex_line = line.split[1..-2] if hex_line.length < 8
hex_line.map do |hex|
[hex].pack('H*')
end.join
end.join
Expand Down
2 changes: 1 addition & 1 deletion lib/pwn/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module PWN
VERSION = '0.5.6'
VERSION = '0.5.7'
end

0 comments on commit 1dc3aca

Please sign in to comment.