Skip to content

Commit 315874a

Browse files
committed
Minor fixes
1 parent 5d767fe commit 315874a

File tree

1 file changed

+17
-16
lines changed

1 file changed

+17
-16
lines changed

modules/post/windows/gather/enum_prefetch.rb

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,22 @@
44
# web site for more information on licensing and terms of use.
55
# http://metasploit.com/
66
##
7-
87
require 'msf/core'
98
require 'rex'
109
require 'msf/core/post/windows/registry'
11-
1210
class Metasploit3 < Msf::Post
13-
include Msf::Post::Windows::Priv
14-
15-
def initialize(info={})
16-
super(update_info(info,
17-
'Name' => 'Windows Gather Prefetch File Information',
18-
'Description' => %q{This module gathers prefetch file information from WinXP & Win7 systems.},
19-
'License' => MSF_LICENSE,
20-
'Author' => ['TJ Glad <fraktaali[at]gmail.com>'],
21-
'Platform' => ['win'],
22-
'SessionType' => ['meterpreter']
23-
))
24-
25-
end
11+
include Msf::Post::Windows::Priv
12+
13+
def initialize(info={})
14+
super(update_info(info,
15+
'Name' => 'Windows Gather Prefetch File Information',
16+
'Description' => %q{This module gathers prefetch file information from WinXP & Win7 systems.},
17+
'License' => MSF_LICENSE,
18+
'Author' => ['TJ Glad <fraktaali[at]gmail.com>'],
19+
'Platform' => ['win'],
20+
'SessionType' => ['meterpreter']
21+
))
22+
end
2623

2724

2825
def prefetch_key_value()
@@ -73,7 +70,7 @@ def timezone_key_values(key_value)
7370
def gather_prefetch_info(name_offset, hash_offset, lastrun_offset, runcount_offset, filename, table)
7471

7572
# This function seeks and gathers information from specific offsets.
76-
h = client.railgun.kernel32.CreateFileA(filename, "GENERIC_READ", "FILE_SHARE_DELETE|FILE_SHARE_READ|FILE_SHARE_WRITE", nil, "OPEN_EXISTING", "FILE_ATTRIBUTE_NORMAL", 0)
73+
h = client.railgun.kernel32.CreateFileA(filename, "GENERIC_READ", "FILE_SHARE_DELETE|FILE_SHARE_READ|FILE_SHARE_WRITE", nil, "OPEN_EXISTING", "FILE_ATTRIBUTE_READONLY", nil)
7774

7875
if h['GetLastError'] != 0
7976
print_error("Error opening a file handle.")
@@ -190,11 +187,14 @@ def run
190187

191188
# Goes through the files in Prefetch directory, creates file paths for the
192189
# gather_prefetch_info function that enumerates all the pf info
190+
193191
getfile_prefetch_filenames = client.fs.file.search(full_path,file_type,recurse=false,timeout=-1)
194192
getfile_prefetch_filenames.each do |file|
195193
if file.empty? or file.nil?
196194
print_error("Could not open file: %s." % file['name'])
195+
197196
else
197+
198198
filename = File.join(file['path'], file['name'])
199199
gather_prefetch_info(name_offset, hash_offset, lastrun_offset, runcount_offset, filename, table)
200200
end
@@ -207,5 +207,6 @@ def run
207207
print_line("\n" + results + "\n")
208208
print_status("Finished gathering information from prefetch files.")
209209
print_status("Results stored in: #{loot}")
210+
210211
end
211212
end

0 commit comments

Comments
 (0)