pwn 0.4.391 → 0.4.396

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.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/bin/pwn +46 -50
  4. data/lib/pwn/version.rb +1 -1
  5. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 20f6117dd5a357f49c9cb2319b43b5189eca333b73a2607d0c05124cc685e4c7
4
- data.tar.gz: e631631795c7b0d4ecc28afb7d544c5b7ad82868a564a6dba4c914a60e477c12
3
+ metadata.gz: 834d5ea1d9ec4022b881d453fa123d55e09c2adacaab3b6852c2f2fa3106b60d
4
+ data.tar.gz: 508478f12b0a2ae83ca041f52d7b636b1c34567b1b8dca13d63ceb7898e2a824
5
5
  SHA512:
6
- metadata.gz: 82d47c1278b2d7dabb9740beb4dec9bbc20b472dcf368d5dca5e3552ad201cc70d0bad0ac4bf36ac196342e3ccf0ee353e63f4250a31bcaab797e6bf4275a4eb
7
- data.tar.gz: a60120db35b707cd6e2678c88c89d702117a4473764708507106e9b42bd41e79090a6b533e977610363fae0e8b943c7f4483fe75492dcfbab70799354512ea9a
6
+ metadata.gz: 3e7c5fde7136dfb271becc97fc15680d42a4ff41bb719f88d4884a623f11f27cf33221707ecaaa85d7d5e0cc945d37115abde30782f05e736f1ad453eea6222d
7
+ data.tar.gz: 4ce2645863b4384a7ab0c1b4fa6c50a61559dfff32623ac03920dff9594429f0ec46320400ada782b23e67e3d0e8b17513badbc1b93985c974f17239e9f2bfc9
data/README.md CHANGED
@@ -37,7 +37,7 @@ $ rvm use ruby-3.1.1@pwn
37
37
  $ rvm list gemsets
38
38
  $ gem install --verbose pwn
39
39
  $ pwn
40
- pwn[v0.4.391]:001 >>> PWN.help
40
+ pwn[v0.4.396]: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.1.1@pwn
52
52
  $ gem uninstall --all --executables pwn
53
53
  $ gem install --verbose pwn
54
54
  $ pwn
55
- pwn[v0.4.391]:001 >>> PWN.help
55
+ pwn[v0.4.396]:001 >>> PWN.help
56
56
  ```
57
57
 
58
58
 
data/bin/pwn CHANGED
@@ -3,12 +3,35 @@
3
3
 
4
4
  require 'pwn'
5
5
  require 'pry'
6
- require 'tty-prompt'
7
- require 'tty-reader'
6
+ # require 'tty-prompt'
7
+ # require 'tty-reader'
8
8
 
9
9
  begin
10
- class LineCount
11
- attr_accessor :total
10
+ def gen_ps1_proc(opts = {})
11
+ delim = opts[:delim]
12
+
13
+ # Custom Main & Wait (Multi-Line) Prompts
14
+ # Bold Red Title
15
+ title = "\001\e[1m\002\001\e[31m\002pwn\001\e[0m\002"
16
+
17
+ # Cyan Version
18
+ version = "\001\e[36m\002v#{PWN::VERSION}\001\e[0m\002"
19
+
20
+ # Green Arrows
21
+ dchars = "\001\e[32m\002>>>\001\e[0m\002"
22
+
23
+ # Yellow Splats
24
+ dchars = "\001\e[33m\002***\001\e[0m\002" if delim == :splat
25
+
26
+ proc do |_target_self, _nest_level, pry|
27
+ pry.config.pwn_repl_line += 1
28
+ line_pad = format(
29
+ '%0.3d',
30
+ pry.config.pwn_repl_line
31
+ )
32
+ line_count = "\001\e[34m\002#{line_pad}\001\e[0m\002" # Blue
33
+ "#{title}[#{version}]:#{line_count} #{dchars} ".to_s.scrub
34
+ end
12
35
  end
13
36
 
14
37
  class Pry
@@ -24,8 +47,6 @@ begin
24
47
  last_line = nil
25
48
  end
26
49
 
27
- # return line if line == last_line
28
-
29
50
  @history << line
30
51
  @history_line_count += 1
31
52
  @saver.call(line) if !should_ignore?(line) &&
@@ -37,65 +58,40 @@ begin
37
58
  end
38
59
  end
39
60
 
40
- prompt = TTY::Prompt.new
41
- reader = TTY::Reader.new
42
-
43
- cli = Pry
44
- cli.config.hooks.add_hook(:before_session, :welcome) do |output, _binding, _pry|
45
- output.puts 'Use the #help method for more options.'
46
- output.puts 'e.g PWN.help'
47
- output.puts 'e.g PWN::Plugins.help'
48
- output.puts 'e.g PWN::Plugins::TransparentBrowser.help'
49
- end
50
-
51
- cli.config.hooks.add_hook(:before_eval, :autocomplete) do |output, _binding, _pry|
52
- reader.on(:keypress) do |key_event|
53
- output.puts "Key: #{key_event.inspect}"
54
- prompt.select('', key_event)
55
- end
56
- end
57
-
58
- cli::Commands.create_command 'toggle-pager' do
61
+ # Define Custom REPL Commands
62
+ Pry::Commands.create_command 'toggle-pager' do
59
63
  description 'Toggle less on returned objects surpassing the terminal.'
60
64
 
61
65
  def process
62
- _pry_.config.pager ? _pry_.config.pager = false : _pry_.config.pager = true
66
+ pi = pry_instance
67
+ pi.config.pager ? pi.config.pager = false : pi.config.pager = true
63
68
  end
64
69
  end
65
70
 
66
- # Custom Main & Wait (Multi-Line) Prompts
67
- title = "\001\e[1m\002\001\e[31m\002pwn\001\e[0m\002" # Bold Red
68
- version = "\001\e[36m\002v#{PWN::VERSION}\001\e[0m\002" # Cyan
69
- @line_count = LineCount.new
70
- @line_count.total = 0
71
- arrow = "\001\e[32m\002>>>\001\e[0m\002" # Green
72
- splat = "\001\e[33m\002***\001\e[0m\002" # Yellow
73
-
74
- # arrow_ps1_proc = proc do |_target_self, _nest_level, _pry|
75
- arrow_ps1_proc = proc do
76
- @line_count.total += 1
77
- line_pad = format('%0.3d', @line_count.total)
78
- line_count = "\001\e[34m\002#{line_pad}\001\e[0m\002" # Blue
79
- "#{title}[#{version}]:#{line_count} #{arrow} ".to_s.scrub
80
- end
81
-
82
- # splat_ps1_proc = proc do |_target_self, _nest_level, _pry|
83
- splat_ps1_proc = proc do
84
- @line_count.total += 1
85
- line_pad = format('%0.3d', @line_count.total)
86
- line_count = "\001\e[34m\002#{line_pad}\001\e[0m\002" # Blue
87
- "#{title}[#{version}]:#{line_count} #{splat} ".to_s.scrub
71
+ # Define REPL Hooks
72
+ Pry.config.hooks.add_hook(:before_session, :welcome) do |output, _binding, _pry|
73
+ output.puts 'Use the #help method for more options.'
74
+ output.puts 'e.g help'
75
+ output.puts 'e.g PWN.help'
76
+ output.puts 'e.g PWN::Plugins.help'
77
+ output.puts 'e.g PWN::Plugins::TransparentBrowser.help'
88
78
  end
89
79
 
80
+ # Define PS1 Prompt
81
+ Pry.config.pwn_repl_line = 0
82
+ arrow_ps1_proc = gen_ps1_proc
83
+ splat_ps1_proc = gen_ps1_proc(delim: :splat)
90
84
  prompt_ps1 = [arrow_ps1_proc, splat_ps1_proc]
91
85
 
92
86
  pwn_prompt = Pry::Prompt.new(
93
87
  :pwn,
94
- 'PWN_PROTOTYPING_DRIVER',
88
+ 'PWN Prototyping REPL',
95
89
  prompt_ps1
96
90
  )
97
91
 
98
- cli.start(
92
+ # Start PWN REPL
93
+ Pry.config.prompt_name = :pwn
94
+ Pry.start(
99
95
  self,
100
96
  prompt: pwn_prompt
101
97
  )
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.391'
4
+ VERSION = '0.4.396'
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.391
4
+ version: 0.4.396
5
5
  platform: ruby
6
6
  authors:
7
7
  - 0day Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-04-01 00:00:00.000000000 Z
11
+ date: 2022-04-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport