Skip to main content

A simple tool to fill pattern with tokens from file or directory.

Project description

tokenish

Code Coverage License: MIT

A simple tool to fill pattern with tokens from file or directory.

Installation

pip install tokenish

How to use

usage: tokenish [-h] [-t TOKENS [TOKENS ...]] [-e ENCODING] [-o OUTPUT_DIRECTORY] [-om MAX_FILE_ROWS] pattern

Generate rows from pattern for each token combinations

positional arguments:
  pattern               text to fill with links or usernames/passwords

optional arguments:
  -h, --help            show this help message and exit
  -t TOKENS [TOKENS ...], --tokens TOKENS [TOKENS ...]
                        list of tokens file or directory path
  -e ENCODING, --encoding ENCODING
                        type of encoding to apply
  -o OUTPUT_DIRECTORY, --output-directory OUTPUT_DIRECTORY
                        directory where results will write, print is None
  -om MAX_FILE_ROWS, --max-file-rows MAX_FILE_ROWS
                        maximum number of rows per file, default 10 000

Available token paths:

  • file: all lines in file are consider like tokens.
  • directory: all lines of all files in directory are consider like tokens.

Each token paths should have an associated token in pattern. For example, if two token paths are defined, pattern should contain &TOKEN_0& and &TOKEN_1&.

Available encodings:

  • base64

The pattern part to encode must be in the following tag:

&ENC[to encode]ODE&

Example

Let's consider the /tokens directory with the following tree structure:

.
├── passwords
│   └── passwords_1.txt
└── usernames
    ├── usernames_1.txt
    └── usernames_2.txt

Content of usernames_1.txt:

admin
root
user

Content of usernames_2.txt:

user1
user2

Content of passwords_1.txt:

1234
6712

The command:

tokenish "Authorization: Basic &TOKEN_0&:&TOKEN_1&" -t usernames/ passwords/passwords_1.txt

Print:

Authorization: Basic admin:1234
Authorization: Basic admin:6712
Authorization: Basic root:1234
Authorization: Basic root:6712
Authorization: Basic user:1234
Authorization: Basic user:6712
Authorization: Basic user1:1234
Authorization: Basic user1:6712
Authorization: Basic user2:1234
Authorization: Basic user2:6712

You can add an encoding like:

tokenish "Authorization: Basic &ENC[&TOKEN_0&:&TOKEN_1&]ODE&" -t usernames/ passwords/passwords_1.txt -e base64

Print:

Authorization: Basic YWRtaW46MTIzNA==
Authorization: Basic YWRtaW46NjcxMg==
Authorization: Basic cm9vdDoxMjM0
Authorization: Basic cm9vdDo2NzEy
Authorization: Basic dXNlcjoxMjM0
Authorization: Basic dXNlcjo2NzEy
Authorization: Basic dXNlcjE6MTIzNA==
Authorization: Basic dXNlcjE6NjcxMg==
Authorization: Basic dXNlcjI6MTIzNA==
Authorization: Basic dXNlcjI6NjcxMg==

Commands

Print all combination of username/password, where usernames replace &TOKEN_0& and passwords replace &TOKEN_1&.

tokenish "Authorization: Basic &TOKEN_0&:&TOKEN_1&" -t /path/to/usernames/dir/ /path/to/passwords.txt

Save all combination of username/password in directory /path/output/ composed by files of 10 000 lines.

tokenish "Authorization: Basic &TOKEN_0&:&TOKEN_1&" -t /path/to/usernames/dir/ /path/to/passwords.txt -o /path/output/

Save all combination of username/password in directory /path/output/ composed by files of 500 lines.

tokenish "Authorization: Basic &TOKEN_0&:&TOKEN_1&" -t /path/to/usernames/dir/ /path/to/passwords.txt -o /path/output/ -om 500

Print all combination of username/password, where usernames replace &TOKEN_0& and passwords replace &TOKEN_1&. Expression in tag &ENC[...]ODE& will encode in base64.

tokenish "Authorization: Basic &ENC[&TOKEN_0&:&TOKEN_1&]ODE&" -t /path/to/usernames/dir/ /path/to/passwords.txt -e base64

License

tokenish is released under MIT license. See LICENSE.

Tests

Run these commands to run tests and update coverage badge:

pip install readme-coverage-badger
coverage run -m --omit "/usr/local/*,/usr/lib/*,tests/*,venv/*" unittest discover tests/tokenish
readme-cov

Changelog

All notable changes to this project will be documented in this file.

Log types:

  • added for new features.
  • changed for changes in existing functionality.
  • fixed for any bug fixes.
  • removed for features removed in this release.
  • security to invite users to upgrade in case of vulnerabilities.

[Unreleased]

Added

changed

Fixed

removed

security

0.1 - 2023/03/02

Added

  • Initial release

MIT License

Copyright (c) 2023 Victor Meyer

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tokenish-0.1.tar.gz (8.3 kB view hashes)

Uploaded Source

Built Distribution

tokenish-0.1-py3-none-any.whl (7.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page