pwn 0.5.445 → 0.5.446

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: 86b71d678fe4babb731b7891b3c1760cd7ca8ee9ce980d19e433c6ba83c6390f
4
- data.tar.gz: 6d47cc4ba4ae9455b4248c7a93baf85eb118b83070a1a3619335a4874d898aef
3
+ metadata.gz: a44431b941955353c7b0926e584ee754f3ef4cf02a22590dddf0613e4436545e
4
+ data.tar.gz: d7f6286a33c71a051ac1f06e688c4e81974e0dbac83fca90834945df08e1de6a
5
5
  SHA512:
6
- metadata.gz: b379c7ab9c67cda3c5462c5418c1c558f14ead952a93cfb334c00e4ee17bab539a71d4664fa4cd6088c4faf076cad9a400d8d7bcaf072a102a0d1d4bb8cfb97f
7
- data.tar.gz: 8b4a0333e4f6cb99c0364baa97183ba56b523d550d49007757c99d422d60054bcdab9fdd6da83fad65088cd701d8ba1d2f4e3889a47bb2f2d4d7fac253792df7
6
+ metadata.gz: d7b633237440b907fa46d66526d80b403c5e30649aa8411d5e39d1dcabe24f7fe5db4010c120994daef10b5ff6ae61c28865d9327bfd27c29d2987add8bf6b07
7
+ data.tar.gz: 01f0763257fd3e7f8404d0d5d2eadb08b5a50c5eb539f8d2eed70fe104b2f54c6cca65c46c2da2a55152a5c6fed5ca2acfc7a497b55c1d9eaa02e412495bb039
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.445]:001 >>> PWN.help
40
+ pwn[v0.5.446]: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.4.4@pwn
52
52
  $ gem uninstall --all --executables pwn
53
53
  $ gem install --verbose pwn
54
54
  $ pwn
55
- pwn[v0.5.445]:001 >>> PWN.help
55
+ pwn[v0.5.446]: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.4.4@pwn
62
62
  $ rvmsudo gem uninstall --all --executables pwn
63
63
  $ rvmsudo gem install --verbose pwn
64
64
  $ pwn
65
- pwn[v0.5.445]:001 >>> PWN.help
65
+ pwn[v0.5.446]: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/etc/pwn.yaml.EXAMPLE CHANGED
@@ -34,6 +34,13 @@ asm:
34
34
  arch: 'x86_64'
35
35
  endian: 'little'
36
36
 
37
+ blockchain:
38
+ bitcoin:
39
+ rpc_host: '127.0.0.1'
40
+ rpc_port: 8332
41
+ rpc_user: 'bitcoin rpc user'
42
+ rpc_pass: 'bitcoin rpc password'
43
+
37
44
  irc:
38
45
  ui_nick: '_human_'
39
46
  shared_chan: '#pwn'
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'bitcoin'
4
+ require 'base64'
3
5
  require 'json'
4
6
  require 'rest-client'
5
7
  require 'tty-spinner'
@@ -25,10 +27,20 @@ module PWN
25
27
  opts[:http_method].to_s.scrub.to_sym
26
28
  end
27
29
 
28
- base_uri = 'https://api.blockcypher.com/v1/btc/'
30
+ rpc_host = PWN::Env[:blockchain][:bitcoin][:rpc_host] ||= '127.0.0.1'
31
+ rpc_port = PWN::Env[:blockchain][:bitcoin][:rpc_port] ||= '8332'
32
+ base_uri = "http://#{rpc_host}:#{rpc_port}"
29
33
  rest_call = opts[:rest_call].to_s.scrub
30
34
  params = opts[:params]
31
- headers = { content_type: 'application/json; charset=UTF-8' }
35
+ rpc_user = PWN::Env[:blockchain][:bitcoin][:rpc_user] ||= PWN::Plugins::AuthenticationHelper.username(prompt: 'Bitcoin Node RPC Username')
36
+ rpc_pass = PWN::Env[:blockchain][:bitcoin][:rpc_pass] ||= PWN::Plugins::AuthenticationHelper.mask_password(prompt: 'Bitcoin Node RPC Password')
37
+
38
+ basic_auth = Base64.strict_encode64("#{rpc_user}:#{rpc_pass}")
39
+
40
+ headers = {
41
+ content_type: 'application/json; charset=UTF-8',
42
+ authorization: "Basic #{basic_auth}"
43
+ }
32
44
 
33
45
  http_body = opts[:http_body]
34
46
  http_body ||= {}
@@ -100,16 +112,20 @@ module PWN
100
112
  end
101
113
 
102
114
  # Supported Method Parameters::
103
- # latest_block = PWN::Blockchain::BTC.get_latest_block(
104
- # token: 'optional - API token for higher rate limits'
105
- # )
106
-
107
- public_class_method def self.get_latest_block(opts = {})
108
- params = {}
109
- params[:token] = opts[:token] if opts[:token]
110
-
111
- rest_call = 'main'
112
- response = btc_rest_call(rest_call: rest_call, params: params)
115
+ # latest_block = PWN::Blockchain::BTC.get_latest_block
116
+
117
+ public_class_method def self.get_latest_block
118
+ http_body = {
119
+ jsonrpc: '1.0',
120
+ id: self,
121
+ method: 'getblockchaininfo',
122
+ params: []
123
+ }
124
+
125
+ response = btc_rest_call(
126
+ http_method: :post,
127
+ http_body: http_body
128
+ )
113
129
 
114
130
  JSON.parse(response.body, symbolize_names: true)
115
131
  rescue StandardError => e
data/lib/pwn/config.rb CHANGED
@@ -51,6 +51,14 @@ module PWN
51
51
  }
52
52
  },
53
53
  asm: { arch: PWN::Plugins::DetectOS.arch, endian: PWN::Plugins::DetectOS.endian },
54
+ blockchain: {
55
+ bitcoin: {
56
+ rpc_host: 'localhost',
57
+ rpc_port: 8332,
58
+ rpc_user: 'bitcoin RPC Username',
59
+ rpc_pass: 'bitcoin RPC Password'
60
+ }
61
+ },
54
62
  irc: {
55
63
  ui_nick: '_human_',
56
64
  shared_chan: '#pwn',
@@ -10,10 +10,13 @@ module PWN
10
10
  # of other SP plugins/modules.
11
11
  module AuthenticationHelper
12
12
  # Supported Method Parameters::
13
- # PWN::Plugins::AuthenticationHelper.username
13
+ # PWN::Plugins::AuthenticationHelper.username(
14
+ # prompt: 'optional - string to display at prompt (Default: Username)'
15
+ # )
14
16
 
15
17
  public_class_method def self.username
16
- user = TTY::Prompt.new.ask('Username: ')
18
+ prompt = opts[:prompt] ||= 'Username'
19
+ user = TTY::Prompt.new.ask("#{prompt}: ")
17
20
  user.to_s.strip.chomp.scrub
18
21
  rescue StandardError => e
19
22
  raise e
@@ -21,11 +24,11 @@ module PWN
21
24
 
22
25
  # Supported Method Parameters::
23
26
  # PWN::Plugins::AuthenticationHelper.mask_password(
24
- # prompt: 'optional - string to display at prompt'
27
+ # prompt: 'optional - string to display at prompt (Default: Password)'
25
28
  # )
26
29
 
27
30
  public_class_method def self.mask_password(opts = {})
28
- opts[:prompt].nil? ? prompt = 'Password' : prompt = opts[:prompt].to_s.scrub.strip.chomp
31
+ prompt = opts[:prompt] ||= 'Password'
29
32
 
30
33
  pass = TTY::Prompt.new.mask("#{prompt}: ")
31
34
  pass.to_s.strip.chomp.scrub
@@ -37,11 +40,11 @@ module PWN
37
40
 
38
41
  # Supported Method Parameters::
39
42
  # PWN::Plugins::AuthenticationHelper.mfa(
40
- # prompt: 'optional - string to display at prompt'
43
+ # prompt: 'optional - string to display at prompt (Default: MFA Token)'
41
44
  # )
42
45
 
43
46
  public_class_method def self.mfa(opts = {})
44
- opts[:prompt].nil? ? prompt = 'MFA Token' : prompt = opts[:prompt].to_s.scrub.strip.chomp
47
+ prompt = opts[:prompt] ||= 'MFA Token'
45
48
 
46
49
  mfa = TTY::Prompt.new.ask("#{prompt}: ")
47
50
  mfa.to_s.strip.chomp.scrub
@@ -63,9 +66,13 @@ module PWN
63
66
 
64
67
  public_class_method def self.help
65
68
  puts "USAGE:
66
- #{self}.username
69
+ #{self}.username(
70
+ prompt: 'optional - string to display at prompt'
71
+ )
67
72
 
68
- #{self}.mask_password
73
+ #{self}.mask_password(
74
+ prompt: 'optional - string to display at prompt'
75
+ )
69
76
 
70
77
  #{self}.mfa(
71
78
  prompt: 'optional - string to display at prompt'
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.445'
4
+ VERSION = '0.5.446'
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.445
4
+ version: 0.5.446
5
5
  platform: ruby
6
6
  authors:
7
7
  - 0day Inc.