pwn 0.5.22 → 0.5.24
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -0
- data/README.md +3 -3
- data/lib/pwn/plugins/assembly.rb +42 -19
- data/lib/pwn/version.rb +1 -1
- metadata +15 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 833f2055842c7ea2beaaa250cbf13763b540cbdc8ee79e8b8d68a5fc14147adb
|
4
|
+
data.tar.gz: '0586ab2fb44e10f0bad1f597827368f6c9b915159545aed0a5608f125b5eefc1'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3917d7c131039161725cac99d74528a31ecdb15cb28bf9dce318be2330c23ec5363876728fda087f247843d83bf3cc0fec330080c22721631f851039262008ed
|
7
|
+
data.tar.gz: ecfb3ed335b995423363f8c9de534c1bdb4422a9b485465d677e01bcb814c167080356903d0feecefd72b1430428b9f30d798db53f2a1968bd06e78a955b479a
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -37,7 +37,7 @@ $ cd /opt/pwn
|
|
37
37
|
$ ./install.sh
|
38
38
|
$ ./install.sh ruby-gem
|
39
39
|
$ pwn
|
40
|
-
pwn[v0.5.
|
40
|
+
pwn[v0.5.24]: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.3.0@pwn
|
|
52
52
|
$ gem uninstall --all --executables pwn
|
53
53
|
$ gem install --verbose pwn
|
54
54
|
$ pwn
|
55
|
-
pwn[v0.5.
|
55
|
+
pwn[v0.5.24]:001 >>> PWN.help
|
56
56
|
```
|
57
57
|
|
58
58
|
If you're using a multi-user install of RVM do:
|
@@ -62,7 +62,7 @@ $ rvm use ruby-3.3.0@pwn
|
|
62
62
|
$ rvmsudo gem uninstall --all --executables pwn
|
63
63
|
$ rvmsudo gem install --verbose pwn
|
64
64
|
$ pwn
|
65
|
-
pwn[v0.5.
|
65
|
+
pwn[v0.5.24]:001 >>> PWN.help
|
66
66
|
```
|
67
67
|
|
68
68
|
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:
|
data/lib/pwn/plugins/assembly.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'metasm'
|
3
4
|
require 'tempfile'
|
4
5
|
|
5
6
|
module PWN
|
@@ -9,16 +10,29 @@ module PWN
|
|
9
10
|
# Supported Method Parameters::
|
10
11
|
# PWN::Plugins::Assembly.opcodes_to_asm(
|
11
12
|
# opcodes: 'required - hex escaped opcode(s) (e.g. "\x90\x90\x90")',
|
12
|
-
# arch: 'optional - objdump
|
13
|
+
# arch: 'optional - architecture returned from objdump --info (defaults to PWN::Plugins::DetectOS.arch)',
|
14
|
+
# endian: 'optional - endianess (defaults to :little)'
|
13
15
|
# )
|
14
16
|
|
15
17
|
public_class_method def self.opcodes_to_asm(opts = {})
|
16
18
|
opcodes = opts[:opcodes]
|
17
|
-
arch = opts[:arch]
|
19
|
+
arch = opts[:arch] ||= PNW::Plugins::DetectOS.arch
|
20
|
+
endian = opts[:endian] ||= :little
|
18
21
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
+
case arch
|
23
|
+
when 'i386'
|
24
|
+
arch_obj = Metasm::Ia32.new(endian)
|
25
|
+
when 'amd64', 'x86_64'
|
26
|
+
arch_obj = Metasm::X86_64.new(endian)
|
27
|
+
when 'armv71'
|
28
|
+
arch_obj = Metasm::ARM.new(endian)
|
29
|
+
when 'aarch64'
|
30
|
+
arch_obj = Metasm::ARM64.new(endian)
|
31
|
+
else
|
32
|
+
raise "Unsupported architecture: #{arch}"
|
33
|
+
end
|
34
|
+
|
35
|
+
Metasm::Shellcode.disassemble(arch_obj, opcodes).to_s
|
22
36
|
rescue StandardError => e
|
23
37
|
raise e
|
24
38
|
ensure
|
@@ -27,26 +41,32 @@ module PWN
|
|
27
41
|
|
28
42
|
# Supported Method Parameters::
|
29
43
|
# PWN::Plugins::Assembly.asm_to_opcodes(
|
30
|
-
# asm: 'required - assembly instruction(s) (e.g. 'nop\nnop\nnop\njmp rsp\n)'
|
44
|
+
# asm: 'required - assembly instruction(s) (e.g. 'nop\nnop\nnop\njmp rsp\n)',
|
45
|
+
# arch: 'optional - architecture returned from objdump --info (defaults to PWN::Plugins::DetectOS.arch)',
|
46
|
+
# endian: 'optional - endianess (defaults to :little)'
|
31
47
|
# )
|
32
48
|
|
33
49
|
public_class_method def self.asm_to_opcodes(opts = {})
|
34
50
|
asm = opts[:asm]
|
51
|
+
arch = opts[:arch] ||= PNW::Plugins::DetectOS.arch
|
52
|
+
endian = opts[:endian] ||= :little
|
35
53
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
54
|
+
case arch
|
55
|
+
when 'i386'
|
56
|
+
arch_obj = Metasm::Ia32.new(endian)
|
57
|
+
when 'amd64', 'x86_64'
|
58
|
+
arch_obj = Metasm::X86_64.new(endian)
|
59
|
+
when 'armv71'
|
60
|
+
arch_obj = Metasm::ARM.new(endian)
|
61
|
+
when 'aarch64'
|
62
|
+
arch_obj = Metasm::ARM64.new(endian)
|
63
|
+
else
|
64
|
+
raise "Unsupported architecture: #{arch}"
|
65
|
+
end
|
41
66
|
|
42
|
-
|
43
|
-
system('as', '-o', asm_tmp_o, asm_tmp.path)
|
44
|
-
`objdump --disassemble-all #{asm_tmp.path}.o`
|
67
|
+
Metasm::Shellcode.assemble(arch_obj, asm).encode_string
|
45
68
|
rescue StandardError => e
|
46
69
|
raise e
|
47
|
-
ensure
|
48
|
-
files = [asm_tmp.path, asm_tmp_o]
|
49
|
-
FileUtils.rm_f(files) if File.exist?(asm_tmp.path)
|
50
70
|
end
|
51
71
|
|
52
72
|
# Author(s):: 0day Inc. <request.pentest@0dayinc.com>
|
@@ -63,11 +83,14 @@ module PWN
|
|
63
83
|
puts "USAGE:
|
64
84
|
#{self}.opcodes_to_asm(
|
65
85
|
opcodes: 'required - hex escaped opcode(s) (e.g. \"\\x90\\x90\\x90\")',
|
66
|
-
arch: 'optional - objdump
|
86
|
+
arch: 'optional - architecture returned from objdump --info (defaults to PWN::Plugins::DetectOS.arch)',
|
87
|
+
endian: 'optional - endianess (defaults to :little)'
|
67
88
|
)
|
68
89
|
|
69
90
|
#{self}.asm_to_opcodes(
|
70
|
-
asm: 'required - assembly instruction(s) (e.g. '
|
91
|
+
asm: 'required - assembly instruction(s) (e.g. 'nop\nnop\nnop\njmp rsp\n)',
|
92
|
+
arch: 'optional - architecture returned from objdump --info (defaults to PWN::Plugins::DetectOS.arch)',
|
93
|
+
endian: 'optional - endianess (defaults to :little)'
|
71
94
|
)
|
72
95
|
|
73
96
|
#{self}.authors
|
data/lib/pwn/version.rb
CHANGED
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.5.
|
4
|
+
version: 0.5.24
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- 0day Inc.
|
@@ -458,6 +458,20 @@ dependencies:
|
|
458
458
|
- - '='
|
459
459
|
- !ruby/object:Gem::Version
|
460
460
|
version: 2.8.1
|
461
|
+
- !ruby/object:Gem::Dependency
|
462
|
+
name: metasm
|
463
|
+
requirement: !ruby/object:Gem::Requirement
|
464
|
+
requirements:
|
465
|
+
- - '='
|
466
|
+
- !ruby/object:Gem::Version
|
467
|
+
version: 1.0.5
|
468
|
+
type: :runtime
|
469
|
+
prerelease: false
|
470
|
+
version_requirements: !ruby/object:Gem::Requirement
|
471
|
+
requirements:
|
472
|
+
- - '='
|
473
|
+
- !ruby/object:Gem::Version
|
474
|
+
version: 1.0.5
|
461
475
|
- !ruby/object:Gem::Dependency
|
462
476
|
name: msfrpc-client
|
463
477
|
requirement: !ruby/object:Gem::Requirement
|