pwn 0.5.167 → 0.5.169
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/Gemfile +3 -2
- data/README.md +5 -5
- data/lib/pwn/aws/iam.rb +108 -0
- data/lib/pwn/version.rb +1 -1
- metadata +20 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b468f7a2bd8f09b41999bbb23f1d8d52c31aaf9c9b3ff447b80da50d571b2e21
|
4
|
+
data.tar.gz: 48a4f7139d1109d9d51205b3668d6892ee1260241b903cd8485ffc31e282f9fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 718b412bf8236237894a8cab1345f023655bc2fd3c0f7f00e1f818868b4f8cb3c93f56981f3ccea8876f9b772310617468c5b40cbd3a7980532aa23fae0f6cc6
|
7
|
+
data.tar.gz: fb11ec3c92ab4e9e4f0c4744de3d188d85a3554a3e19441d58b50fbd2c53706b82ea9f515e9e61a9c8b4042fa537948b901a2842128c4f97ad3c4f41bed21057
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.3.
|
1
|
+
3.3.3
|
data/Gemfile
CHANGED
@@ -17,6 +17,7 @@ gem 'authy', '3.0.1'
|
|
17
17
|
gem 'aws-sdk', '3.2.0'
|
18
18
|
# gem 'bettercap', '1.6.2'
|
19
19
|
gem 'barby', '0.6.9'
|
20
|
+
gem 'base32', '0.3.4'
|
20
21
|
gem 'brakeman', '6.1.2'
|
21
22
|
gem 'bson', '5.0.0'
|
22
23
|
gem 'bundler', '>=2.5.11'
|
@@ -46,7 +47,7 @@ gem 'jwt', '2.8.1'
|
|
46
47
|
gem 'libusb', '0.7.1'
|
47
48
|
gem 'luhn', '1.0.2'
|
48
49
|
gem 'mail', '2.8.1'
|
49
|
-
gem 'meshtastic', '0.0.
|
50
|
+
gem 'meshtastic', '0.0.70'
|
50
51
|
gem 'metasm', '1.0.5'
|
51
52
|
gem 'mongo', '2.20.0'
|
52
53
|
gem 'msfrpc-client', '1.1.2'
|
@@ -78,7 +79,7 @@ gem 'rspec', '3.13.0'
|
|
78
79
|
gem 'rtesseract', '3.1.3'
|
79
80
|
gem 'rubocop', '1.64.1'
|
80
81
|
gem 'rubocop-rake', '0.6.0'
|
81
|
-
gem 'rubocop-rspec', '
|
82
|
+
gem 'rubocop-rspec', '3.0.1'
|
82
83
|
gem 'ruby-audio', '1.6.1'
|
83
84
|
gem 'ruby-nmap', '1.0.3'
|
84
85
|
gem 'ruby-saml', '1.16.0'
|
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.169]: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)
|
@@ -48,21 +48,21 @@ pwn[v0.5.167]:001 >>> PWN.help
|
|
48
48
|
It's wise to update pwn often as numerous versions are released/week:
|
49
49
|
```
|
50
50
|
$ rvm list gemsets
|
51
|
-
$ rvm use ruby-3.3.
|
51
|
+
$ rvm use ruby-3.3.3@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.169]:001 >>> PWN.help
|
56
56
|
```
|
57
57
|
|
58
58
|
If you're using a multi-user install of RVM do:
|
59
59
|
```
|
60
60
|
$ rvm list gemsets
|
61
|
-
$ rvm use ruby-3.3.
|
61
|
+
$ rvm use ruby-3.3.3@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.169]: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/lib/pwn/aws/iam.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'aws-sdk'
|
4
|
+
require 'base32'
|
5
|
+
require 'base64'
|
4
6
|
|
5
7
|
module PWN
|
6
8
|
module AWS
|
@@ -44,6 +46,107 @@ module PWN
|
|
44
46
|
raise e
|
45
47
|
end
|
46
48
|
|
49
|
+
# Supported Method Parameters::
|
50
|
+
# PWN::AWS::IAM.decode_key(
|
51
|
+
# key: 'required - key to decode',
|
52
|
+
# key_type: 'optional - key type :access_key_id|:secret_access_key|:sts_session_token (Default: access_key_id)',
|
53
|
+
# )
|
54
|
+
public_class_method def self.decode_key(opts = {})
|
55
|
+
key = opts[:key].to_s.scrub.chomp.strip.upcase
|
56
|
+
raise 'ERROR: Key is required' if key == ''
|
57
|
+
|
58
|
+
key_type = opts[:key_type] || :access_key_id
|
59
|
+
key_type = key_type.to_s.scrub.chomp.strip.to_sym
|
60
|
+
|
61
|
+
decoded_key = {}
|
62
|
+
|
63
|
+
prefix = key[0..3].to_s.downcase.to_sym
|
64
|
+
case prefix
|
65
|
+
when :abia
|
66
|
+
resource_type = 'AWS STS Service Bearer Token'
|
67
|
+
decoded_key[:prefix] = prefix
|
68
|
+
when :acca
|
69
|
+
resource_type = 'Context Specific Credential'
|
70
|
+
decoded_key[:prefix] = prefix
|
71
|
+
when :agpa
|
72
|
+
resource_type = 'Group'
|
73
|
+
decoded_key[:prefix] = prefix
|
74
|
+
when :aida
|
75
|
+
resource_type = 'IAM User'
|
76
|
+
decoded_key[:prefix] = prefix
|
77
|
+
when :aipa
|
78
|
+
resource_type = 'EC2 Instance Profile'
|
79
|
+
decoded_key[:prefix] = prefix
|
80
|
+
when :akia
|
81
|
+
resource_type = 'Access Key'
|
82
|
+
decoded_key[:prefix] = prefix
|
83
|
+
when :anpa
|
84
|
+
resource_type = 'Managed Policy'
|
85
|
+
decoded_key[:prefix] = prefix
|
86
|
+
when :anva
|
87
|
+
resource_type = 'Version in a Managed Policy'
|
88
|
+
decoded_key[:prefix] = prefix
|
89
|
+
when :apka
|
90
|
+
resource_type = 'Public Key'
|
91
|
+
decoded_key[:prefix] = prefix
|
92
|
+
when :aroa
|
93
|
+
resource_type = 'Role'
|
94
|
+
decoded_key[:prefix] = prefix
|
95
|
+
when :asca
|
96
|
+
resource_type = 'Certificate'
|
97
|
+
decoded_key[:prefix] = prefix
|
98
|
+
when :asia
|
99
|
+
resource_type = 'Temporary (AWS STS) Keys'
|
100
|
+
decoded_key[:prefix] = prefix
|
101
|
+
else
|
102
|
+
resource_type = 'Secret Access Key' if key_type == :secret_access_key
|
103
|
+
resource_type = 'STS Session' if key_type == :sts_session_token
|
104
|
+
end
|
105
|
+
|
106
|
+
decoded_key[:resource_type] = resource_type
|
107
|
+
|
108
|
+
case key_type
|
109
|
+
when :access_key_id
|
110
|
+
suffix = key[4..-1]
|
111
|
+
decoded_suffix = Base32.decode(suffix)
|
112
|
+
trimmed_decoded_suffix = decoded_suffix[0..5]
|
113
|
+
z = trimmed_decoded_suffix.bytes.inject { |total, byte| (total << 8) + byte }
|
114
|
+
mask = 0x7FFFFFFFFF80
|
115
|
+
key = (z & mask) >> 7
|
116
|
+
decoded_key[:account_id] = key
|
117
|
+
when :secret_access_key, :sts_session_token
|
118
|
+
decoded_key[:decoded_key] = Base64.strict_decode64(key)
|
119
|
+
else
|
120
|
+
raise "ERROR: Invalid Key Type: #{key_type}. Valid key types are :access_key_id|:secret_access_key|:sts_session_token"
|
121
|
+
end
|
122
|
+
decoded_key[:key_type] = key_type
|
123
|
+
|
124
|
+
decoded_key
|
125
|
+
rescue StandardError => e
|
126
|
+
raise e
|
127
|
+
end
|
128
|
+
|
129
|
+
# TODO: Implement this method
|
130
|
+
# Supported Method Parameters::
|
131
|
+
# PWN::AWS::IAM.generate_access_key(
|
132
|
+
# account_id: 'required - AWS Account ID',
|
133
|
+
# prefix: 'optional - prefix for the key :abia|:acca|:agpa|:aida|:aipa|:akia|:anpa|:anva|:apka|:aroa|:asca|:asia (Default: akia)'
|
134
|
+
# )
|
135
|
+
# public_class_method def self.generate_access_key(opts = {})
|
136
|
+
# account_id = opts[:account_id].to_i
|
137
|
+
# raise 'ERROR: Account ID is required and must be an Integer' unless account_id.positive?
|
138
|
+
|
139
|
+
# prefix = opts[:prefix] ||= :akia
|
140
|
+
# prefix_str = prefix.to_s.scrub.chomp.strip.upcase
|
141
|
+
|
142
|
+
# mask = 0x7FFFFFFFFF80
|
143
|
+
# key = (account_id & mask) << 7
|
144
|
+
|
145
|
+
# "#{prefix_str}#{encoded_key}"
|
146
|
+
# rescue StandardError => e
|
147
|
+
# raise e
|
148
|
+
# end
|
149
|
+
|
47
150
|
# Supported Method Parameters::
|
48
151
|
# PWN::AWS::IAM.disconnect(
|
49
152
|
# iam_obj: 'required - iam_obj returned from #connect method'
|
@@ -80,6 +183,11 @@ module PWN
|
|
80
183
|
)
|
81
184
|
puts iam_obj.public_methods
|
82
185
|
|
186
|
+
decoded_key = #{self}.decode_key(
|
187
|
+
key: 'required - key to decode',
|
188
|
+
key_type: 'optional - key type :access_key_id|:secret_access_key|:sts_session_token (Default: access_key_id
|
189
|
+
)
|
190
|
+
|
83
191
|
#{self}.disconnect(
|
84
192
|
iam_obj: 'required - iam_obj returned from #connect method'
|
85
193
|
)
|
data/lib/pwn/version.rb
CHANGED
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.5.
|
4
|
+
version: 0.5.169
|
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-06-
|
11
|
+
date: 2024-06-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - '='
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: 0.6.9
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: base32
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.3.4
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.3.4
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: brakeman
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -478,14 +492,14 @@ dependencies:
|
|
478
492
|
requirements:
|
479
493
|
- - '='
|
480
494
|
- !ruby/object:Gem::Version
|
481
|
-
version: 0.0.
|
495
|
+
version: 0.0.70
|
482
496
|
type: :runtime
|
483
497
|
prerelease: false
|
484
498
|
version_requirements: !ruby/object:Gem::Requirement
|
485
499
|
requirements:
|
486
500
|
- - '='
|
487
501
|
- !ruby/object:Gem::Version
|
488
|
-
version: 0.0.
|
502
|
+
version: 0.0.70
|
489
503
|
- !ruby/object:Gem::Dependency
|
490
504
|
name: metasm
|
491
505
|
requirement: !ruby/object:Gem::Requirement
|
@@ -926,14 +940,14 @@ dependencies:
|
|
926
940
|
requirements:
|
927
941
|
- - '='
|
928
942
|
- !ruby/object:Gem::Version
|
929
|
-
version:
|
943
|
+
version: 3.0.1
|
930
944
|
type: :runtime
|
931
945
|
prerelease: false
|
932
946
|
version_requirements: !ruby/object:Gem::Requirement
|
933
947
|
requirements:
|
934
948
|
- - '='
|
935
949
|
- !ruby/object:Gem::Version
|
936
|
-
version:
|
950
|
+
version: 3.0.1
|
937
951
|
- !ruby/object:Gem::Dependency
|
938
952
|
name: ruby-audio
|
939
953
|
requirement: !ruby/object:Gem::Requirement
|