{"id":23276712,"url":"https://github.com/shoriwe/bftool","last_synced_at":"2025-04-06T11:47:05.381Z","repository":{"id":54389682,"uuid":"255229438","full_name":"shoriwe/bftool","owner":"shoriwe","description":"A custom worker pool to handle the distribution of function between threads and processes","archived":false,"fork":false,"pushed_at":"2021-02-21T14:38:51.000Z","size":253,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-12T17:33:01.123Z","etag":null,"topics":["concurrency","module","multiprocessing","multithreading","package","parallel-computing","parallelism","python"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/bftool-pkg-sulcud/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shoriwe.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-04-13T04:17:26.000Z","updated_at":"2021-02-21T14:38:49.000Z","dependencies_parsed_at":"2022-08-13T14:10:53.499Z","dependency_job_id":null,"html_url":"https://github.com/shoriwe/bftool","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shoriwe%2Fbftool","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shoriwe%2Fbftool/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shoriwe%2Fbftool/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shoriwe%2Fbftool/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shoriwe","download_url":"https://codeload.github.com/shoriwe/bftool/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247478304,"owners_count":20945264,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["concurrency","module","multiprocessing","multithreading","package","parallel-computing","parallelism","python"],"created_at":"2024-12-19T21:36:15.143Z","updated_at":"2025-04-06T11:47:05.354Z","avatar_url":"https://github.com/shoriwe.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# bftool\n[![Pypi](https://img.shields.io/badge/Pypi-Yes-blue.svg)](https://pypi.org/project/bftool-pkg-sulcud/)\n[![PyPI version](https://badge.fury.io/py/bftool-pkg-sulcud.svg)](https://pypi.org/project/bftool-pkg-sulcud/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/shoriwe/bftool/blob/master/LICENSE)\n[![Downloads](https://img.shields.io/pypi/dd/bftool-pkg-sulcud?color=green)](https://pypi.org/project/bftool-pkg-sulcud/)\n\n![Logo](https://raw.githubusercontent.com/shoriwe/bftool/master/logo/logo_size_invert.jpg)\n\n## Index\n\n- [Index](#index)\n- [Description](#description)\n- [Quick example](#quick-example)\n    - [As a module](#as-a-module)\n    - [As a script](#as-a-script)\n- [Installation](#installation)\n\n## Description\n`bftool` is a python module and script, with a custom worker pool for the distribution of function execution into processes and threads based on a initial input, so you only need to focus on the functionality and not in the distribution of its execution.\n\n## Concepts\n### Time consuming functions\nIn the context of `bftool` the weight of a function is based on the time spent from when it was called to its finish.\n\nBased on that we can conclude that this operations are most of the time heavy, since usually require more time to finish:\n \n- File I/O.\n- Networking I/O.\n- N Cycles (FOR, WHILE, ...).\n- Force waits (like `sleep`).\n\nAnd this operations are usually light\n\n- Math.\n- Variable assign to a known value.\n- Some hash calculations.\n\n## Quick example\n\n### As a module\n\n`bftool` auto detects if the function requires or not parallelism and based on that spawn the workers.\n\n```python\nimport hashlib\nimport string\n\nimport bftool\n\nsecret = \"zz\"\ntarget = hashlib.sha3_512(secret.encode()).hexdigest()\n\n\ndef calc_hashes(salt: str, raw_password: str) -\u003e tuple[str, str, str, str]:\n    salt_password = (salt + raw_password).encode()\n    return salt, raw_password, hashlib.blake2b(salt_password).hexdigest(), hashlib.sha3_512(\n        salt_password).hexdigest()\n\n\ndef cracked(hashes: tuple[str, str, str, str]) -\u003e bool:\n    return target in hashes[2:]\n\n\ndef success(result: tuple[str, str, str, str]):\n    print(f\"[+] \\\"{result}\\n\", end=\"\")\n\n\ndef main():\n    arguments = bftool.Arguments(\n        calc_hashes,\n        bruteforce_rules={\n            \"raw_password\": {\n                \"minlength\": 1,\n                \"maxlength\": 1,\n                \"elements\": string.ascii_letters,\n                \"string-join\": True\n            },\n            \"salt\": {\n                \"minlength\": 1,\n                \"maxlength\": 1,\n                \"elements\": string.ascii_letters,\n                \"string-join\": True\n            }\n        }\n    )\n    pool = bftool.Pool(\n        calc_hashes,\n        arguments,\n        cracked,\n        success,\n        max_processes=3,\n        max_threads=3\n    )\n    print(\"Fuzzing time:\", pool.run())\n\n\nif __name__ == \"__main__\":\n    main()\n```\n\n### As a script\n\n```shell script\npython -m bftool --help\n```\n\n```\nusage: bftool [-h] [-mt MAX_THREADS] [-mp MAX_PROCESSES] [-w WORDLIST] [-b BRUTEFORCE] [-sf SUCCESS_FUNCTION] [-cf CHECK_FUNCTION] [-sp SCRIPT_PATH] expression\n\npositional arguments:\n  expression            expression that will result in a callable\n\noptional arguments:\n  -h, --help            show this help message and exit\n  -mt MAX_THREADS, --max-threads MAX_THREADS\n                        Maximum number of threads per process\n  -mp MAX_PROCESSES, --max-processes MAX_PROCESSES\n                        Maximum number of process to have active at the same time\n  -w WORDLIST, --wordlist WORDLIST\n                        File wordlist to use based on \"{'argument_1': FILE_PATH, ...}\"\n  -b BRUTEFORCE, --bruteforce BRUTEFORCE\n                        Generate a virtual wordlist based on rules \"{'argument_1': {'elements': [element_1, ...], 'minlength': INT, 'maxlength': INT, 'string-join': BOOL}, ...}\"\n  -sf SUCCESS_FUNCTION, --success-function SUCCESS_FUNCTION\n                        Function to pass the success result to (default is custom 'print')\n  -cf CHECK_FUNCTION, --check-function CHECK_FUNCTION\n                        Function useful to check the output (default is 'lambda output: output')\n  -sp SCRIPT_PATH, --script_path SCRIPT_PATH\n                        Python script to import\n```\n\n## Installation\n\n### Using `pip`\n\n```shell script\npip install bftool-pkg-sulcud\n```\n\n### Manual\n\n```shell script\ngit clone https://github.com/shoriwe/bftool\ncd bftool\npython setup.py install\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshoriwe%2Fbftool","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshoriwe%2Fbftool","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshoriwe%2Fbftool/lists"}