Overview

Generators help to create reusable scenarios by generating content and storing them in OCCP Variables. Examples of useful generated content would be usernames, passwords, and ssh key pairs. When a scenario is using generators, the Administrative VM can use the "regen" flag to redeploy the scenario with newly generated content. Generators may take additional parameters that affect the content that the produce.

Generic XML Specification

In the following example the generator "bar" will use the parameter named "baz" whose content is "qux". Based on that parameter it will generate what ever content it was designed for and store it in some variation of the variable "foo". What that variation is depends on the generator. For instance the ssh generator may produce the variables foo_public and foo_private while a username generator might just produce foo.

<var name="foo" generator="bar">
   <param name="baz">qux</param>
</var>

Current Generators

password

This generator produces passwords and their appropriate shadow file lines based on the parameters provided to it. It expands the variable in the following way assuming the variable name of "foo"

  • foo_plain
  • foo_shadow

When using count > 1 all produced variables will be arrays.

Parameter Description Values Default Required
algorithm The hashing algorithm to use for the shadow versionOne of: SHA256, SHA512, MD5 SHA512 No
count The number of passwords to produceIntegers >01 No
length The character length desired integer or a range specified as min:max n/a Yes if password or pool not specified
password The desired password if you just want the shadow password, all other params will be ignored String n/a No
pool The name of a file with one password per line that is located in the scenario base directory. Type and length will be ignored because the plain text password will be picked from this pool. If count is greater than the number of passwords in the file an error is thrown. String n/a No
type Acceptable characters in the generated password One of: Alpha, AlphaNumeric, ASCII AlphaNumeric No

Example for 4 Alphabetic only passwords that are 6 to 8 characters long:

<var name="foo" generator="password">
  <param name="count">4</param>
  <param name="length">6:8</param>
  <param name="type">Alpha</param>
</var>

ssh_key

This generator produces ssh keypairs. It expands the variable in the following way assuming the variable name of "foo"

  • foo_public
  • foo_private

When using count > 1 all produced variables will be arrays.

Parameter Description Values Default Required
count The number of pairs to produceIntegers >01 No
password A password to encrypt the private key with String n/a no

Example for a key pair encrypted with the password "foo":

<var name="bar" generator="ssh_key">
  <param name="password">foo</param>
</var>

username

This generator produces first names, last names, and usernames from a csv file. The csv is expected to be of the form: first, last, username and be located in the scenario base directory. If the csv does not have enough values in it to satisfy the count parameter the OccpAdmin program will stop and will require you to add more entries or reduce the count. Otherwise it will randomly pick lines from the csv and place them in occp variables as follows assuming the variable specified was "foo"

  • foo for the username
  • foo_first for the first name
  • foo_last for the last name

When using count > 1 all produced variables will be arrays.

Parameter Description Values Default Required
count The number of usernames to produceIntegers > 01 No
namesA CSV file with possible names to draw fromString n/a yes

Example for generating 30 usernames from "myNamesList.csv" located in my scenario directory:

<var name="foo" generator="username">
  <param name="count">30</param>
  <param name="names">myNameList.csv</param>
</var>

random

This generator produces a random number between the min and max parameters, inclusive. It has the range of a standard Java int.

Parameter Description Values Default Required
minThe lower boundIntegers0 No
maxThe upper boundIntegers n/a yes

An example usage would be to generate part of an IP address:

<var name="lastOctet" generator="random"> 
  <param name="min">1</param>
  <param name="max">254</param>
</var>
<var name="ip">192.168.0.${occp:lastOctet}</var>