Skip to content

Commit

Permalink
README
Browse files Browse the repository at this point in the history
  • Loading branch information
jcran committed Dec 17, 2011
1 parent 0d205c4 commit 5d27326
Showing 1 changed file with 23 additions and 33 deletions.
56 changes: 23 additions & 33 deletions README
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
This folder contains the libraries necessary to run the lab plugin, and can also be used in a standalone way to automate virtual machines.

#########
CONCEPTS:
#########
== CONCEPTS:

The lab provides a clean interface to common vm functions such as start / stop / snapshot / revert and even running system commands or higher-level functions like opening a browser to a specified URL. It's designed so the different VM technologies have a similiar interface, and you can ignore the specifics of the VM tech. The majority of the functionality is implemented in the form of drivers and controllers. Drivers implement the underlying command for each vm software (such as start/stop/revert), and controllers implement the commands which apply to all vms (such as listing all running vms, or cloning a vm).

If you're interested in porting a vm software (see below), please take a look at the workstation_driver.rb and the workstation_controller.rb -- This is a simple driver / controller in the lab, and you can simply copy / modify this to implement a new driver & controller for the software.

##########################
SUPPORTED VM TECHNOLOGIES:
##########################
== SUPPORTED VM TECHNOLOGIES:

NOTE: The lab libraries have only been tested on linux, porting to windows is not planned at this time.

Expand All @@ -29,9 +25,7 @@ Need Implementation:
- qemudo
- others?

#################
PLATFORM SUPPORT:
#################
== PLATFORM SUPPORT:

You will need to have this code running on a linux box, Currently this has only been run / tested on Ubuntu 9.04 -> 10.04, though it should run on any linux with an ssh client and the dependencies below. Remote VM Hosts will need to be linux as well, though other platforms may work (untested). If you're interested in porting it to windows, please contact me (jcran).

Expand All @@ -40,9 +34,26 @@ Platform Dependencies:
- net/scp - the gem (net-scp). Required to copy files to/from the devices in the case that tools are not installed. Not necessary if tools are installed.
- fog - require to use the amazon_ec2 driver

######################
MSFCONSOLE LAB PLUGIN:
######################
== STANDALONE API:

BACKGROUND:

The lab libraries add tons of useful functionality that isn't exposed through the lab plugin, such as the ability to run commands on hosts. This library can serve as an excellent base for more complex operations on a remote host as well.

USAGE:

You must first create a yaml file which describes your vm. See data/lab/test_targets.yml for an example.

require 'vm_controller'
vm_controller = ::Lab::Controllers::VmController.new(YAML.load_file(lab_def))
vm_controller['vm1'].start
vm_controller['vm1'].snapshot("clean")
vm_controller['vm1'].run_command("rm /etc/resolv.conf")
vm_controller['vm1'].open_uri("http://autopwn:8080")
vm_controller['vm1'].revert("clean")
vm_controller['vm1'].revert("clean")

== MSFCONSOLE LAB PLUGIN:

BACKGROUND:

Expand All @@ -64,24 +75,3 @@ Here's some example usage for the lab plugin.
msf> lab_start vm2 // Start another vm
msf> lab_suspend vm1 // Suspend a vm
msf> lab_revert all snapshot_1 // Revert all vms back to 'snapshot_1'

###############
STANDALONE API:
###############

BACKGROUND:

The lab libraries add tons of useful functionality that isn't exposed through the lab plugin, such as the ability to run commands on hosts. This library can serve as an excellent base for more complex operations on a remote host as well.

USAGE:

You must first create a yaml file which describes your vm. See data/lab/test_targets.yml for an example.

require 'vm_controller'
vm_controller = ::Lab::Controllers::VmController.new(YAML.load_file(lab_def))
vm_controller['vm1'].start
vm_controller['vm1'].snapshot("clean")
vm_controller['vm1'].run_command("rm /etc/resolv.conf")
vm_controller['vm1'].open_uri("http://autopwn:8080")
vm_controller['vm1'].revert("clean")
vm_controller['vm1'].revert("clean")

0 comments on commit 5d27326

Please sign in to comment.