Skip to content

Commit 9985ea3

Browse files
committed
Enumerates Windows Prefetch files through meterpreter session
1 parent e13f4f5 commit 9985ea3

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

modules/post/windows/gather/enum_prefetch.rb

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ def initialize(info={})
2525

2626
def prefetch_key_value()
2727
# Checks if Prefetch registry key exists and what value it has.
28-
reg_key = session.sys.registry.open_key(HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Memory\ Management\\PrefetchParameters", KEY_READ)
29-
key_value = reg_key.query_value("EnablePrefetcher").data
28+
prefetch_key = session.sys.registry.open_key(HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Memory\ Management\\PrefetchParameters", KEY_READ)
29+
key_value = prefetch_key.query_value("EnablePrefetcher").data
3030

3131
if key_value == 0
3232
print_error("EnablePrefetcher Value: (0) = Disabled (Non-Default).")
@@ -39,7 +39,7 @@ def prefetch_key_value()
3939
else
4040
print_error("No value or unknown value. Results might vary.")
4141
end
42-
reg_key.close
42+
prefetch_key.close
4343
end
4444

4545
def timezone_key_values(key_value)
@@ -88,7 +88,7 @@ def gather_prefetch_info(name_offset, hash_offset, lastrun_offset, runcount_offs
8888
client.railgun.kernel32.SetFilePointer(handle, runcount_offset, 0, nil)
8989
count = client.railgun.kernel32.ReadFile(handle, 4, 4, 4, nil)
9090

91-
# Finds the file path hash from the prefetch file
91+
# Finds the file path hash from the prefetch file.
9292
client.railgun.kernel32.SetFilePointer(handle, hash_offset, 0, nil)
9393
hash = client.railgun.kernel32.ReadFile(handle, 4, 4, 4, nil)
9494

@@ -177,7 +177,6 @@ def run
177177
print_status("Searching for Prefetch Registry Value.")
178178

179179
prefetch_key_value
180-
print_line("")
181180
print_status("Searching for TimeZone Registry Values.")
182181

183182
timezone_key_values(key_value)

0 commit comments

Comments
 (0)