rex-registry 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/CODE_OF_CONDUCT.md +52 -0
- data/Gemfile +4 -0
- data/LICENSE +27 -0
- data/README.md +32 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/rex/registry.rb +15 -0
- data/lib/rex/registry/hive.rb +132 -0
- data/lib/rex/registry/lfkey.rb +51 -0
- data/lib/rex/registry/nodekey.rb +54 -0
- data/lib/rex/registry/regf.rb +25 -0
- data/lib/rex/registry/valuekey.rb +67 -0
- data/lib/rex/registry/valuelist.rb +29 -0
- data/lib/rex/registry/version.rb +5 -0
- data/rex-registry.gemspec +24 -0
- metadata +182 -0
- metadata.gz.sig +3 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 79338f2ec22a25636d9d6daa2c6aa31b5996e470
|
4
|
+
data.tar.gz: 10160e3acb8da820ec128793716a95f7c790e696
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0d4f817ac5563bbb17aa6f143f4217ad6a4216dd9972f2c43c2997af9439141cabfbe42324b2638de1372b1ea4f69a4be920a6b29b550d53b247d07f2809d2d5
|
7
|
+
data.tar.gz: b8e8b04d3d3d93f1767275daaaabd466bcdb82b6ba8b425f7458aef94a3fff739800c3a5ffb3c2655348901b894539d996b982369f1b165e5277888225fe3b2d
|
checksums.yaml.gz.sig
ADDED
Binary file
|
data.tar.gz.sig
ADDED
Binary file
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, and in the interest of
|
4
|
+
fostering an open and welcoming community, we pledge to respect all people who
|
5
|
+
contribute through reporting issues, posting feature requests, updating
|
6
|
+
documentation, submitting pull requests or patches, and other activities.
|
7
|
+
|
8
|
+
We are committed to making participation in this project a harassment-free
|
9
|
+
experience for everyone, regardless of level of experience, gender, gender
|
10
|
+
identity and expression, sexual orientation, disability, personal appearance,
|
11
|
+
body size, race, ethnicity, age, religion, or nationality.
|
12
|
+
|
13
|
+
Examples of unacceptable behavior by participants include:
|
14
|
+
|
15
|
+
* The use of sexualized language or imagery
|
16
|
+
* Personal attacks
|
17
|
+
* Trolling or insulting/derogatory comments
|
18
|
+
* Public or private harassment
|
19
|
+
* Publishing other's private information, such as physical or electronic
|
20
|
+
addresses, without explicit permission
|
21
|
+
* Other unethical or unprofessional conduct
|
22
|
+
|
23
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
24
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
25
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
26
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
27
|
+
threatening, offensive, or harmful.
|
28
|
+
|
29
|
+
By adopting this Code of Conduct, project maintainers commit themselves to
|
30
|
+
fairly and consistently applying these principles to every aspect of managing
|
31
|
+
this project. Project maintainers who do not follow or enforce the Code of
|
32
|
+
Conduct may be permanently removed from the project team.
|
33
|
+
|
34
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
35
|
+
when an individual is representing the project or its community.
|
36
|
+
|
37
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
38
|
+
reported by contacting the project maintainers at msfdev@metasploit.com. If
|
39
|
+
the incident involves a committer, you may report directly to
|
40
|
+
egypt@metasploit.com or todb@metasploit.com.
|
41
|
+
|
42
|
+
All complaints will be reviewed and investigated and will result in a
|
43
|
+
response that is deemed necessary and appropriate to the circumstances.
|
44
|
+
Maintainers are obligated to maintain confidentiality with regard to the
|
45
|
+
reporter of an incident.
|
46
|
+
|
47
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
48
|
+
version 1.3.0, available at
|
49
|
+
[http://contributor-covenant.org/version/1/3/0/][version]
|
50
|
+
|
51
|
+
[homepage]: http://contributor-covenant.org
|
52
|
+
[version]: http://contributor-covenant.org/version/1/3/0/
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
Copyright (C) 2012-2013, Rapid7, Inc.
|
2
|
+
All rights reserved.
|
3
|
+
|
4
|
+
Redistribution and use in source and binary forms, with or without modification,
|
5
|
+
are permitted provided that the following conditions are met:
|
6
|
+
|
7
|
+
* Redistributions of source code must retain the above copyright notice,
|
8
|
+
this list of conditions and the following disclaimer.
|
9
|
+
|
10
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
11
|
+
this list of conditions and the following disclaimer in the documentation
|
12
|
+
and/or other materials provided with the distribution.
|
13
|
+
|
14
|
+
* Neither the name of Rapid7 LLC nor the names of its contributors
|
15
|
+
may be used to endorse or promote products derived from this software
|
16
|
+
without specific prior written permission.
|
17
|
+
|
18
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
19
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
20
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
21
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
22
|
+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
23
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
24
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
25
|
+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
26
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
27
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/README.md
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# Rex::Registry
|
2
|
+
|
3
|
+
Ruby Exploitation(rex) Library for parsing offline copys of Windows Registry Hives. Ported over from Brandon Perry's original code inside Metasploit Framework.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'rex-registry'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install rex-registry
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
## Development
|
24
|
+
|
25
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
26
|
+
|
27
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
28
|
+
|
29
|
+
## Contributing
|
30
|
+
|
31
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/rapid7/rex-registry. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
32
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "rex/registry"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/lib/rex/registry.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# -*- coding: binary -*-
|
2
|
+
require "rex/registry/version"
|
3
|
+
require 'rex/registry/hive'
|
4
|
+
require 'rex/registry/regf'
|
5
|
+
require 'rex/registry/nodekey'
|
6
|
+
require 'rex/registry/lfkey'
|
7
|
+
require 'rex/registry/valuekey'
|
8
|
+
require 'rex/registry/valuelist'
|
9
|
+
|
10
|
+
module Rex
|
11
|
+
module Registry
|
12
|
+
|
13
|
+
attr_accessor :alias
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,132 @@
|
|
1
|
+
# -*- coding: binary -*-
|
2
|
+
require_relative "regf"
|
3
|
+
require_relative "nodekey"
|
4
|
+
|
5
|
+
module Rex
|
6
|
+
module Registry
|
7
|
+
|
8
|
+
class Hive
|
9
|
+
attr_accessor :root_key, :hive_regf, :hive_name
|
10
|
+
|
11
|
+
def initialize(hivepath)
|
12
|
+
|
13
|
+
hive_blob = open(hivepath, "rb") { |io| io.read }
|
14
|
+
|
15
|
+
@hive_regf = RegfBlock.new(hive_blob)
|
16
|
+
return nil if !@hive_regf.root_key_offset
|
17
|
+
|
18
|
+
@root_key = NodeKey.new(hive_blob, 0x1000 + @hive_regf.root_key_offset)
|
19
|
+
return nil if !@root_key.lf_record
|
20
|
+
|
21
|
+
keys = []
|
22
|
+
root_key.lf_record.children.each do |key|
|
23
|
+
keys << key.name
|
24
|
+
end
|
25
|
+
|
26
|
+
if keys.include? "LastKnownGoodRecovery"
|
27
|
+
@hive_name = "SYSTEM"
|
28
|
+
elsif keys.include? "Microsoft"
|
29
|
+
@hive_name = "SOFTWARE"
|
30
|
+
elsif keys.include? "Environment"
|
31
|
+
@hive_name = "NTUSER.DAT"
|
32
|
+
elsif keys.include? "SAM"
|
33
|
+
@hive_name = "SAM"
|
34
|
+
elsif keys.include? "Policy"
|
35
|
+
@hive_name = "SECURITY"
|
36
|
+
else
|
37
|
+
@hive_name = "UNKNOWN"
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
|
42
|
+
def relative_query(path)
|
43
|
+
|
44
|
+
if path == "" || path == "\\"
|
45
|
+
return @root_key
|
46
|
+
end
|
47
|
+
|
48
|
+
current_child = nil
|
49
|
+
paths = path.split("\\")
|
50
|
+
|
51
|
+
return if !@root_key.lf_record
|
52
|
+
|
53
|
+
@root_key.lf_record.children.each do |child|
|
54
|
+
next if child.name.downcase != paths[1].downcase
|
55
|
+
|
56
|
+
current_child = child
|
57
|
+
|
58
|
+
if paths.length == 2
|
59
|
+
current_child.full_path = path
|
60
|
+
return current_child
|
61
|
+
end
|
62
|
+
|
63
|
+
2.upto(paths.length) do |i|
|
64
|
+
|
65
|
+
if i == paths.length
|
66
|
+
current_child.full_path = path
|
67
|
+
return current_child
|
68
|
+
else
|
69
|
+
if current_child.lf_record && current_child.lf_record.children
|
70
|
+
current_child.lf_record.children.each do |c|
|
71
|
+
next if c.name.downcase != paths[i].downcase
|
72
|
+
|
73
|
+
current_child = c
|
74
|
+
|
75
|
+
break
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
return if !current_child
|
83
|
+
|
84
|
+
current_child.full_path = path
|
85
|
+
return current_child
|
86
|
+
end
|
87
|
+
|
88
|
+
def value_query(path)
|
89
|
+
if path == "" || path == "\\"
|
90
|
+
return nil
|
91
|
+
end
|
92
|
+
|
93
|
+
paths = path.split("\\")
|
94
|
+
|
95
|
+
return if !@root_key.lf_record
|
96
|
+
|
97
|
+
@root_key.lf_record.children.each do |root_child|
|
98
|
+
next if root_child.name.downcase != paths[1].downcase
|
99
|
+
|
100
|
+
current_child = root_child
|
101
|
+
|
102
|
+
if paths.length == 2
|
103
|
+
return nil
|
104
|
+
end
|
105
|
+
|
106
|
+
2.upto(paths.length - 1) do |i|
|
107
|
+
next if !current_child.lf_record
|
108
|
+
|
109
|
+
current_child.lf_record.children.each do |c|
|
110
|
+
next if c.name != paths[i]
|
111
|
+
current_child = c
|
112
|
+
|
113
|
+
break
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
if !current_child.value_list || current_child.value_list.values.length == 0
|
118
|
+
return nil
|
119
|
+
end
|
120
|
+
|
121
|
+
current_child.value_list.values.each do |value|
|
122
|
+
next if value.name.downcase != paths[paths.length - 1].downcase
|
123
|
+
|
124
|
+
value.full_path = path
|
125
|
+
return value
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
end
|
132
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# -*- coding: binary -*-
|
2
|
+
require_relative "nodekey"
|
3
|
+
|
4
|
+
module Rex
|
5
|
+
module Registry
|
6
|
+
|
7
|
+
class LFBlock
|
8
|
+
|
9
|
+
attr_accessor :number_of_keys, :hash_records, :children
|
10
|
+
|
11
|
+
def initialize(hive_blob, offset)
|
12
|
+
offset = offset + 4
|
13
|
+
lf_header = hive_blob[offset, 2]
|
14
|
+
|
15
|
+
if lf_header !~ /lf/ && lf_header !~ /lh/
|
16
|
+
return
|
17
|
+
end
|
18
|
+
|
19
|
+
@number_of_keys = hive_blob[offset + 0x02, 2].unpack('C').first
|
20
|
+
|
21
|
+
@hash_records = []
|
22
|
+
@children = []
|
23
|
+
|
24
|
+
hash_offset = offset + 0x04
|
25
|
+
|
26
|
+
1.upto(@number_of_keys) do |h|
|
27
|
+
|
28
|
+
hash = LFHashRecord.new(hive_blob, hash_offset)
|
29
|
+
|
30
|
+
@hash_records << hash
|
31
|
+
|
32
|
+
hash_offset = hash_offset + 0x08
|
33
|
+
|
34
|
+
@children << NodeKey.new(hive_blob, hash.nodekey_offset + 0x1000)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
class LFHashRecord
|
40
|
+
|
41
|
+
attr_accessor :nodekey_offset, :nodekey_name_verification
|
42
|
+
|
43
|
+
def initialize(hive_blob, offset)
|
44
|
+
@nodekey_offset = hive_blob[offset, 4].unpack('V').first
|
45
|
+
@nodekey_name_verification = hive_blob[offset+0x04, 4].to_s
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# -*- coding: binary -*-
|
2
|
+
require_relative "lfkey"
|
3
|
+
require_relative "valuelist"
|
4
|
+
|
5
|
+
module Rex
|
6
|
+
module Registry
|
7
|
+
|
8
|
+
class NodeKey
|
9
|
+
|
10
|
+
attr_accessor :timestamp, :parent_offset, :subkeys_count, :lf_record_offset
|
11
|
+
attr_accessor :value_count, :value_list_offset, :security_key_offset
|
12
|
+
attr_accessor :class_name_offset, :name_length, :class_name_length, :full_path
|
13
|
+
attr_accessor :name, :lf_record, :value_list, :class_name_data, :readable_timestamp
|
14
|
+
|
15
|
+
def initialize(hive, offset)
|
16
|
+
|
17
|
+
offset = offset + 0x04
|
18
|
+
|
19
|
+
nk_header = hive[offset, 2]
|
20
|
+
nk_type = hive[offset+0x02, 2]
|
21
|
+
|
22
|
+
if nk_header !~ /nk/
|
23
|
+
return
|
24
|
+
end
|
25
|
+
|
26
|
+
@timestamp = hive[offset+0x04, 8].unpack('Q').first
|
27
|
+
@parent_offset = hive[offset+0x10, 4].unpack('V').first
|
28
|
+
@subkeys_count = hive[offset+0x14, 4].unpack('V').first
|
29
|
+
@lf_record_offset = hive[offset+0x1c, 4].unpack('V').first
|
30
|
+
@value_count = hive[offset+0x24, 4].unpack('V').first
|
31
|
+
@value_list_offset = hive[offset+0x28, 4].unpack('V').first
|
32
|
+
@security_key_offset = hive[offset+0x2c, 4].unpack('V').first
|
33
|
+
@class_name_offset = hive[offset+0x30, 4].unpack('V').first
|
34
|
+
@name_length = hive[offset+0x48, 2].unpack('C').first
|
35
|
+
@class_name_length = hive[offset+0x4a, 2].unpack('C').first
|
36
|
+
@name = hive[offset+0x4c, @name_length].to_s
|
37
|
+
|
38
|
+
windows_time = @timestamp
|
39
|
+
unix_time = windows_time/10000000-11644473600
|
40
|
+
ruby_time = Time.at(unix_time)
|
41
|
+
|
42
|
+
@readable_timestamp = ruby_time
|
43
|
+
|
44
|
+
@lf_record = LFBlock.new(hive, @lf_record_offset + 0x1000) if @lf_record_offset != -1
|
45
|
+
@value_list = ValueList.new(hive, @value_list_offset + 0x1000, @value_count) if @value_list_offset != -1
|
46
|
+
|
47
|
+
@class_name_data = hive[@class_name_offset + 0x04 + 0x1000, @class_name_length]
|
48
|
+
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# -*- coding: binary -*-
|
2
|
+
module Rex
|
3
|
+
module Registry
|
4
|
+
|
5
|
+
class RegfBlock
|
6
|
+
|
7
|
+
attr_accessor :timestamp, :root_key_offset
|
8
|
+
|
9
|
+
def initialize(hive)
|
10
|
+
|
11
|
+
regf_header = hive[0x00, 4]
|
12
|
+
|
13
|
+
if regf_header !~ /regf/
|
14
|
+
puts "Not a registry hive"
|
15
|
+
return
|
16
|
+
end
|
17
|
+
|
18
|
+
@timestamp = hive[0x0C, 8].unpack('q').first
|
19
|
+
@root_key_offset = 0x20
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
# -*- coding: binary -*-
|
2
|
+
module Rex
|
3
|
+
module Registry
|
4
|
+
|
5
|
+
class ValueKey
|
6
|
+
|
7
|
+
attr_accessor :name_length, :length_of_data, :data_offset, :full_path
|
8
|
+
attr_accessor :value_type, :readable_value_type, :name, :value
|
9
|
+
|
10
|
+
def initialize(hive, offset)
|
11
|
+
offset = offset + 4
|
12
|
+
|
13
|
+
vk_header = hive[offset, 2]
|
14
|
+
|
15
|
+
if vk_header !~ /vk/
|
16
|
+
puts "no vk at offset #{offset}"
|
17
|
+
return
|
18
|
+
end
|
19
|
+
|
20
|
+
@name_length = hive[offset+0x02, 2].unpack('C').first
|
21
|
+
@length_of_data = hive[offset+0x04, 4].unpack('V').first
|
22
|
+
@data_offset = hive[offset+ 0x08, 4].unpack('V').first
|
23
|
+
@value_type = hive[offset+0x0C, 4].unpack('C').first
|
24
|
+
|
25
|
+
if @value_type == 1
|
26
|
+
@readable_value_type = "Unicode character string"
|
27
|
+
elsif @value_type == 2
|
28
|
+
@readable_value_type = "Unicode string with %VAR% expanding"
|
29
|
+
elsif @value_type == 3
|
30
|
+
@readable_value_type = "Raw binary value"
|
31
|
+
elsif @value_type == 4
|
32
|
+
@readable_value_type = "Dword"
|
33
|
+
elsif @value_type == 7
|
34
|
+
@readable_value_type = "Multiple unicode strings separated with '\\x00'"
|
35
|
+
end
|
36
|
+
|
37
|
+
flag = hive[offset+0x10, 2].unpack('C').first
|
38
|
+
|
39
|
+
if flag == 0
|
40
|
+
@name = "Default"
|
41
|
+
else
|
42
|
+
@name = hive[offset+0x14, @name_length].to_s
|
43
|
+
end
|
44
|
+
|
45
|
+
@value = ValueKeyData.new(hive, @data_offset, @length_of_data, @value_type, offset)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
class ValueKeyData
|
50
|
+
|
51
|
+
attr_accessor :data
|
52
|
+
|
53
|
+
def initialize(hive, offset, length, datatype, parent_offset)
|
54
|
+
offset = offset + 4
|
55
|
+
|
56
|
+
#If the data-size is lower than 5, the data-offset value is used to store
|
57
|
+
#the data itself!
|
58
|
+
if length < 5
|
59
|
+
@data = hive[parent_offset + 0x08, 4]
|
60
|
+
else
|
61
|
+
@data = hive[offset + 0x1000, length]
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# -*- coding: binary -*-
|
2
|
+
require_relative "valuekey"
|
3
|
+
|
4
|
+
module Rex
|
5
|
+
module Registry
|
6
|
+
|
7
|
+
class ValueList
|
8
|
+
|
9
|
+
attr_accessor :values
|
10
|
+
|
11
|
+
def initialize(hive, offset, number_of_values)
|
12
|
+
offset = offset + 4
|
13
|
+
inner_offset = 0
|
14
|
+
|
15
|
+
@values = []
|
16
|
+
|
17
|
+
1.upto(number_of_values) do |v|
|
18
|
+
valuekey_offset = hive[offset + inner_offset, 4]
|
19
|
+
next if !valuekey_offset
|
20
|
+
|
21
|
+
valuekey_offset = valuekey_offset.unpack('V').first
|
22
|
+
@values << ValueKey.new(hive, valuekey_offset + 0x1000)
|
23
|
+
inner_offset = inner_offset + 4
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'rex/registry/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "rex-registry"
|
8
|
+
spec.version = Rex::Registry::VERSION
|
9
|
+
spec.authors = ["David Maloney"]
|
10
|
+
spec.email = ["DMaloney@rapid7.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Rex Library for parsing offline registry hives}
|
13
|
+
spec.description = %q{Ruby Exploitation(Rex) library for parsing offline registry files from a Windows machine}
|
14
|
+
spec.homepage = "https://github.com/rapid7/rex-registry"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
17
|
+
spec.bindir = "exe"
|
18
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.12"
|
22
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
23
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
24
|
+
end
|
metadata
ADDED
@@ -0,0 +1,182 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rex-registry
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- David Maloney
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain:
|
11
|
+
- |
|
12
|
+
-----BEGIN CERTIFICATE-----
|
13
|
+
MIIDdTCCAl2gAwIBAgILBAAAAAABFUtaw5QwDQYJKoZIhvcNAQEFBQAwVzELMAkG
|
14
|
+
A1UEBhMCQkUxGTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYtc2ExEDAOBgNVBAsTB1Jv
|
15
|
+
b3QgQ0ExGzAZBgNVBAMTEkdsb2JhbFNpZ24gUm9vdCBDQTAeFw05ODA5MDExMjAw
|
16
|
+
MDBaFw0yODAxMjgxMjAwMDBaMFcxCzAJBgNVBAYTAkJFMRkwFwYDVQQKExBHbG9i
|
17
|
+
YWxTaWduIG52LXNhMRAwDgYDVQQLEwdSb290IENBMRswGQYDVQQDExJHbG9iYWxT
|
18
|
+
aWduIFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDaDuaZ
|
19
|
+
jc6j40+Kfvvxi4Mla+pIH/EqsLmVEQS98GPR4mdmzxzdzxtIK+6NiY6arymAZavp
|
20
|
+
xy0Sy6scTHAHoT0KMM0VjU/43dSMUBUc71DuxC73/OlS8pF94G3VNTCOXkNz8kHp
|
21
|
+
1Wrjsok6Vjk4bwY8iGlbKk3Fp1S4bInMm/k8yuX9ifUSPJJ4ltbcdG6TRGHRjcdG
|
22
|
+
snUOhugZitVtbNV4FpWi6cgKOOvyJBNPc1STE4U6G7weNLWLBYy5d4ux2x8gkasJ
|
23
|
+
U26Qzns3dLlwR5EiUWMWea6xrkEmCMgZK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
+
date: 2016-06-21 00:00:00.000000000 Z
|
89
|
+
dependencies:
|
90
|
+
- !ruby/object:Gem::Dependency
|
91
|
+
name: bundler
|
92
|
+
requirement: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '1.12'
|
97
|
+
type: :development
|
98
|
+
prerelease: false
|
99
|
+
version_requirements: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '1.12'
|
104
|
+
- !ruby/object:Gem::Dependency
|
105
|
+
name: rake
|
106
|
+
requirement: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '10.0'
|
111
|
+
type: :development
|
112
|
+
prerelease: false
|
113
|
+
version_requirements: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '10.0'
|
118
|
+
- !ruby/object:Gem::Dependency
|
119
|
+
name: rspec
|
120
|
+
requirement: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '3.0'
|
125
|
+
type: :development
|
126
|
+
prerelease: false
|
127
|
+
version_requirements: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '3.0'
|
132
|
+
description: Ruby Exploitation(Rex) library for parsing offline registry files from
|
133
|
+
a Windows machine
|
134
|
+
email:
|
135
|
+
- DMaloney@rapid7.com
|
136
|
+
executables: []
|
137
|
+
extensions: []
|
138
|
+
extra_rdoc_files: []
|
139
|
+
files:
|
140
|
+
- ".gitignore"
|
141
|
+
- ".rspec"
|
142
|
+
- ".travis.yml"
|
143
|
+
- CODE_OF_CONDUCT.md
|
144
|
+
- Gemfile
|
145
|
+
- LICENSE
|
146
|
+
- README.md
|
147
|
+
- Rakefile
|
148
|
+
- bin/console
|
149
|
+
- bin/setup
|
150
|
+
- lib/rex/registry.rb
|
151
|
+
- lib/rex/registry/hive.rb
|
152
|
+
- lib/rex/registry/lfkey.rb
|
153
|
+
- lib/rex/registry/nodekey.rb
|
154
|
+
- lib/rex/registry/regf.rb
|
155
|
+
- lib/rex/registry/valuekey.rb
|
156
|
+
- lib/rex/registry/valuelist.rb
|
157
|
+
- lib/rex/registry/version.rb
|
158
|
+
- rex-registry.gemspec
|
159
|
+
homepage: https://github.com/rapid7/rex-registry
|
160
|
+
licenses: []
|
161
|
+
metadata: {}
|
162
|
+
post_install_message:
|
163
|
+
rdoc_options: []
|
164
|
+
require_paths:
|
165
|
+
- lib
|
166
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
167
|
+
requirements:
|
168
|
+
- - ">="
|
169
|
+
- !ruby/object:Gem::Version
|
170
|
+
version: '0'
|
171
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
172
|
+
requirements:
|
173
|
+
- - ">="
|
174
|
+
- !ruby/object:Gem::Version
|
175
|
+
version: '0'
|
176
|
+
requirements: []
|
177
|
+
rubyforge_project:
|
178
|
+
rubygems_version: 2.4.8
|
179
|
+
signing_key:
|
180
|
+
specification_version: 4
|
181
|
+
summary: Rex Library for parsing offline registry hives
|
182
|
+
test_files: []
|
metadata.gz.sig
ADDED