GeneratePassword

This function generates a password and allows various parameters to customize the properties of the password depending on the use case (e.g. password complexity requirements). The default behavior is to generate a password of *random length* including all four character classes (upper, lower, digits, symbols) with at least five and at most ten characters per class. The min_* values all default to 0. This means that if the command is executed in this way: !GeneratePassword max_lcase=10 It is possible that a password of length zero could be generated. It is therefore recommended to always include a min_* parameter that matches. The debug parameter will print certain properties of the command into the WarRoom for easy diagnostics.

python · Common Scripts

Details

IDGeneratePassword
Languagepython
From Version5.0.0
Docker Imagedemisto/python3:3.12.13.10404775
TagsUtility

README

Generates a password and allows various parameters to customize the properties of the password depending on the use case. For example, “password complexity requirements”. The default behavior is to generate a password of random length including all four character classes, upper, lower, digits, and symbols, with at least five and at most ten characters per class.

The min_* values all default to 0.

This means that if the command is executed in this way:
!GeneratePassword max_lcase=10
It is possible that a password of length zero could be generated. It is therefore recommended to always include a min_* parameter that matches.

The debug parameter will print certain properties of the command into the War Room for easy diagnostics.

Script Data


Name Description
Script Type python
Tags Utility

Inputs


Argument Name Description
min_lcase The minimum number of lower case characters to include in password.
max_lcase The maximum number of lower case characters to include in password.
min_ucase The minimum number of upper case characters to include in password.
max_ucase The maximum number of upper case characters to include in password.
min_digits The minimum number of digits to include in password.
max_digits The maximum number of digits to include in password.
min_symbols The minimum number of symbols to include in password.
max_symbols The maximum number of symbols to include in password.
debug Sees various values as they pass through the function if enabled.

Note:
At least one of the following arguments should be above 0: min_uppercase, min_lowercase, min_digits, min_symbols

Outputs


Path Description Type
NEW_PASSWORD The new password generated for the user. Unknown
commonfields:
  id: GeneratePassword
  version: -1
name: GeneratePassword
script: ''
type: python
subtype: python3
dockerimage: demisto/python3:3.12.13.10404775
tags:
- Utility
comment: "This function generates a password and allows various parameters to customize the properties of the password depending on the use case (e.g. password complexity requirements).  The default behavior is to generate a password of  *random length* including all four character classes (upper, lower, digits, symbols) with at least five and at most ten characters per class. \n\nThe min_* values all default to 0. This means that if the command is executed in this way:\n!GeneratePassword max_lcase=10\nIt is possible that a password of length zero could be generated. It is therefore recommended to always include a min_* parameter that matches. \n\nThe debug parameter will print certain properties of the command into the WarRoom for easy diagnostics."
enabled: true
args:
- name: min_lcase
  description: Minimum number of lower case characters to include in password.
  defaultValue: "0"
- name: max_lcase
  description: Maximum number of lower case characters to include in password.
  defaultValue: "10"
- name: min_ucase
  description: Minimum number of upper case characters to include in password.
  defaultValue: "0"
- name: max_ucase
  description: Maximum number of upper case characters to include in password.
  defaultValue: "10"
- name: min_digits
  description: Minimum number of digits to include in password.
  defaultValue: "0"
- name: max_digits
  description: Maximum number of digits to include in password.
  defaultValue: "10"
- name: min_symbols
  description: Minimum number of symbols to include in password.
  defaultValue: "0"
- name: max_symbols
  description: Maximum number of symbols to include in password.
  defaultValue: "10"
- name: debug
  auto: PREDEFINED
  predefined:
  - "true"
  - "false"
  description: Enable to see various values as they pass through the function.
  defaultValue: "false"
outputs:
- contextPath: NEW_PASSWORD
  description: The new password generated for the user.
scripttarget: 0
fromversion: 5.0.0
tests:
- No tests (auto formatted)