Improve file operations

Hmm, why did I not use File.write before? Oh well, fixed.
GSoC/Meterpreter_Web_Console
William Vu 2018-08-20 22:25:19 -05:00
parent 808e2f2e25
commit 321f2b8746
2 changed files with 2 additions and 2 deletions

View File

@ -495,7 +495,7 @@ class Core
# Portable file truncation?
if File.writable?(Msf::Config.history_file)
File.open(Msf::Config.history_file, 'w') {}
File.write(Msf::Config.history_file, '')
end
print_good('Command history and history file cleared')

View File

@ -139,7 +139,7 @@ module Msf
framework.jobs.each_key do |i|
framework.jobs.stop_job(i)
end
File.truncate(Msf::Config.persist_file,0) if File.exist?(Msf::Config.persist_file)
File.write(Msf::Config.persist_file, '') if File.writable?(Msf::Config.persist_file)
when "-i"
# Defer printing anything until the end of option parsing
# so we can check for the verbose flag.