PPA Tools PPA Tools: Generate

Summary

This module contains actions used to generate table data & passwords.

Actions

ppa_tools.generate.

dictionary_password

Generate a password containing 1 or more dictionary words.

Minimum Plugin Version: 2.0.0

Input
  • length: the length of the generated password (defaults to 15)

  • word_count: the number of words the password should consist of (defaults to 3)

  • valid_word_lengths: a list of valid word lengths (defaults to 3-8)

Output

A dictionary containing the generated password in the following cases:

lower: lower case upper: upper case title: title case

Example

Generating a 20 character password consisting of 4 words.

1
2
3
4
- ppa_tools.generate.dictionary_password:
    length: 20
    word_count: 4
  save: generated_password

ppa_tools.generate.

dictionary_password_interactive

Interactively generate a password containing 1 or more dictionary words.

Each time a password is generated, the Task Operator will be given the choice to:

  • Use Password
  • Generate Another

The process can be repeated as many times as needed.

Minimum Plugin Version: 2.0.0

Remember

Each generated password will be displayed to the Task Operator in a markdown document.

Input
  • length: the length of the generated password (defaults to 15)

  • word_count: the number of words the password should consist of (defaults to 3)

  • valid_word_lengths: a list of valid word lengths (defaults to 3-8)

  • case: the case (lower, upper, title) to output the password in (defaults to lower)

  • title: a title displayed to the Task Operator (defaults to Generated Password)

Output

The generated password in the case chosen by the case input.

Example

Generating an upper case password using the default word_count & length:

1
2
3
- ppa_tools.generate.dictionary_password_interactive:
    case: upper
  save: generated_password

ppa_tools.generate.

html_table

Generate an HTML table to use in a markdown document or email.

Minimum Plugin Version: 1.2.0

Input
  • header: a list of table column headers

  • rows: the table contents as a list of lists, where each inner list is a row of values

Output

The generated HTML table as a string.

Example
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
- ppa_tools.html.generate_table:
    header:
      - City
      - Country
    rows:
      - - Paris
        - France
      - - London
        - England
  save: html_table

ppa_tools.generate.

regex_password

Generate a password based on a regular expression.

Minimum Plugin Version: 1.0.0

Input
  • regex: a regular expression containing a set of characters (defaults to [A-Za-z0-9-£\:\$#\%\&\^])

  • length: the length of the generated password (defaults to 15)

Output

The generated password as a string.

Example

Generating a 20 character password using the default character set.

1
2
3
- ppa_tools.generate.regex_password:
    length: 20
  save: generated_password

ppa_tools.generate.

table_from_dictionaries

Generate table data from a list of dictionaries.

Minimum Plugin Version: 1.3.0

Input
  • header: a list of table column headers

  • keys: a list of corresponding dictionary keys, one for each header

  • dictionaries: a list of dictionaries to get the values of each key from

Output

A dictionary containing the keys header & rows.

Example
  • Finding failed SSH logons using extract_values & saving them as failed_logons

  • Using this action to turn failed_logons into table data, & saving it as failed_logons_table

  • Displaying a table using the data generated by this action

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
- ppa_tools.text.extract_values:
    extract:
      - name: username
        expression: for (.*) from
      - name: ip_address
        expression: from (\d+\.\d+\.\d+\.\d+) port
    text: >
      2020-08-11T08:19:40.463248+00:00 machine-name sshd[10349]: Failed password for user_1 from 1.2.3.4 port 58041 ssh2
      2020-08-12T13:24:07.463248+00:00 machine-name sshd[10349]: Failed password for user_2 from 2.3.4.5 port 58041 ssh2
  save: failed_logons

- ppa_tools.generate.table_from_dictionaries:
    header:
      - Username
      - IP Address
    keys:
      - username
      - ip_address
  load:
    dictionaries: failed_logons
  save: failed_logons_table

- ppa.ui.output_table:
    text: Failed SSH Logons
  load:
    header: failed_logons_table.header
    rows: failed_logons_table.rows

Headers & Keys

The header & keys lists must be the same length, & the attributes must be in the same order.

If a supplied key is missing from a dictionary, its value will be blank.