INNER CODE UNIT · Ruby

progress

Hackplayers/evil-winrm · evil-winrm.rb:664

    progress = ((bytes_done.to_f / total_bytes) * 100).round
    progress_bar = (progress / 10).round
    progress_string = '▓' * (progress_bar - 1).clamp(0, 9)
    progress_string = "#{progress_string}▒#{'░' * (10 - progress_bar)}"
    message = "Progress: #{progress}% : |#{progress_string}|          \r"
    $stdout.print message
  end

  # Get filesize
  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

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…