more updates
parent
a0e04760b5
commit
f7071818b1
|
@ -5,7 +5,6 @@ module Rex
|
|||
module Post
|
||||
module Meterpreter
|
||||
module Ui
|
||||
|
||||
###
|
||||
#
|
||||
# This class provides commands that interact with the timestomp feature set of
|
||||
|
@ -51,12 +50,6 @@ class Console::CommandDispatcher::Priv::Timestomp
|
|||
# line timestomp interface provides with a similar argument set.
|
||||
#
|
||||
def cmd_timestomp(*args)
|
||||
if args.length < 2
|
||||
print_line("\nUsage: timestomp <file(s)> OPTIONS\n" +
|
||||
@@timestomp_opts.usage)
|
||||
return
|
||||
end
|
||||
|
||||
paths = []
|
||||
|
||||
modified = nil
|
||||
|
@ -67,6 +60,7 @@ class Console::CommandDispatcher::Priv::Timestomp
|
|||
blank_file_mace = false
|
||||
blank_directory_mace = false
|
||||
get_file_mace = false
|
||||
help = false
|
||||
|
||||
@@timestomp_opts.parse(args) do |opt, _idx, val|
|
||||
case opt
|
||||
|
@ -99,9 +93,7 @@ class Console::CommandDispatcher::Priv::Timestomp
|
|||
when "-v"
|
||||
get_file_mace = true
|
||||
when "-h"
|
||||
print_line("\nUsage: timestomp <file(s)> OPTIONS\n" +
|
||||
@@timestomp_opts.usage)
|
||||
return nil
|
||||
help = true
|
||||
when nil
|
||||
paths << val
|
||||
end
|
||||
|
@ -109,7 +101,14 @@ class Console::CommandDispatcher::Priv::Timestomp
|
|||
|
||||
if paths.empty?
|
||||
print_line("\nNo paths specified.")
|
||||
return
|
||||
return nil
|
||||
end
|
||||
|
||||
if !(modified || accessed || creation || emodified ||
|
||||
blank_file_mace || blank_directory_mace || get_file_mace) || help
|
||||
print_line("\nUsage: timestomp <file(s)> OPTIONS\n" +
|
||||
@@timestomp_opts.usage)
|
||||
return nil
|
||||
end
|
||||
|
||||
paths.uniq.each do |path|
|
||||
|
@ -146,9 +145,12 @@ class Console::CommandDispatcher::Priv::Timestomp
|
|||
# Converts a date/time in the form of MM/DD/YYYY HH24:MI:SS
|
||||
#
|
||||
def str_to_time(str) # :nodoc:
|
||||
_r, mon, day, year, hour, min, sec = str.match("^(\\d+?)/(\\d+?)/(\\d+?) (\\d+?):(\\d+?):(\\d+?)$").to_a
|
||||
unless str.nil?
|
||||
_r, mon, day, year, hour, min, sec =
|
||||
str.match("^(\\d+?)/(\\d+?)/(\\d+?) (\\d+?):(\\d+?):(\\d+?)$").to_a
|
||||
end
|
||||
|
||||
if mon.nil?
|
||||
if str.nil? || mon.nil?
|
||||
raise ArgumentError, "Invalid date format, expected MM/DD/YYYY HH24:MI:SS (got #{str})"
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue