diff --git a/lib/msf/ui/console/command_dispatcher/core.rb b/lib/msf/ui/console/command_dispatcher/core.rb index 0c01901303..5c5fd0c259 100644 --- a/lib/msf/ui/console/command_dispatcher/core.rb +++ b/lib/msf/ui/console/command_dispatcher/core.rb @@ -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') diff --git a/lib/msf/ui/console/command_dispatcher/jobs.rb b/lib/msf/ui/console/command_dispatcher/jobs.rb index 9539a3598c..024e412577 100644 --- a/lib/msf/ui/console/command_dispatcher/jobs.rb +++ b/lib/msf/ui/console/command_dispatcher/jobs.rb @@ -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.