GithubHelp home page GithubHelp logo

lvs1234 / key_shuffler Goto Github PK

View Code? Open in Web Editor NEW

This project forked from indicatedl/key_shuffler

0.0 0.0 0.0 48 KB

Simply python library for encrypting private keys using character shuffle method.

Python 100.00%

key_shuffler's Introduction

Telegram channel PyPI version image Github last commit date works badge

key_shuffler

Simply python library for encrypting private keys using character shuffle method.

Supports any blockchains, but is guaranteed to mask only EVM/Aptos private keys.

It checks the correctly entered password by checking the case of the last 2 characters of the key.

Accepts wallets in the format: address:key or key


Installation / Установка

pip install key-shuffler

Использование (для нормисов на русском языке)

В качестве отдельного скрипта для шифровки/расшифровки файла (просто скачайте с гитхаба)

Открыть директорию:

cd C:\...\key_shuffler

Поместить кошели в \examples\wallets.txt в формате private_key или address:private_key

Запустить скрипт командой:

python examples\file_encryptor.py

Внедрение библиотеки в существующий софт

В общем случае: найти в .py файлах софта (чаще всего в config.py/settings.py/main.py) получение КОШЕЛЬКОВ из .txt файла путем поиска по коду по ключевой фразе "with open" (синхронный код) либо "with aiofiles.open" (асинхронный код)


Для синхронного кода:

Найти:

with open(*файл с кошельками*, 'r') as file:
    ........

Добавить выше строкой "from key_shuffler import openEncrypted" и заменить "open" на "openEncrypted"

from key_shuffler import openEncrypted
with openEncrypted(*файл с кошельками*, 'r') as file:
    ........

При этом необходимо не накосячить с отступами текста, оставить такими же как были.

Пример. Было:

with open("accounts.txt", "r") as file:
    ACCOUNTS = [row.strip() for row in file]

Стало:

from key_shuffler import openEncrypted
with openEncrypted("accounts.txt", "r") as file:
    ACCOUNTS = [row.strip() for row in file]

Для асинхронного кода:

Найти:

async with aiofiles.open(*файл с кошельками*, 'r') as file:
    ........

Добавить выше строкой "from key_shuffler import aiofilesOpenEncrypted" и заменить "aiofiles.open" на "aiofilesOpenEncrypted"

from key_shuffler import aiofilesOpenEncrypted
async with aiofilesOpenEncrypted(*файл с кошельками*, 'r') as file:
    ........

При этом необходимо не накосячить с отступами текста, оставить такими же как были.

Пример. Было:

async with aiofiles.open("accounts.txt", "r") as file:
    ACCOUNTS = [row.strip() for row in file]

Стало:

from key_shuffler import aiofilesOpenEncrypted
async with aiofilesOpenEncrypted("accounts.txt", "r") as file:
    ACCOUNTS = [row.strip() for row in file]

Usage

Encrypt/decrypt key

from key_shuffler import KeyShuffler

a) The password is already set in the variable:

private_key = "........"
passphrase = "Hello world" 

shuffler = KeyShuffler(passphrase)
encrypted_key = shuffler.encrypt_private_key(private_key)
decrypted_key = shuffler.decrypt_private_key(encrypted_key)

b) The password will be specified by the user via the terminal:

private_key = "......."

shuffler = KeyShuffler()
encrypted_key = shuffler.encrypt_private_key(private_key)
decrypted_key = shuffler.decrypt_private_key(encrypted_key)

Encrypt/decrypt file

Fast sync/async encrypt: using the context manager:

from key_shuffler import openEncrypted

with openEncrypted(".....", 'r') as file:
    ...
from key_shuffler import aiofilesOpenEncrypted

async with aiofilesOpenEncrypted(".....", 'r') as file:
    ...

Default:

shuffler = KeyShuffler()

wallets = shuffler.encrypt_from_file(file_wallets)
wallets = shuffler.decrypt_from_file(file_wallets)

shuffler.encrypt_file_to_file(file_wallets, file_encrypted_wallets)
shuffler.decrypt_file_to_file(file_encrypted_wallets, file_wallets)

Handling an input error

If the password is incorrect, there will be an error and you will be asked to enter it again:


DONATE (EVM CHAINS) - 0xd8dcc73675a36f618fe780049429ec66f8402199

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.