Ticket #355 (accepted task)

Opened 5 years ago

Last modified 3 years ago

Implement feature-complete CLI

Reported by: Joel Owned by: Joel
Priority: major Milestone: Eraser 6.1/6.2
Component: User Interface (UX) Version:
Keywords: Cc:
Processor Architecture: Blocked By: #83, #278
Blocking: Operating System:

Description (last modified by Joel) (diff)

Implement a CLI for Eraser, usable in a batch script. Thus, we need to include a wait parameter so that when calling eraser erase, the program will not exit immediately but will wait for the erasure to complete before exiting.

We also need to refactor the code, ensuring that only one global TrueValues? property exists so that all clients will get the same values for true, and a common CLI will be presented (see Eraser.DefaultPlugins/ErasureTargets/ProgressArgument)

Blocking

IdSummaryMilestone
#355Implement feature-complete CLIEraser 6.1/6.2

Blocked by

IdSummaryMilestone
#355Implement feature-complete CLIEraser 6.1/6.2
#83Upgrade Remote Executor classesEraser 6.1/6.2
#278Implement the Executor as a ServiceEraser 6.1/6.2
#83Upgrade Remote Executor classesEraser 6.1/6.2
#75User-based erasure controlEraser 6.1/6.2

Change History

comment:1 Changed 5 years ago by DavidHB

The CLI should, in principle, implement all features of Eraser required to complete the full range of Eraser wiping and Erasing tasks. As is the case with, for example, the SysInternals? 'SDelete', program, specifying a file or folder would imply that that folder is to be erased while specifying a drive letter would imply that the free space on the drive is to be erased

When specifying files and folders, partial matches and comma separated lists of file/folder names should be allowed.

Parameters should allow the user to create and run a new task, run an existing task, specify a particular erase method, specify whether to erase cluster tips, specify whether the task should be removed from the task list on completion. There should also be a -quiet parameter. All parameters should have default values if the parameter is not specified.

comment:2 Changed 5 years ago by Joel

How does the current command line interface fall short?

Eraser 6.1.0.1923
(c) 2008-2010 The Eraser Project
Eraser is Open-Source Software: see http://eraser.heidi.ie/ for details.

usage: Eraser <action> <arguments>
where action is
  help                Show this help message.
  addtask             Adds tasks to the current task list.
  querymethods        Lists all registered Erasure methods.
  importtasklist      Imports an Eraser Task list to the current user's Task
                      List.

global parameters:
  /quiet              Do not create a Console window to display progress.

parameters for help:
  eraser help

  no parameters to set.

parameters for addtask:
  eraser addtask [/method=<methodGUID>] [/schedule=(now|manually|restart)] (recy
clebin | unused=<volume> | dir=<directory> | file=<file>)[...]

  /method             The Erasure method to use.
  /schedule           The schedule the task will follow. The value must be one
                      of:
      now             The task will be queued for immediate execution.
      manually        The task will be created but not queued for execution.
      restart         The task will be queued for execution when the computer
                      is next restarted.
  recyclebin          Erases files and folders in the recycle bin
  unused              Erases unused space in the volume.
    optional arguments: unused=<drive>[,clusterTips[=(true|false)]]
      clusterTips     If specified, the drive's files will have their
                      cluster tips erased. This parameter accepts a Boolean
                      value (true/false) as an argument; if none is specified
                      true is assumed.
  dir                 Erases files and folders in the directory
    optional arguments: dir=<directory>[,-excludeMask][,+includeMask][,deleteIfE
mpty]
      excludeMask     A wildcard expression for files and folders to
                      exclude.
      includeMask     A wildcard expression for files and folders to
                      include.
                      The include mask is applied before the exclude mask.
      deleteIfEmpty   Deletes the folder at the end of the erasure if it is
                      empty.
  file                Erases the specified file

parameters for querymethods:
  eraser querymethods

  no parameters to set.

parameters for importtasklist:
  eraser importtasklist (file)[...]

  [file]              A list of one or more files to import.

All arguments are case sensitive.

Indeed -- Eraser doesn't have the same intuitive interface as SDelete; but bearing in mind Eraser's architecture, would you still feel that SDelete's CLI is best for the purposes of Eraser?

Files and Folders, partial matches and comma separated lists already are supported: see above.

For your last point, "eraser addtask" does create a new task, though there isn't an equivalent "eraser runtask" command. That is definitely a deficiency. Erasure methods, whether to erase cluster tips and quiet execution are all already part of the current CLI. Some parameters are compulsory, others have reasonable defaults.

comment:3 Changed 5 years ago by DavidHB

In the original comment, I made the mistake of trying to start from scratch, rather than suggesting changes. The following possible revision of the current CLI illustrates the changes I had in mind. Changes are {in curly brackets and bold}

Eraser 6.1.0.????
(c) 2008-2010 The Eraser Project
Eraser is Open-Source Software: see http://eraser.heidi.ie/ for details.

usage: Eraser <action> {|} <arguments>

where action is

help Show this help message.
addtask Adds tasks to the current task list.

{usetask Uses the task specified in the current task list}

querymethods Lists all registered Erasure methods.
importtasklist Imports an Eraser Task list to the current user's Task

List.

global parameters:

/quiet Do not create a Console window to display progress.

parameters for help:

eraser help

no parameters to set.

parameters for addtask:

eraser addtask method=<methodGUID> schedule=(now|manually|restart)
(recyclebin | unused=<volume> | dir=<directory> | file=<file>)[...]

/method The Erasure method to use.
/schedule The schedule the task will follow. The value must be one

of:

now The task will be queued for immediate execution.
manually The task will be created but not queued for execution.
restart The task will be queued for execution when the computer

is next restarted.

recyclebin Erases files and folders in the recycle bin
unused Erases unused space in the volume.

optional arguments: unused=<drive>[,clusterTips[=(true|false)]]

clusterTips If specified, the drive's files will have their

cluster tips erased. This parameter accepts a Boolean
value (true/false) as an argument; if none is specified
true is assumed.

dir Erases files and folders in the directory

optional arguments: dir=<directory>[,-excludeMask][,+includeMask]

[,deleteIfEmpty]

excludeMask A wildcard expression for files and folders to

exclude.

includeMask A wildcard expression for files and folders to

include.
The include mask is applied before the exclude mask.

deleteIfEmpty Deletes the folder at the end of the erasure if it is

empty.

file Erases the specified file

{parameters for usetask:

These parameters are the same as those for addtask. All parameters are
optional; where a parameter is not specified, values will be used from
the selected task.}

parameters for querymethods:

eraser querymethods

no parameters to set.

parameters for importtasklist:

eraser importtasklist (file)[...]

[file] A list of one or more files to import.

{Arguments can be [file]: a list of one or more files or directories to

import for erasing. Normal Windows file/path
specification conventions (including Environment
Variables) are used. Wild cards are allowed in
the file specification.

[drive]: the letter specification of a drive on which free

space is to be wiped.


Arguments are ignored if an action is specified. Commands using arguments are
executed immediately, using current program default settings.}

All arguments are case sensitive {delete this line}.

Some of these changes may describing what is already implemented. Essentially, I am trying to simplify the use of the CLI by allowing commands such as 'Eraser usetask My task' and 'Eraser fileInCurrentDirectory.xyz'

Hope this clarifies things

comment:4 Changed 5 years ago by Joel

So the main improvements you're proposing are:

  • Allow a method to execute a task
    eraser run (Task ID|Task Name)
    
  • Quickly run a task
    eraser erase /method=<methodGUID> /schedule=(now|manually|restart)
    (recyclebin | unused=<volume> | dir=<directory> | file=<file>)[...]
    

which is the same as eraser addtask followed by eraser run.

Arguments can be [file]: a list of one or more files or directories to
import for erasing. Normal Windows file/pathspecification conventions
(including Environment Variables) are used. Wild cards are allowed in
the file specification.

That's actually handled by the Command Prompt, and shouldn't be handled by Eraser -- that's what scripting is for, to build up your variables. Eraser should only deal with the paths of files.

comment:5 Changed 4 years ago by Joel

  • Description modified (diff)

comment:6 Changed 4 years ago by Joel

  • Owner set to Joel
  • Status changed from new to accepted

comment:7 Changed 4 years ago by Joel

In r2227-r2228, I've implemented the ability to detect paths and automatically create the correct erasure target type.

comment:8 Changed 4 years ago by Joel

In r2231, volume/disk erasures can be specified on the command line.

comment:9 Changed 4 years ago by Joel

In r2232, the generation of the help commands for addtask has been delegated to plugins using the ICliConfigurer interface. Thus, the generated help and the accepted arguments list are always synchronised now.

In r2233, Erasure Method Names can be used in place of Eraser Method GUIDs, where no ambiguity is involved.

In r2234, querymethods has been removed. The list of erasure methods are now displayed when eraser help is invoked.

comment:10 Changed 4 years ago by Joel

In r2236, the erase command was added.

comment:11 Changed 4 years ago by Joel

  • Description modified (diff)

comment:12 Changed 4 years ago by Joel

How's the newest version's CLI?

Eraser 6.1.0.2238
(c) 2008-2010 The Eraser Project
Eraser is Open-Source Software: see http://eraser.heidi.ie/ for details.

usage: Eraser <action> <arguments>
where action is
  help                Show this help message.
  erase               Erases items specified on the command line. This is
                      equivalent to addtask, with the schedule set to "now".
  addtask             Adds a task to the current task list.
  importtasklist      Imports an Eraser Task list to the current user's Task
                      List.

global parameters:
  /quiet              Do not create a Console window to display progress.

parameters for help:
  eraser help

  no parameters to set.

parameters for erase and addtask:
  eraser erase [/method=(<methodGUID>|<methodName>)] <target> [target [...]]
  eraser addtask [/method=(<methodGUID>|<methodName>)] [/schedule=(now|manually|
restart)] <target> [target [...]]

  /method             The Erasure method to use.
    methodGUID and methodName any GUID/Name from the following list:
       Erasure Method                      GUID
    ---------------------------------------------------------------------------
    U  Gutmann                             1407fc4e-feff-4375-b4fb-d7efbb7e9922
    U  Gutmann Lite                        ae5eb764-41b0-4601-bdf2-326b5838d44a
    U  US DoD 5220.22-M (8-306./E, C & E)  d1583631-702e-4dbf-a0e9-c35dba481702
    U  RCMP TSSIT OPS-II                   f335cc40-5de5-4733-90b1-6957b4a45688
    U  Schneier 7 pass                     b1bfab4a-31d3-43a5-914c-e9892c78afd8
    U  German VSITR                        607632b2-651b-4935-883a-bdaa74febb54
    U  US DoD 5220.22-M (8-306./E)         ecbf4998-0b4f-445c-9a06-23627659e419
    U  British HMG IS5 (Enhanced)          45671da4-9401-46e4-9c0d-89b94e89c8b5
    U  US Air Force 5020                   7bf5b185-8ea5-4e12-83f1-f6c2efb3d2c2
    U  US Army AR380-19                    0fe620ea-8055-4861-b5bb-bd8bdc3fd4ac
    U  Russian GOST P50739-95              92681583-f484-415f-a66c-cc210222edc5
    U  British HMG IS5 (Baseline)          9acdbd78-0406-4116-87e5-263e5e3b2e0d
    U  Pseudorandom Data                   bf8ba267-231a-4085-9bf9-204de65a6641
       First/last 16KB Erasure             0c2e07bf-0207-49a3-ade8-46f9e1499c01

    Only erasure methods labelled "U" can be used to erase unused disk space.

  /schedule           The schedule the task will follow. The value must be one
                      of:
    now               The task will be queued for immediate execution.
    manually          The task will be created but not queued for execution.
    restart           The task will be queued for execution when the computer
                      is next restarted.

                      This parameter is only valid for use with "addtask".

  target is one or more of:
    file                Erases the specified file
      argument: file=<path>
    dir                 Erases files and folders in the directory
      arguments: dir=<directory>[,-excludeMask][,+includeMask][,deleteIfEmpty]
        excludeMask     A wildcard expression for files and folders to
                        exclude.
        includeMask     A wildcard expression for files and folders to
                        include.
                        The include mask is applied before the exclude mask.
        deleteIfEmpty   Deletes the folder at the end of the erasure if it is
                        empty.
    recyclebin          Erases files and folders in the recycle bin
    unused              Erases unused space in the volume.
      arguments: unused=<drive>[,clusterTips[=(true|false)]]
      clusterTips     If specified, the drive's files will have their
                      cluster tips erased. This parameter accepts a Boolean
                      value (true/false) as an argument; if none is specified
                      true is assumed.
    move                Securely moves a file/directory to a new location
      arguments: move=<source>|<destination>
    drive               Erases partitions, volumes or drives
      arguments:
        drive=\Device\Harddisk<index>
        drive=\\.\PhysicalDrive<index>
        drive=\\?\Volume<guid>

parameters for importtasklist:
  eraser importtasklist <file>[...]

    file               A list of one or more files to import.

All arguments are case sensitive.

Response files can be used for very long command lines (generally, anything
involving more than 32,000 characters.) Response files are used by prepending
"@" to the path to the file, and passing it into the command line. The
contents of the response files' will be substituted at the same position into
the command line.

comment:13 Changed 4 years ago by Joel

  • Blocked By 83, 278 added

This ticket needs to have a good interface for RPC -- the "wait" function needs this so that it will return only when complete.

comment:14 Changed 3 years ago by Joel

A separate request from entrophy suggests that the erase command be implemented such that calling eraser erase would not go through the Scheduler.

comment:15 Changed 3 years ago by Joel

Suggestion from the forum that we should include examples in the CLI help.

Note: See TracTickets for help on using tickets.