tfjmp / xanthus

System traces dataset generation tool.
https://rubygems.org/gems/xanthus
MIT License
12 stars 5 forks source link

An option to directly provide a script to run in `.xanthus`? #1

Closed michael-hahn closed 5 years ago

michael-hahn commented 5 years ago

In .xanthus, a stage is usually a space holder that requires the user to provide instructions. In the following example, the :pre stage actions are given by the user to create a directory and wait for 5 seconds:

config.script :pre do
    %q{%{
      mkdir wgets
      cd wgets
      sleep 5
    }}
  end

Sometimes, the user may want to simply include a path to a file that contains the code to run a stage. This is different from doing things such as:

config.script :pre do
    %q{%{
      ./path_to_a_script
    }}
  end

which still requires the user to manually edit the .xanthus file to include the path (an OK solution, but maybe we can do better). Maybe we can consider the option in the command line when user initiate the project, such as:

xanthus init --pre path_to_a_script
tfjmp commented 5 years ago

:pre is not a keyword. You name your "subscript" (we need a name to describe those things) whatever you like and have as many as you like.

You can also list as many as you want when provisioning VMs:

  config.job :attack_camflow do |job|
    job.iterations = 25
    job.tasks = {server: [:server], camflow: [:pre, :camflow_start, :attack, :camflow_stop, :post]}
    job.inputs = {server: ['ipscan_3.5.5_amd64.deb', 'wget-exploit.py']}
    job.outputs = {camflow: {config: '/etc/camflow.ini', trace: '/tmp/audit.log'}}
  end

We could easily get the content from a file, but I am bit worried to make the command line overly complex (while it is not super hard to edit a config file).

michael-hahn commented 5 years ago

I understand the mechanism. Okay. I do agree we do not want the command line interface to be overly complicated. Thanks.