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 +4 -4
- data/README.md +3 -3
- data/etc/pwn.yaml.EXAMPLE +7 -0
- data/lib/pwn/blockchain/btc.rb +28 -12
- data/lib/pwn/config.rb +8 -0
- data/lib/pwn/plugins/authentication_helper.rb +15 -8
- data/lib/pwn/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a44431b941955353c7b0926e584ee754f3ef4cf02a22590dddf0613e4436545e
|
4
|
+
data.tar.gz: d7f6286a33c71a051ac1f06e688c4e81974e0dbac83fca90834945df08e1de6a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
40
|
+
pwn[v0.5.446]:001 >>> PWN.help
|
41
41
|
```
|
42
42
|
|
43
43
|
[](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.
|
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.
|
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
data/lib/pwn/blockchain/btc.rb
CHANGED
@@ -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
|
-
|
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
|
-
|
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
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
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
|
-
|
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]
|
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]
|
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