Skip to content

Commit b9cbfa1

Browse files
authored
Merge pull request #516 from ninp0/master
PWN::Plugins::Assembly module - more #bugfixes
2 parents 6f6b8c7 + 24cc69a commit b9cbfa1

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-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.5.21]:001 >>> PWN.help
40+
pwn[v0.5.22]: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.5.21]:001 >>> PWN.help
55+
pwn[v0.5.22]: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.5.21]:001 >>> PWN.help
65+
pwn[v0.5.22]: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/assembly.rb

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,17 @@ module Plugins
88
module Assembly
99
# Supported Method Parameters::
1010
# PWN::Plugins::Assembly.opcodes_to_asm(
11-
# opcodes: 'required - hex escaped opcode(s) (e.g. "\x90\x90\x90")'
11+
# opcodes: 'required - hex escaped opcode(s) (e.g. "\x90\x90\x90")',
12+
# arch: 'optional - objdump -i architecture (defaults to i386)'
1213
# )
1314

1415
public_class_method def self.opcodes_to_asm(opts = {})
1516
opcodes = opts[:opcodes]
17+
arch = opts[:arch] || 'i386'
1618

1719
opcodes_tmp = Tempfile.new('pwn_opcodes')
1820
File.binwrite(opcodes_tmp.path, opcodes)
19-
`objdump -D #{opcodes_tmp.path}`
21+
`objdump --disassemble-all --target binary --architecture #{arch} #{opcodes_tmp.path}`
2022
rescue StandardError => e
2123
raise e
2224
ensure
@@ -39,7 +41,7 @@ module Assembly
3941

4042
asm_tmp_o = "#{asm_tmp.path}.o"
4143
system('as', '-o', asm_tmp_o, asm_tmp.path)
42-
`objdump -D #{asm_tmp.path}.o`
44+
`objdump --disassemble-all #{asm_tmp.path}.o`
4345
rescue StandardError => e
4446
raise e
4547
ensure
@@ -60,7 +62,8 @@ module Assembly
6062
public_class_method def self.help
6163
puts "USAGE:
6264
#{self}.opcodes_to_asm(
63-
opcodes: 'required - hex escaped opcode(s) (e.g. \"\\x90\\x90\\x90\")'
65+
opcodes: 'required - hex escaped opcode(s) (e.g. \"\\x90\\x90\\x90\")',
66+
arch: 'optional - objdump -i architecture (defaults to i386)'
6467
)
6568
6669
#{self}.asm_to_opcodes(

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.5.21'
4+
VERSION = '0.5.22'
55
end

0 commit comments

Comments
 (0)