pwn 0.5.33 → 0.5.35

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: b53951502ff747ce5dcb1b0dea5ffdfc2c48aaad64af272c1e49091c26a27c23
4
- data.tar.gz: 1f7e8b51e925ffd5df4a7cea3cab15817c2bfebdbf79c538c2408cfe844c98e8
3
+ metadata.gz: 8f41a4c6cbab245a2f57337769fd1ea372c76c23e4a6201f5537ebe7b0490d11
4
+ data.tar.gz: 331cdf2b24514db9a043d86d0694973320fbcebed6b2921e25287ca196c3d9b6
5
5
  SHA512:
6
- metadata.gz: 64602514e14c0e6984499480911de341caeca50804b27e637d9dd15310138bbfc2b2d9861b5a42bcf3e71f792f9119730b54e9ad1e7ff63b665e614c5057b795
7
- data.tar.gz: 12c4215d65ddfc8c607015003fa8fc156157892666e3145034cf61f29c7dc9f3a3fee000d9c7e48bb505b51c5b1e3db053deced00a085d48f80fe359320ec383
6
+ metadata.gz: 7c3c16d7e8e78092772c587dcb25203d33fc56d055f436e11683c255281ff7c26073d1abf1dde98cb4a89c8f9ca244431d0cf7d740af90e05b2324de274b9b2c
7
+ data.tar.gz: 8150d8a01bd4c416a34910e1d52c431362232e1b1f1f22252e60ffbece533ad8809f9e8a4b2b93e607a7ae9c54dd031ab01b38057480c7da3daf07d84062b56b
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.33]:001 >>> PWN.help
40
+ pwn[v0.5.35]: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.33]:001 >>> PWN.help
55
+ pwn[v0.5.35]: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.33]:001 >>> PWN.help
65
+ pwn[v0.5.35]: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:
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'metasm'
4
- require 'tempfile'
5
4
 
6
5
  module PWN
7
6
  module Plugins
@@ -19,38 +18,39 @@ module PWN
19
18
  arch = opts[:arch] ||= PWN::Plugins::DetectOS.arch
20
19
  endian = opts[:endian] ||= :little
21
20
 
22
- pwn_asm_tmp = Tempfile.new('pwn_asm')
23
-
24
21
  raise 'ERROR: opcodes parameter is required.' if opcodes.nil?
25
22
 
26
23
  case arch
27
- when 'amd64', 'i386', 'i686', 'x86', 'x86_64'
28
- arch = 'i386'
24
+ when 'i386', 'i686', 'x86'
25
+ arch_obj = Metasm::Ia32.new(endian)
26
+ when 'amd64', 'x86_64'
27
+ arch_obj = Metasm::X86_64.new(endian)
29
28
  when 'armv4l', 'armv4b', 'armv5l', 'armv5b', 'armv6l', 'armv6b', 'armv7b', 'armv7l', 'arm', 'armhf'
30
- arch = 'arm'
29
+ arch_obj = Metasm::ARM.new(endian)
31
30
  when 'aarch64', 'arm64'
32
- arch = 'aarch64'
31
+ arch_obj = Metasm::ARM64.new(endian)
33
32
  else
34
33
  raise "Unsupported architecture: #{arch}"
35
34
  end
36
35
 
37
- # TOOD: Fix this
38
- # If opcodes appear to be '"90", "90", "90"' then convert to "\x90\x90\x90"
39
- # opcodes = opcodes.split(',').map { |x| format('\x%02x', x.gsub('"', '').to_i(16)) }.join if opcodes.include?('"') && opcodes.include?(',')
40
-
41
- # If opcodes appear to be '90 90 90' then convert to "\x90\x90\x90"
42
- # opcodes = opcodes.split.map { |x| format('\x%02x', x.to_i(16)) }.join if opcodes.include?(' ')
43
-
44
- # If opcodes appear to be '909090' then convert to "\x90\x90\x90"
45
- # opcodes = opcodes.chars.each_slice(2).map(&:join).map { |x| format('\x%02x', x.to_i(16)) }.join if opcodes.length.even?
46
-
47
- File.binwrite(pwn_asm_tmp.path, opcodes)
48
- `objdump -D -b binary -m #{arch} -M intel --endian #{endian} #{pwn_asm_tmp.path}`
36
+ # TOOD: Still needs a fix if opcodes is passed in as:
37
+ # '\x90\x90\x90' (not to be confused w/ "\x90\x90\x90")
38
+ # '909090'
39
+ opcodes_orig_len = opcodes.length
40
+ opcodes = opcodes.map { |code| [code].pack('H*') }.join if opcodes.is_a?(Array)
41
+ opcodes.delete!('\x') if opcodes.include?('\x')
42
+ opcodes.delete!('"') if opcodes.include?('"')
43
+ opcodes.delete!("'") if opcodes.include?("'")
44
+ opcodes.delete!(',') if opcodes.include?(',')
45
+ opcodes.delete!("\s") if opcodes.include?("\s")
46
+
47
+ # puts opcodes.inspect
48
+ opcodes = [opcodes].pack('H*') if opcodes.length.even? && opcodes.length != opcodes_orig_len
49
+ # puts opcodes.inspect
50
+
51
+ Metasm::Shellcode.disassemble(arch_obj, opcodes).to_s
49
52
  rescue StandardError => e
50
53
  raise e
51
- ensure
52
- tmp_file = [pwn_asm_tmp.path]
53
- FileUtils.rm_f(tmp_file) if File.exist?(pwn_asm_tmp.path)
54
54
  end
55
55
 
56
56
  # Supported Method Parameters::
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.5.33'
4
+ VERSION = '0.5.35'
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.5.33
4
+ version: 0.5.35
5
5
  platform: ruby
6
6
  authors:
7
7
  - 0day Inc.