2005-07-14 22:45:10 +00:00
|
|
|
require 'rex/ui/progress_tracker'
|
|
|
|
|
|
|
|
module Rex
|
|
|
|
module Ui
|
|
|
|
module Text
|
|
|
|
|
|
|
|
###
|
|
|
|
#
|
|
|
|
# This module implements progress tracking against a text interface.
|
|
|
|
#
|
|
|
|
###
|
|
|
|
class ProgressTracker < Rex::Ui::ProgressTracker
|
|
|
|
|
|
|
|
def initialize(output)
|
|
|
|
self.output = output
|
|
|
|
self.start = 0
|
|
|
|
self.stop = 0
|
|
|
|
self.pos = 0
|
|
|
|
end
|
|
|
|
|
|
|
|
#
|
|
|
|
# Passes a generic status message that isn't necessarily associated
|
|
|
|
# with a step event.
|
|
|
|
#
|
|
|
|
def status(msg = '')
|
|
|
|
output.print_status(msg)
|
|
|
|
end
|
|
|
|
|
|
|
|
#
|
|
|
|
# Updates the status associated with the current step.
|
|
|
|
#
|
|
|
|
def step_status(msg = '')
|
2005-07-14 22:58:09 +00:00
|
|
|
output.print_status("#{pos}: #{msg}") if (msg and msg.length > 0)
|
2005-07-14 22:45:10 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
#
|
|
|
|
# An error occurred that may result in aborting the progress.
|
|
|
|
#
|
|
|
|
def error(msg = '')
|
|
|
|
output.print_error(msg)
|
|
|
|
end
|
|
|
|
|
|
|
|
#
|
|
|
|
# Progress has been aborted, the reason is supplied in msg.
|
|
|
|
#
|
|
|
|
def abort(msg = '')
|
|
|
|
output.print_error("fatal: #{msg}")
|
|
|
|
end
|
|
|
|
|
2005-07-14 22:58:09 +00:00
|
|
|
attr_accessor :output
|
|
|
|
|
2005-07-14 22:45:10 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
2008-10-19 21:03:39 +00:00
|
|
|
end
|