INNER CODE UNIT · Ruby
filesize
Hackplayers/evil-winrm · evil-winrm.rb:673
def filesize(shell, path)
shell.run("(get-item '#{path}').length").output.strip.to_i
end
# Clear screen
def clear_screen
system('clear') || system('cls') || puts("\033[2J\033[H")
end
# Get history file path based on host and user
def get_history_file_path
history_dir = File.join(Dir.home, '.evil-winrm', 'history')
FileUtils.mkdir_p(history_dir) unless Dir.exist?(history_dir)
# Create a safe filename from host and user
safe_host = ($host || 'unknown').gsub(/[^a-zA-Z0-9._-]/, '_')
safe_user = ($user || 'unknown').gsub(/[^a-zA-Z0-9._-]/, '_')
history_filename = "#{safe_host}_#{safe_user}.hist"