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 details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded Python 3

File details

Details for the file tokenish-0.1.tar.gz.

File metadata

  • Download URL: tokenish-0.1.tar.gz
  • Upload date:
  • Size: 8.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for tokenish-0.1.tar.gz
Algorithm Hash digest
SHA256 2431435c8c5dd3d7f10eedc2f4025e622bb21466a0718296dfd03c4c5b228508
MD5 6b5fc494a679e8e2681e2c66687c2e96
BLAKE2b-256 6e839f9e9997d33fa702ad62aa2d9247c313c389c0a0085783dcbdf0d37ce786

See more details on using hashes here.

File details

Details for the file tokenish-0.1-py3-none-any.whl.

File metadata

  • Download URL: tokenish-0.1-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for tokenish-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ff943e443f3675cbe16fbb985bf46d9bd3b07acdd4e6253507ccccb763665485
MD5 a3079026e2792b49b6d648f42f68d180
BLAKE2b-256 9b4c562f6792d6e116f7062da02572c274e37fe69a5211275c95f35357bd4008

See more details on using hashes here.

Supported by

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