---
attack_technique: T1053.001
display_name: "Scheduled Task/Job: At (Linux)"

atomic_tests:
- name: At - Schedule a job
  auto_generated_guid: 7266d898-ac82-4ec0-97c7-436075d0d08e
  description: |
    This test submits a command to be run in the future by the `at` daemon.

  supported_platforms:
    - linux

  input_arguments:
    time_spec:
      description: Time specification of when the command should run
      type: String
      default: now + 1 minute
    at_command:
      description: The command to be run
      type: String
      default: echo Hello from Atomic Red Team

  dependency_executor_name: sh
  dependencies:
    - description: |
        The `at` and `atd` executables must exist in the PATH
      prereq_command: |
        which at && which atd
      get_prereq_command: |
        echo 'Please install `at` and `atd`; they were not found in the PATH (Package name: `at`)'
    - description: |
        The `atd` daemon must be running
      prereq_command: |
        systemctl status atd || service atd status
      get_prereq_command: |
        echo 'Please start the `atd` daemon (sysv: `service atd start` ; systemd: `systemctl start atd`)'

  executor:
    name: sh
    elevation_required: false
    command: |
      echo "#{at_command}" | at #{time_spec}
