# PyObfuscate
**_The Easiest Way to Encrypt your .py files_**

## Installation to Local Folder using _PIP_

### Linux / MacOS

```console
user@machine:~$ pip install ./PyObfuscate --upgrade -t ~/.local/lib/<PYTHON>/site-packages/PyObfuscate
user@machine:~$ export PATH="~/.local/lib/<PYTHON>/site-packages/PyObfuscate/bin:$PATH"
```

### Windows
```console
user@machine:~$ pip install ./PyObfuscate --upgrade -t ~/.local/lib/<PYTHON>/site-packages/PyObfuscate
```

## CLI Usage
```console
user@machine:~$ pyobfuscate --help
usage: PyObfuscate [-h] SRC DEST MSG

A simple python obfuscator

positional arguments:
  SRC         Filepath to the file(s) to obfuscate
  DEST        Destination Folder
  MSG         Encoding Message

options:
  -h, --help  show this help message and exit
```

## API Usage
```python
from PyObfuscate.lib.framework import encrypt_file, encrypt_source, cyphers

src = "/path/to/file.py"
dest = "/path/to/dest.py"

encrypt_file(src, dest, varnames=["your", "message", "here"], cyphers=cyphers, iterations=6)

source = """#!/bin/env python3
print("hello world")
"""

program = encrypt_source(seed=src, varnames=varnames, cyphers=cyphers, iterations=iterations)

header = """#!/bin/env python
import base64
import codecs
"""

program = """%s

%s

""" % (header, program,)

with open("encoded.py", "wb") as f:
    f.write(program)
    f.close()

```

## EXAMPLE OUTPUT
```python

import base64
import codecs

obfuscated="RTVQNzY4M0xFOVNOSU9IODU0VDBLODEw"
file="NDBHNjZQQk1DNUpJRzhKTEU5U05JT0gwRDlINkFVQkg0OEtHS1RCSUY1U000QTE5"
contents=" "
eval(compile(base64.b64decode(contents).decode("utf-8"), '<string>', 'exec'))
```