ttpassgen


Namettpassgen JSON
Version 1.1.3 PyPI version JSON
download
home_pagehttps://github.com/tp7309/TTPassGen
SummaryA highly flexiable and scriptable password dictionary generator.
upload_time2023-10-30 13:46:48
maintainer
docs_urlNone
authortp7309
requires_python
licenseApache License Version 2.0
keywords ttpassgen crunch password-generator wordlist password-dict password-dict-generator brute-force word-combination
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            # TTPassGen

[![build](https://github.com/tp7309/TTPassGen/actions/workflows/build.yaml/badge.svg)](https://github.com/tp7309/TTPassGen/actions/workflows/build.yaml)
[![codecov](https://codecov.io/gh/tp7309/TTPassGen/branch/master/graph/badge.svg?token=lyEWTqfeb9)](https://codecov.io/gh/tp7309/TTPassGen)
[![DeepSource](https://deepsource.io/gh/tp7309/TTPassGen.svg/?label=active+issues&show_trend=true)](https://deepsource.io/gh/tp7309/TTPassGen/?ref=repository-badge)
[![Rawsec's CyberSecurity Inventory](https://inventory.raw.pm/img/badges/Rawsec-inventoried-FF5050_flat.svg)](https://inventory.raw.pm/tools.html#TTPassGen)
[![BlackArch package](https://repology.org/badge/version-for-repo/blackarch/ttpassgen.svg)](https://repology.org/project/ttpassgen/versions)

TTPassGen is a highly flexible and scriptable password dictionary generator base on Python, you can easily use various rules to generate the desired combination of words.

README i18n: [中文说明](https://github.com/tp7309/TTPassGen/blob/master/README_zh_CN.md)

# Features

- generate password use combination、permulation、conditional rules and so on.
- support all characters or words(from wordlist option) that can make up a password, some built-in charset has been provided, such as lowercase letter list and numeric list.
- you can specify the order and frequency of each element in the password.
- simple rule format, and easy to use, rule could be defined similar regex's style.
- time-consuming estimate, output size estimate, and progress report.
- unicode word support by using wordlist option.
- generation of large amount of passwords at once, no output size limit.
- support split output by file size.

# Install

`TTPassGen` can be easily installed using pip:

```
pip install ttpassgen
```

# Requirements

Python 3.5 or later. if you are using windows, you could just use the [release version](https://github.com/tp7309/TTPassGen/releases), no need python environment.

# Quick Start

> Switch to the project's `ttpassgen` directory if you want use ttpassgen by downloaded source code.

Example: Generate word list and output to `out.txt`, the word start with numbers, only allow 1、2、3, appear 2 or 3 times, end with `xyz`.

```
ttpassgen -r '[123]{2:3}xyz' out.txt
```

Done.

# Options

```
C:\Users\tp730>ttpassgen --help
Usage: ttpassgen [OPTIONS] OUTPUT
Options:
  -m, --mode INTEGER             generation mode:

                                 0 = combination rule mode
                                 [default: 0]
  -d, --dictlist TEXT            read wordlist from the file, multi files
                                 should by seperated by comma.
  -r, --rule TEXT                define word format, $0 means refer first
                                 file in dictlist option, some built-in char arrays:

                                 ?l = abcdefghijklmnopqrstuvwxyz
                                 ?u = ABCDEFGHIJKLMNOPQRSTUVWXYZ
                                 ?d = 0123456789
                                 ?s = !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~
                                 ?a = ?l?u?d?s
                                 ?q = ]

                                 example: [?dA]{1:2}$0
                                 view *RuleTypes* section for more information.
                                 [default: '']
  -c, --dict_cache INTEGER       each element in 'dictlist' option represents
                                 a dict file path, this option define the
                                 maximum amount of memory(MB) that can be used,
                                 increasing this value when the file is large
                                 may increase the build speed.  [default: 500]
  -g, --global_repeat_mode TEXT  global repeat mode, the value is used when the repeat mode of rule is not specified:

                                 ? = 0 or 1 repetitions
                                 * = 0 or more repetitions
                                 [default: ?]
  -p, --part_size INTEGER        when result data is huge, split package
                                 size(MB) will be applied, 0 is unlimited.
                                 [default: 0]
  -a, --append_mode INTEGER      whether append content to OUTPUT or not.
                                 [default: 0]
  -s, --seperator TEXT           wword seperator for output file, by default, Mac/Linudx: \n, Windows: \r\n".
                                 [default: Mac/Linux: \n, Windows: \r\n]
  --inencoding TEXT              dict file encoding.
  --outencoding TEXT             output file encoding.  [default: utf-8]
  --help                         Show this message and exit.
```

The output file uses `utf-8` encoding by default, it is recommended to use _Notepad++_ to open this file.

# RuleTypes

**TTPassGen** supports three rule type, which can specified with the `--rule` option, you can use these rules at the same time.

## CharArrayRule

Generate a word based on the defined char array and repeat information.
Rule format:

```
[]{min_repeat:max_repeat:repeat_mode}
```

### CharArray

Use **[]** to wrap all chars.

Built-in char arrays:

```
//lowercase letters
?l = abcdefghijklmnopqrstuvwxyz

//Uppercase letters
?u = ABCDEFGHIJKLMNOPQRSTUVWXYZ

//Number list
?d = 0123456789

//Special character list
?s = !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~

//A collection of the above list
?a = ?l?u?d?s

//']', chars are wrapped with '[]', so if what put ']' into '[]', use '?q' instead of ']'.
?q = ]
```

For example, **[?d]** means to select char from number list.

### RepeatFormat

```
{min_repeat:max_repeat:repeat_mode}
```

For `CharArrayRule`, repeat times is the length of the word to be generated.

- `min_repeat`
  minimum repeat times
- `max_repeat`
  maximum repeat times
- `repeat_mode`
  char repeat mode

Define rule similar regex's style:

**[]** 1 repetitions.
`[123] -> 1 2 3`

**[]?** 0 or 1 repetitions.
`[123]? -> '' 1 2 3`

**[]{m:n:r}** repeat `m` to `n` times.
Repeat mode support `?` and `*`.

- repeatMode is '?', each char appears 0 or 1 times in word.

  `[123]{1:2:?} -> 1 2 3 12 13 21 23 31 32`

- repeatMode is '\*', each char appears 0 or more times in word.

  `[123]{1:2:*} -> 1 2 3 11 12 13 21 22 23 31 32 33`

Short rule format:

- **[]{m:n}**

  same as `[]{m:n:global_repeat_mode}`

- **[]{n}**

  same as `[]{n:n:global_repeat_mode}`

- **[]{n:r}**

  same as `[]{n:n:r}`

### Example

Generate 8-digit numeric password:

```
[?d]{8:8:*} or [?d]{8:*} or [1234567890]{8:8:*}
```

Generate an 8-digit numeric password, and each char in the password can appear at most once. Because the default value of `global repeat mode` is '?', so you can skip set repeat_mode:

```
[?d]{8:8:?} or [?d]{8}
```

Generate a password of 7 to 8 digits in length. The word can be composed of upper and lower case letters, numbers, and `_`:

```
[?l?u?d_]{7:8:*}
```

Use characters 1, 2, and 3 to generate a 4-digit password, and each character can appear at most once in each word:

```
[123]{4}  //Error! the length of word cannot be greater than the char array size.
[123]{2}[123]{2}  //Correct.
```

## StringArrayRule

Generate a word based on the defined string array and repeat information.
Rule format:

- `$(string1,string2){min_repeat:max_repeat:repeat_mode}`

  String array, each string is splited by comma, no spaces.

- `string`

  Normal string, same as `$(string){1:1:?}`.

Like `CharArrayRule`, but `StringArrayRule` does not support `Short rule format`.

### Example

Generate an 8-digit numeric password, end with `abc`:

```
[?d]{8:8:*}abc
```

Choose a number from (10,20,30), then append it after 'age':

```
age$(10,20,30){1:1:?}
```

Choose a number from (10,20,30), then append it after 'age', end with 'x' or 'y':

```
age$(10,20,30){1:1:?}[xy]
```

## DictRule

Read string from file(txt file). The dictionary file path can be specified by the `--dictlist` option. For example,`$0` means to refer 0th dictionary file.

Rule format:

```
$index
```

`DictRule` not support repeat mode.

### Example

content of `in.txt`:

```
ab
cd
```

content of `in2.txt`:

```
12
34
```

When `--dictlist` option defined as `in.txt,in2.txt` and _seperator_ is one space, run following command:

```diff
- IMPORTANT
```

```bash
# use single quotes
ttpassgen --dictlist "in.txt,in2.txt" --rule '$0[_]?$1' -s " " out.txt
# OR in Linux
ttpassgen --dictlist "in.txt,in2.txt" --rule "\$0[_]?\$1" -s " " out.txt
# OR in PowerShell
ttpassgen --dictlist "in.txt,in2.txt" --rule "`$0[_]?`$1" -s " " out.txt
```

Output:

```
ab12 ab34 ab_12 ab_34 cd12 cd34 cd_12 cd_34
```

## Donate

Buy a cup of coffee for me (Scan by wechat):

![qrcode](https://user-images.githubusercontent.com/5046191/118354036-b075ca80-b59b-11eb-862e-ffd1b8e1659f.png)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/tp7309/TTPassGen",
    "name": "ttpassgen",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "ttpassgen crunch password-generator wordlist password-dict password-dict-generator brute-force word-combination",
    "author": "tp7309",
    "author_email": "yiyou7309@gmail.com",
    "download_url": "",
    "platform": null,
    "description": "# TTPassGen\n\n[![build](https://github.com/tp7309/TTPassGen/actions/workflows/build.yaml/badge.svg)](https://github.com/tp7309/TTPassGen/actions/workflows/build.yaml)\n[![codecov](https://codecov.io/gh/tp7309/TTPassGen/branch/master/graph/badge.svg?token=lyEWTqfeb9)](https://codecov.io/gh/tp7309/TTPassGen)\n[![DeepSource](https://deepsource.io/gh/tp7309/TTPassGen.svg/?label=active+issues&show_trend=true)](https://deepsource.io/gh/tp7309/TTPassGen/?ref=repository-badge)\n[![Rawsec's CyberSecurity Inventory](https://inventory.raw.pm/img/badges/Rawsec-inventoried-FF5050_flat.svg)](https://inventory.raw.pm/tools.html#TTPassGen)\n[![BlackArch package](https://repology.org/badge/version-for-repo/blackarch/ttpassgen.svg)](https://repology.org/project/ttpassgen/versions)\n\nTTPassGen is a highly flexible and scriptable password dictionary generator base on Python, you can easily use various rules to generate the desired combination of words.\n\nREADME i18n: [\u4e2d\u6587\u8bf4\u660e](https://github.com/tp7309/TTPassGen/blob/master/README_zh_CN.md)\n\n# Features\n\n- generate password use combination\u3001permulation\u3001conditional rules and so on.\n- support all characters or words(from wordlist option) that can make up a password, some built-in charset has been provided, such as lowercase letter list and numeric list.\n- you can specify the order and frequency of each element in the password.\n- simple rule format, and easy to use, rule could be defined similar regex's style.\n- time-consuming estimate, output size estimate, and progress report.\n- unicode word support by using wordlist option.\n- generation of large amount of passwords at once, no output size limit.\n- support split output by file size.\n\n# Install\n\n`TTPassGen` can be easily installed using pip:\n\n```\npip install ttpassgen\n```\n\n# Requirements\n\nPython 3.5 or later. if you are using windows, you could just use the [release version](https://github.com/tp7309/TTPassGen/releases), no need python environment.\n\n# Quick Start\n\n> Switch to the project's `ttpassgen` directory if you want use ttpassgen by downloaded source code.\n\nExample: Generate word list and output to `out.txt`, the word start with numbers, only allow 1\u30012\u30013, appear 2 or 3 times, end with `xyz`.\n\n```\nttpassgen -r '[123]{2:3}xyz' out.txt\n```\n\nDone.\n\n# Options\n\n```\nC:\\Users\\tp730>ttpassgen --help\nUsage: ttpassgen [OPTIONS] OUTPUT\nOptions:\n  -m, --mode INTEGER             generation mode:\n\n                                 0 = combination rule mode\n                                 [default: 0]\n  -d, --dictlist TEXT            read wordlist from the file, multi files\n                                 should by seperated by comma.\n  -r, --rule TEXT                define word format, $0 means refer first\n                                 file in dictlist option, some built-in char arrays:\n\n                                 ?l = abcdefghijklmnopqrstuvwxyz\n                                 ?u = ABCDEFGHIJKLMNOPQRSTUVWXYZ\n                                 ?d = 0123456789\n                                 ?s = !\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~\n                                 ?a = ?l?u?d?s\n                                 ?q = ]\n\n                                 example: [?dA]{1:2}$0\n                                 view *RuleTypes* section for more information.\n                                 [default: '']\n  -c, --dict_cache INTEGER       each element in 'dictlist' option represents\n                                 a dict file path, this option define the\n                                 maximum amount of memory(MB) that can be used,\n                                 increasing this value when the file is large\n                                 may increase the build speed.  [default: 500]\n  -g, --global_repeat_mode TEXT  global repeat mode, the value is used when the repeat mode of rule is not specified:\n\n                                 ? = 0 or 1 repetitions\n                                 * = 0 or more repetitions\n                                 [default: ?]\n  -p, --part_size INTEGER        when result data is huge, split package\n                                 size(MB) will be applied, 0 is unlimited.\n                                 [default: 0]\n  -a, --append_mode INTEGER      whether append content to OUTPUT or not.\n                                 [default: 0]\n  -s, --seperator TEXT           wword seperator for output file, by default, Mac/Linudx: \\n, Windows: \\r\\n\".\n                                 [default: Mac/Linux: \\n, Windows: \\r\\n]\n  --inencoding TEXT              dict file encoding.\n  --outencoding TEXT             output file encoding.  [default: utf-8]\n  --help                         Show this message and exit.\n```\n\nThe output file uses `utf-8` encoding by default, it is recommended to use _Notepad++_ to open this file.\n\n# RuleTypes\n\n**TTPassGen** supports three rule type, which can specified with the `--rule` option, you can use these rules at the same time.\n\n## CharArrayRule\n\nGenerate a word based on the defined char array and repeat information.\nRule format\uff1a\n\n```\n[]{min_repeat:max_repeat:repeat_mode}\n```\n\n### CharArray\n\nUse **[]** to wrap all chars.\n\nBuilt-in char arrays:\n\n```\n//lowercase letters\n?l = abcdefghijklmnopqrstuvwxyz\n\n//Uppercase letters\n?u = ABCDEFGHIJKLMNOPQRSTUVWXYZ\n\n//Number list\n?d = 0123456789\n\n//Special character list\n?s = !\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~\n\n//A collection of the above list\n?a = ?l?u?d?s\n\n//']', chars are wrapped with '[]', so if what put ']' into '[]', use '?q' instead of ']'.\n?q = ]\n```\n\nFor example, **[?d]** means to select char from number list.\n\n### RepeatFormat\n\n```\n{min_repeat:max_repeat:repeat_mode}\n```\n\nFor `CharArrayRule`, repeat times is the length of the word to be generated.\n\n- `min_repeat`\n  minimum repeat times\n- `max_repeat`\n  maximum repeat times\n- `repeat_mode`\n  char repeat mode\n\nDefine rule similar regex's style:\n\n**[]** 1 repetitions.\n`[123] -> 1 2 3`\n\n**[]?** 0 or 1 repetitions.\n`[123]? -> '' 1 2 3`\n\n**[]{m:n:r}** repeat `m` to `n` times.\nRepeat mode support `?` and `*`.\n\n- repeatMode is '?', each char appears 0 or 1 times in word.\n\n  `[123]{1:2:?} -> 1 2 3 12 13 21 23 31 32`\n\n- repeatMode is '\\*', each char appears 0 or more times in word.\n\n  `[123]{1:2:*} -> 1 2 3 11 12 13 21 22 23 31 32 33`\n\nShort rule format:\n\n- **[]{m:n}**\n\n  same as `[]{m:n:global_repeat_mode}`\n\n- **[]{n}**\n\n  same as `[]{n:n:global_repeat_mode}`\n\n- **[]{n:r}**\n\n  same as `[]{n:n:r}`\n\n### Example\n\nGenerate 8-digit numeric password:\n\n```\n[?d]{8:8:*} or [?d]{8:*} or [1234567890]{8:8:*}\n```\n\nGenerate an 8-digit numeric password, and each char in the password can appear at most once. Because the default value of `global repeat mode` is '?', so you can skip set repeat_mode:\n\n```\n[?d]{8:8:?} or [?d]{8}\n```\n\nGenerate a password of 7 to 8 digits in length. The word can be composed of upper and lower case letters, numbers, and `_`:\n\n```\n[?l?u?d_]{7:8:*}\n```\n\nUse characters 1, 2, and 3 to generate a 4-digit password, and each character can appear at most once in each word:\n\n```\n[123]{4}  //Error! the length of word cannot be greater than the char array size.\n[123]{2}[123]{2}  //Correct.\n```\n\n## StringArrayRule\n\nGenerate a word based on the defined string array and repeat information.\nRule format\uff1a\n\n- `$(string1,string2){min_repeat:max_repeat:repeat_mode}`\n\n  String array, each string is splited by comma, no spaces.\n\n- `string`\n\n  Normal string, same as `$(string){1:1:?}`.\n\nLike `CharArrayRule`, but `StringArrayRule` does not support `Short rule format`.\n\n### Example\n\nGenerate an 8-digit numeric password, end with `abc`:\n\n```\n[?d]{8:8:*}abc\n```\n\nChoose a number from (10,20,30), then append it after 'age':\n\n```\nage$(10,20,30){1:1:?}\n```\n\nChoose a number from (10,20,30), then append it after 'age', end with 'x' or 'y':\n\n```\nage$(10,20,30){1:1:?}[xy]\n```\n\n## DictRule\n\nRead string from file(txt file). The dictionary file path can be specified by the `--dictlist` option. For example,`$0` means to refer 0th dictionary file.\n\nRule format:\n\n```\n$index\n```\n\n`DictRule` not support repeat mode.\n\n### Example\n\ncontent of `in.txt`:\n\n```\nab\ncd\n```\n\ncontent of `in2.txt`:\n\n```\n12\n34\n```\n\nWhen `--dictlist` option defined as `in.txt,in2.txt` and _seperator_ is one space, run following command\uff1a\n\n```diff\n- IMPORTANT\n```\n\n```bash\n# use single quotes\nttpassgen --dictlist \"in.txt,in2.txt\" --rule '$0[_]?$1' -s \" \" out.txt\n# OR in Linux\nttpassgen --dictlist \"in.txt,in2.txt\" --rule \"\\$0[_]?\\$1\" -s \" \" out.txt\n# OR in PowerShell\nttpassgen --dictlist \"in.txt,in2.txt\" --rule \"`$0[_]?`$1\" -s \" \" out.txt\n```\n\nOutput:\n\n```\nab12 ab34 ab_12 ab_34 cd12 cd34 cd_12 cd_34\n```\n\n## Donate\n\nBuy a cup of coffee for me (Scan by wechat)\uff1a\n\n![qrcode](https://user-images.githubusercontent.com/5046191/118354036-b075ca80-b59b-11eb-862e-ffd1b8e1659f.png)\n",
    "bugtrack_url": null,
    "license": "Apache License Version 2.0",
    "summary": "A highly flexiable and scriptable password dictionary generator.",
    "version": "1.1.3",
    "project_urls": {
        "Homepage": "https://github.com/tp7309/TTPassGen"
    },
    "split_keywords": [
        "ttpassgen",
        "crunch",
        "password-generator",
        "wordlist",
        "password-dict",
        "password-dict-generator",
        "brute-force",
        "word-combination"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "61b42ea9487322602d0e05b0d6a15dbce725e3350c224dac85f750bae03875fc",
                "md5": "4ef26254250676b0d18f080a20a85897",
                "sha256": "845d79884bd629a96923a0a88bb4e6bcb6ffa7fe4b053b1ed02c63261cf2d090"
            },
            "downloads": -1,
            "filename": "ttpassgen-1.1.3-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "4ef26254250676b0d18f080a20a85897",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 15263,
            "upload_time": "2023-10-30T13:46:48",
            "upload_time_iso_8601": "2023-10-30T13:46:48.985620Z",
            "url": "https://files.pythonhosted.org/packages/61/b4/2ea9487322602d0e05b0d6a15dbce725e3350c224dac85f750bae03875fc/ttpassgen-1.1.3-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-10-30 13:46:48",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "tp7309",
    "github_project": "TTPassGen",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "requirements": [],
    "lcname": "ttpassgen"
}
        
Elapsed time: 2.54086s