pwn 0.4.991 → 0.4.993

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4ecf9fa3d872261c7c0cb2bc084cb9c13186b60bf12eb5fdf87add74575a4b64
4
- data.tar.gz: 4957a0b3ea98c7150134bed70f458fb991af3174902d6b2f8b59aef23b776696
3
+ metadata.gz: 84008b06b85408aed7b64e9ee6ae23d392d7713028b21b7f6f85ddf20433d9fa
4
+ data.tar.gz: 6a7749cb6897c478325ef819039a3790cbc5a126b3da0e907ab8e9ca145737ba
5
5
  SHA512:
6
- metadata.gz: c91e809d196b2fbf524c27c3436d05b0005ae36803b31ebcd5fe88c9f2edebea45c88e24f3b8dc92099fbd8f21cb5818d477a9db9aabad0fc69b2f69d97dad78
7
- data.tar.gz: 6f06c9520d19cb7ab9c5006a21f939bfb279df01e9539c6f62f213a5983fd413eb35ac7c858b1864fcbc0fa33bd807b2c4081059d97700e6192bd03a57e584ef
6
+ metadata.gz: 681a65c0de2438a658cefb719e3d9d009bc295eaf5af5f54e7ef7710994113809b72279549c535dd89efdd621561ec3eb93e0d0d4f941360f4cd20dc1788587a
7
+ data.tar.gz: 802a27fd787dd8745c6e20de8cabcf7f76cae6bd6fea9d2431f9a8ea3b11574016ef03925855c7e6c712c37fbd366aaddd8f70fd513905f4e81fe530096e1e44
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.4.991]:001 >>> PWN.help
40
+ pwn[v0.4.993]: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.4.991]:001 >>> PWN.help
55
+ pwn[v0.4.993]: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.4.991]:001 >>> PWN.help
65
+ pwn[v0.4.993]: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:
@@ -6,11 +6,13 @@ module PWN
6
6
  module XXD
7
7
  # Supported Method Parameters::
8
8
  # PWN::Plugins::XXD.dump(
9
- # file: 'required - path to binary file to dump'
9
+ # file: 'required - path to binary file to dump',
10
+ # hashed: 'optional - return hexdump as hash instead of string (default: false)'
10
11
  # )
11
12
 
12
13
  public_class_method def self.dump(opts = {})
13
14
  file = opts[:file]
15
+ hashed = opts[:hashed] ||= false
14
16
 
15
17
  raise ArgumentError, 'file is required' if file.nil?
16
18
 
@@ -19,24 +21,36 @@ module PWN
19
21
  input = File.binread(file)
20
22
 
21
23
  io = StringIO.new
24
+ hashed_hexdump = {}
22
25
  res = input.bytes.each_slice(2).each_slice(8).with_index do |row, index|
23
- io.write(
24
- format(
25
- "%<s1>07x0: %<s2>-40s %<s3>-16s\n",
26
- s1: index,
27
- s2: row.map { |pair| pair.map { |b| b.to_s(16).rjust(2, '0') }.join }.join(' '),
28
- s3: row.flat_map { |pair| pair.map { |b| (b >= 32 && b < 127 ? b.chr : '.') } }.flatten.join
29
- )
26
+ fmt_row = format(
27
+ "%<s1>07x0: %<s2>-40s %<s3>-16s\n",
28
+ s1: index,
29
+ s2: row.map { |pair| pair.map { |b| b.to_s(16).rjust(2, '0') }.join }.join(' '),
30
+ s3: row.flat_map { |pair| pair.map { |b| (b >= 32 && b < 127 ? b.chr : '.') } }.flatten.join
30
31
  )
32
+
33
+ io.write(fmt_row)
34
+
35
+ if hashed
36
+ hashed_hexdump["#{fmt_row.split.first.delete(':')}"] = {
37
+ hex: fmt_row.split[1..8],
38
+ ascii: fmt_row.split[9..-1].join
39
+ }
40
+ end
31
41
  end
32
42
 
33
- io.string
43
+ if hashed
44
+ return hashed_hexdump
45
+ else
46
+ return io.string
47
+ end
34
48
  rescue StandardError => e
35
49
  raise e
36
50
  end
37
51
 
38
52
  # Supported Method Parameters::
39
- # PWN::Plugins::XXD.dump(
53
+ # PWN::Plugins::XXD.reverse_dump(
40
54
  # hexdump: 'required - hexdump string to reverse dump'
41
55
  # file: 'required - path to binary file to dump'
42
56
  # )
@@ -50,7 +64,10 @@ module PWN
50
64
 
51
65
  # TODO: fix this block as it is not working as expected
52
66
  binary_data = hexdump.lines.map do |line|
53
- line.chars[10..-19].join.split.map do |hex|
67
+ # Works but overly complicated
68
+ # line.chars[10..-19].join.split.map do |hex|
69
+ # More simple better
70
+ line.split[1..8].map do |hex|
54
71
  [hex].pack('H*')
55
72
  end.join
56
73
  end.join
@@ -73,7 +90,8 @@ module PWN
73
90
  public_class_method def self.help
74
91
  puts "USAGE:
75
92
  #{self}.dump(
76
- file: 'required - path to binary file to dump'
93
+ file: 'required - path to binary file to dump',
94
+ hashed: 'optional - return hexdump as hash instead of string (default: false)'
77
95
  )
78
96
 
79
97
  #{self}.reverse_dump(
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.4.991'
4
+ VERSION = '0.4.993'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pwn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.991
4
+ version: 0.4.993
5
5
  platform: ruby
6
6
  authors:
7
7
  - 0day Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-01-24 00:00:00.000000000 Z
11
+ date: 2024-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport