Metadata-Version: 2.4
Name: sitrtech
Version: 1.2.3
Summary: SitrTech Python code encryption CLI — protect Odoo, Django, Flask, FastAPI and Tornado projects
Author-email: SitrTech <info@sitrtech.com>
License: Proprietary
Project-URL: Homepage, https://sitrtech.com
Project-URL: Docs, https://sitrtech.com/docs
Project-URL: Repository, https://sitrtech.com
Project-URL: Bug Tracker, https://sitrtech.com/support
Keywords: odoo,django,flask,fastapi,tornado,encryption,obfuscation,code-protection
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Security :: Cryptography
Classifier: Topic :: Software Development :: Build Tools
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Requires-Dist: requests>=2.31
Requires-Dist: rich>=13
Requires-Dist: click>=8
Requires-Dist: cryptography>=41

# SitrTech — Python Code Encryption CLI

Protect **Odoo, Django, Flask, FastAPI and Tornado** projects with AES-256 encryption, licensing controls, and anti-reverse-engineering in one command.

## Quick start

```bash
# Recommended for CLI tools (no venv needed)
pipx install sitrtech

# Or with pip
pip install sitrtech
```

Get your API secret key from [sitrtech.com/api-keys](https://sitrtech.com/api-keys), then:

```bash
# Encrypt an Odoo addon
sitr encrypt my_module.zip --framework odoo --secret sk-...

# Encrypt a Django project
sitr encrypt my_project.zip --framework django --secret sk-...

# Check your token balance
sitr balance --secret sk-...
```

## Installation

```bash
# pipx — best for CLI tools, works on Ubuntu/Debian/macOS without issues
pipx install sitrtech
pipx upgrade sitrtech          # upgrade later

# pip — standard Python package manager
pip install sitrtech           # latest stable
pip install --upgrade sitrtech # upgrade
pip install sitrtech==1.0.1    # pin a specific version
```

> **Ubuntu / Debian users:** If you see `externally-managed-environment`, use `pipx install sitrtech` instead.

Python 3.8 → 3.14 · Windows, macOS, Linux

## Usage

### `sitr encrypt`

```
sitr encrypt <FILE.zip> [OPTIONS]

Arguments:
  FILE.zip              Zipped project folder

Options:
  -f, --framework TEXT   odoo | django | flask | fastapi | tornado  [default: odoo]
  -v, --version TEXT     Framework version (e.g. 16.0 for Odoo)
  -e, --expiry DATE      Expiry: 2026-12-31 or 2026-12-31T23:59:00Z
  -n, --network CIDR     Allowed IP/CIDR (repeatable)
  -o, --output PATH      Output file (default: <input>_encrypted.zip)
  -s, --secret TEXT      API secret key  [env: SITR_SECRET]
  -b, --base URL         API base URL    [env: SITR_BASE]
```

### Examples

```bash
# Odoo (default)
sitr encrypt my_addon.zip --framework odoo

# Django with expiry and IP restriction
sitr encrypt backend.zip --framework django \
  --expiry 2026-12-31 \
  --network 10.0.0.0/24

# FastAPI project
sitr encrypt api.zip --framework fastapi

# Flask with multiple IP ranges
sitr encrypt webapp.zip --framework flask \
  --network 192.168.1.10 \
  --network 10.0.0.0/8
```

### `sitr balance`

```bash
sitr balance --secret sk-...
# ┌─────────────────────────────┐
# │       SitrTech Account      │
# │  Tokens  │  5,000           │
# │  Plan    │  Pro             │
# │  Rate    │  0.3 tokens/line │
# └─────────────────────────────┘
```

### `sitr info`

```bash
sitr info
# Shows all supported frameworks and required project structure
```

## Environment variables

| Variable        | Description                          |
|-----------------|--------------------------------------|
| `SITR_SECRET`   | API secret key (avoids typing it)    |
| `SITR_BASE`     | Override API URL (default: sitrtech.com) |

```bash
export SITR_SECRET=sk-your-key-here
sitr encrypt my_project.zip --framework django
```

## Project structure requirements

| Framework | Required entry-point file |
|-----------|--------------------------|
| Odoo      | `__manifest__.py`         |
| Django    | `manage.py`              |
| Flask     | `app.py` or `wsgi.py`    |
| FastAPI   | `main.py` or `asgi.py`   |
| Tornado   | `main.py` or `server.py` |

**Always zip the root folder** — not its contents:

```
# Correct ✓
zip -r my_addon.zip my_addon/

# Wrong ✗
cd my_addon && zip -r ../my_addon.zip .
```

## Local mode — your source never leaves your machine

Use `--local` to encrypt **on your own server**. Only line counts and license metadata
are sent to the platform (to authorize and meter tokens); your source code is never
uploaded. The master secret is never present in this package.

```bash
sitr encrypt my_addon.zip --framework odoo --local
```

Flow: `authorize` (reserve tokens + receive a signed one-time key) → encrypt locally →
`commit` (charge the actual line count). No valid authorization → nothing is encrypted.

## Binding / protection options

Lock encrypted code to a place, machine, or time window. Options combine with **AND**
(every rule present must pass at runtime). Available in both normal and `--local` modes:

| Option | Binds the code to… |
|--------|--------------------|
| `-e, --expiry DATE`      | stops working after this date/time |
| `--start DATE`           | not valid before this date/time |
| `-n, --network CIDR`     | allowed IPs / CIDR / ranges (repeatable) |
| `--mac MAC`              | allowed MAC address(es) (repeatable) |
| `--machine-id ID`        | machine fingerprint (Linux machine-id / Windows MachineGuid) |
| `--hostname HOST`        | allowed hostname(s) |
| `--disk-serial SERIAL`   | allowed disk/volume serial(s) |
| `--odoo-db DB`           | allowed Odoo database name(s) |
| `--domain DOMAIN`        | allowed domain / base URL(s) |

```bash
# Bind to one machine + network, expiring end of 2026
sitr encrypt hr_module.zip -f odoo --local \
  --expiry 2026-12-31 \
  --network 10.0.0.0/24 \
  --mac 00:1a:2b:3c:4d:5e \
  --machine-id $(cat /etc/machine-id)
```

> Runtime performance is unaffected: files are decrypted once at import time and then run
> at native Python speed — there is no per-call cost.

## Automated encryption for many modules — `sitr encrypt-dir`

Built for teams that ship **dozens of modules across many projects, daily**. No
manual zipping, source never leaves your machine, and only **changed** modules are
re-encrypted on each run (state tracked in `<output>/.sitr_state.json`).

```bash
# Encrypt every Odoo module under ./addons — locally, in parallel, incrementally
sitr encrypt-dir ./addons --framework odoo

# With binding + expiry, into a custom output dir
sitr encrypt-dir ./addons -f odoo -o ./dist \
  --expiry 2026-12-31 --network 10.0.0.0/24 --mac 00:1a:2b:3c:4d:5e

sitr encrypt-dir ./addons --full     # force full re-encryption
```

| Option | Meaning |
|--------|---------|
| `-o, --output DIR` | output directory (default `<source>_encrypted`) |
| `-j, --jobs N`     | parallel workers (default: CPU count) |
| `--full`           | ignore the incremental state and re-encrypt everything |
| all binding flags  | `--expiry --start --network --mac --machine-id --hostname --disk-serial --odoo-db --domain` |

**Why it's fast + secure:** one authorization for the whole batch, encryption runs on
your machine (only line counts are sent), and a daily run re-encrypts *only what changed*.

## CI/CD integration

### GitHub Actions (daily encryption of all modules)

```yaml
name: Encrypt & deploy addons
on:
  schedule: [{ cron: "0 2 * * *" }]   # daily at 02:00
  workflow_dispatch:
jobs:
  encrypt:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with: { python-version: "3.12" }
      # cache the incremental state so only changed modules re-encrypt
      - uses: actions/cache@v4
        with: { path: dist/.sitr_state.json, key: sitr-state-${{ github.ref }} }
      - run: pip install sitrtech
      - name: Encrypt all modules (source never leaves the runner)
        env: { SITR_SECRET: ${{ secrets.SITR_SECRET }} }
        run: sitr encrypt-dir ./addons -f odoo -o ./dist --expiry 2026-12-31
      - name: Deploy encrypted modules
        run: rsync -az ./dist/ user@server:/opt/odoo/addons/
```

### GitLab CI

```yaml
encrypt:
  image: python:3.12
  cache: { paths: [dist/.sitr_state.json] }
  script:
    - pip install sitrtech
    - sitr encrypt-dir ./addons -f odoo -o ./dist
  variables: { SITR_SECRET: $SITR_SECRET }
```

### Docker one-liner

```bash
docker run --rm -e SITR_SECRET -v "$PWD/addons:/src:ro" -v "$PWD/dist:/out" \
  python:3.12-slim sh -c "pip install -q sitrtech && sitr encrypt-dir /src -f odoo -o /out"
```

## Links

- **Documentation**: <https://sitrtech.com/docs>
- **API Keys**: <https://sitrtech.com/api-keys>
- **Support**: support@sitrtech.com
