Skip to main content

python tool that locks python source files using a one time pad lock. It helps to securely storing and sharing python source files.

Project description

pytLoc

pytLoc is a python tool that locks python source files using a one time pad lock. It helps to securely storing and sharing python source files.
Author: Gilda Bansimba
usage: from pytLoc import pytLoc
            pytLoc.pytLoc(*args).[method]
Options and methods.
           This class represents the heart of pytLoc.
            It takes optionnal arguments:
           -either a list of file names in the current working directory. E.g: pytLoc.pytLoc("file1.py")
                                                                                                              or pytLoc.pytLoc("file1.py", "file2.py")
          -either "." to obfuscate all python files in the current working directory. E.g: pytLoc.pytLoc(".").loc(key)
          -either "" to obfuscate all python files in the current working directory and in its subfolders. E.g: pytLoc.pytLoc("*").loc(key)
           -either "***" to obfuscate all python source code files stored in the entire disk. E.g: pytLoc.pytLoc("***").loc(key)
           key --> the key is a string: a phrase or key string or a list of words or strings. E.g: key="hello"; key="hello, h
cb45#".
           genKey(key, leng) --> generates a one time pad of length "leng" key from a the key "key".
           This key is generated randomly using the secure hash algorithm with 512 bits. To do so,
           it uses the composition function of functions initialized at sha512(key) concatenated with
          the footprints of consecutive concatenation of footprints up to the length "leng".
          loc(key) --> locks / obfuscates python files indicated in pytLoc with the one time pad key generated from the key "Key"
unloc(key) --> unlocks / de-obfuscates python files indicated in pytLoc with the one time pad key generated from the key "Key".
genKey(key, len) --> generates a one time pad security key of length len derived from key.
sig(file) --> computes a hash of file.
check(file) --> function that checks the integrity of a locked python source.
E.g: 1- OBFUSCATE / LOCK A PYTHON FILE or PYTHON FILES IN THE CURRENT WORKING DIRECTORY
          to obfuscatE the file "file1.py" located in the current working directory with the one time pad generated from key "hello",
           --> pytLoc.pytLoc("file1.py").loc("hello") which generates the file "LOCKED_file1.py" in the same directory. This file is obfuscated.
           to DE-obfuscatE the file "LOCKED_file1.py" located in the current working directory with the one time pad generated from key "hello",
          --> pytLoc.pytLoc("LOCKED_file1.py").unlock("hello") which generates back the file "UNLOCKED_file1.py" which is equal to "file1.py" in the same directory.
2- OBFUSCATE / LOCK ALL PYTHON FILES LOCATED IN THE CURRENT WORKING DIRECTORY
          to obfuscatE all python files located in the current working directory with the one time pad generated from the key "hello",
          --> pytLoc.pytLoc(".").loc("hello") which generates the files "LOCKED_....py" in the same directory. These files are obfuscated.
          to DE-OBFUSCATE / UNLOCK all the obfuscated python files "LOCKED_....py" located in the current working directory with the one time pad generated from the key "hello",
          --> pytLoc.pytLoc(".").unlock("hello") which generates back the files "UNLOCKED_....py" in the same directory.
3- OBFUSCATE / LOCK ALL PYTHON FILES LOCATED IN THE CURRENT WORKING DIRECTORY AND ITS SUB-DIRECTORIES
          to obfuscatE all python files located in the current working directory and its sub-directories with the one time pad generated from the key "hello",
          --> pytLoc.pytLoc("*").loc("hello") which generates the files "LOCKED_....py" in current working directory and all its corresponding sub-directories.
          to OBFUSCATE / LOCK all python files located in the current working directory and its sub-directories,
          --> pytLoc.pytLoc("*").unlock("hello") which generates the files "UNLOCKED....py" in the current working directory and all its corresponding sub-directories.
4- OBFUSCATE / LOCK ALL PYTHON FILES LOCATED IN THE ENTIRE DRIVE PARTITION
          to obfuscatE all python files located in the entire drive partition with the one time pad generated from the key "hello",
          --> pytLoc.pytLoc("***").loc("hello") which generates the files "LOCKED_....py" in wherever directory or sub-directory where python files are found.
          to DE-obfuscatE all python files located in the entire drive partition with the one time pad generated from the key "hello",
          --> pytLoc.pytLoc("***").unlock("hello) which generates the files "UNLOCKED....py" in wherever directory or sub-directory where locked python files are found.

 NOTE: when calling pytLoc withe parameter without parameter delete or with parameter delete=False, (E.g `pytLoc.pytLoc("file1.py").loc(key)` or <br/>
 `pytLoc.pytLoc("file1.py", delete=False).loc(key)` ), the original files are not deleted. and with parameter delete=True, original files are deleted <br/>

Project details


Release history Release notifications | RSS feed

This version

1.1

Download files

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

Source Distribution

pytLoc-1.1.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

pytLoc-1.1-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file pytLoc-1.1.tar.gz.

File metadata

  • Download URL: pytLoc-1.1.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.5

File hashes

Hashes for pytLoc-1.1.tar.gz
Algorithm Hash digest
SHA256 90fefff15621c8e7cf6ad5edcfc39d37994c0d5a13eca6b36a65d67552b87ec2
MD5 01917a33d1227c4b795c57261c155358
BLAKE2b-256 6130b701420cd4794e4fefc7b2d79e2080ef5d963ae656a7d96b06de7403f74a

See more details on using hashes here.

File details

Details for the file pytLoc-1.1-py3-none-any.whl.

File metadata

  • Download URL: pytLoc-1.1-py3-none-any.whl
  • Upload date:
  • Size: 8.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.5

File hashes

Hashes for pytLoc-1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ab492d22c6781cc14d4c07a26e64501741d6b4d75b30802ffa1b233cfc9fd82c
MD5 3d98b604b660e931fa47bbd483c60ea5
BLAKE2b-256 68600e82b11b2999d85d2080cd8a34a2a0a53badc2c39064c681c5c216c4c203

See more details on using hashes here.

Supported by

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