Module: Msf::Exploit::Local::Timespec

Defined in:
lib/msf/core/exploit/local/timespec.rb

Constant Summary collapse

TIMESPEC_REGEX =
%r{
  \b(
    (?:[01]?\d|2[0-3]):[0-5]\d(?:\s?(?:AM|PM))? |            # Matches HH:MM (12h/24h)
    midnight | noon | teatime | now |                        # Matches special keywords
    now\s?\+\s?\d+\s?(?:minutes?|hours?|days?|weeks?) |      # Matches relative times
    (?:mon|tue|wed|thu|fri|sat|sun)(?:day)? |                # Matches named days
    (?:next|last)\s(?:mon|tue|wed|thu|fri|sat|sun)(?:day)? | # Matches next/last weekday
    \d{1,2}/\d{1,2}/\d{2,4} |                                # Matches MM/DD/YY(YY)
    \d{1,2}\.\d{1,2}\.\d{2,4} |                              # Matches DD.MM.YY(YY)
    \d{6} | \d{8}                                            # Matches MMDDYY or MMDDYYYY
  )\b
}xi

Class Method Summary collapse

Class Method Details

.valid_timespec?(timespec) ⇒ Boolean

Attempts to validate a timespec.

Parameters:

  • timespec (String)

    The timespec to test

Returns:

  • (Boolean)

    If the timespec is valid or not



24
25
26
# File 'lib/msf/core/exploit/local/timespec.rb', line 24

def self.valid_timespec?(timespec)
  !!(timespec =~ TIMESPEC_REGEX) # Ensures true/false return
end