Skip to main content

A tool for obscuring, or making python source difficult to read.

Project description

obscurepy

Build Status codecov

Description

A tool for obscuring, or making python source code difficult to read.

Table of Contents

  1. Installation
  2. Limitations
  3. Usage
  4. License

Installation

This command will install obscurepy:

python -m pip install obscurepy

I would recommend installing it in a virtual environment as opposed to globally:

python -m venv venv
source venv/bin/activate
python -m pip install obscurepy

Limitations

As this program is still in active development, there are many limitations. Below is a list of things obscurepy can and can't do, along with an example.

Things that obscurepy can currently do:

  • Obscure class definitions
  • Obscure class calls (without arguments)
  • Obscure class properties
  • Obscure function definitions (without parameters)
  • Obscure function calls (without arguments)
  • Obscure string constants
  • Obscure integer constants
  • Obscure float constants

Things it cannot do:

  • Anything else

An example:

class FirstClass:
    pass


class SecondClass(FirstClass):
    # this is a comment
    class_variable = 6

    def __init__(self):
        self.my_property = 8

    def class_function(self):
        self.new_property = 10


def first_function():
    c = 42


def second_function():
    d = 'string'

def third_function():
    e = 100.0

a = FirstClass()

b = SecondClass()

first_function()
class _0x3fe:
    pass

class _0x452(_0x3fe):
    _0x5bb = int('0x6', 16)

    def __init__(self):
        self._0x4ca = int('0x8', 16)

    def _0x5db(self):
        self._0x52e = int('0xa', 16)

def _0x5ed():
    _0x63 = int('0x2a', 16)

def _0x641():
    _0x64 = ''.join([chr(x) for x in [115, 116, 114, 105, 110, 103]])

def _0x5e0():
    _0x65 = float.fromhex('0x1.9000000000000p+6')
_0x61 = _0x3fe()
_0x62 = _0x452()
_0x5ed()
_0x641()
_0x5e0()
_0x61 = _0x452()

Usage

The following command can be used to obscure a single file:

obscure --filepath=my_module.py

The following command can be used to obscure a multi file project:

obscure -p --project_dir=my_project

Alternatively, you can specify an output directory for both single file and multi file obscuring:

obscure --filepath=my_module.py --output_dir=desired_output_directory
obscure --project_dir=my_project --output_dir=desired_output_directory

License

MIT License

Copyright (c) 2021 Andrew Christiansen

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


Download files

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

Source Distribution

obscurepy-0.7.0.tar.gz (18.5 kB view details)

Uploaded Source

Built Distribution

obscurepy-0.7.0-py3-none-any.whl (29.5 kB view details)

Uploaded Python 3

File details

Details for the file obscurepy-0.7.0.tar.gz.

File metadata

  • Download URL: obscurepy-0.7.0.tar.gz
  • Upload date:
  • Size: 18.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.4.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.1

File hashes

Hashes for obscurepy-0.7.0.tar.gz
Algorithm Hash digest
SHA256 42b6089826f6025c467e68eac3d322c2b0d8939e077c35f89acb719cb7810eff
MD5 137c488964787aec78c3b63f56e392f7
BLAKE2b-256 ecd1f4b7190fb2cdda17507d832e0f983a66ad31775d67664600a6e60a65bb1c

See more details on using hashes here.

File details

Details for the file obscurepy-0.7.0-py3-none-any.whl.

File metadata

  • Download URL: obscurepy-0.7.0-py3-none-any.whl
  • Upload date:
  • Size: 29.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.4.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.1

File hashes

Hashes for obscurepy-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fdffd0cefd8bdc2b68eb37d3d8a920866167e4731286004a8a1aafae27a983ba
MD5 99641432cbaf07768588a8b5bdf0f9c0
BLAKE2b-256 1b29cca942c3e4681e4a058c35f6906f8ed9d87700ab7f68b33a5afbd627e289

See more details on using hashes here.

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