Skip to main content

NYCU E3 Moodle automation CLI — sync courses, download materials, submit assignments.

Project description

Python Platform License Version

e3cli

NYCU E3 Moodle automation CLI
Sync courses, download materials, submit assignments — all from your terminal.

InstallQuick StartCommandsSecurity繁體中文


Intended use: Finished your homework? Too lazy to open the browser? Submit it from CLI.

Unintended use: Let Claude Code auto-pull new assignments, finish them, and upload. (Please don't.)

Features

  • Login — Moodle Web Service API authentication with encrypted credential storage
  • Courses — List all enrolled courses
  • Assignments — View assignments, deadlines, and submission status
  • Download — Batch download course materials, skip already-downloaded files
  • Submit — Upload and submit assignments directly from CLI
  • Sync — One command to pull everything new (materials + assignment status)
  • Schedule — Cron-based automatic sync
  • Bilingual — Full Chinese/English support

Supported Platforms

Platform Architecture Status
macOS Apple Silicon (ARM64) :white_check_mark: Supported
macOS Intel (x86_64) :white_check_mark: Supported
Linux x86_64 :white_check_mark: Supported
Linux ARM64 :white_check_mark: Supported

Requires Python 3.11+.


Installation

Homebrew (recommended)

brew tap junlinwk/e3cli
brew install e3cli

pipx

pipx install git+https://github.com/junlinwk/e3cli.git

pip

pip install git+https://github.com/junlinwk/e3cli.git

From source

git clone https://github.com/junlinwk/e3cli.git
cd e3cli
pip install -e ".[dev]"

After installation, e3cli is available as a system-wide command.

Upgrade

Method Command
Homebrew brew update && brew upgrade e3cli
pipx (GitHub) pipx install git+https://github.com/junlinwk/e3cli.git --force
pipx (PyPI) pipx upgrade e3cli
pip (PyPI) pip install e3cli --upgrade

Quick Start

# 1. Login (first time — interactive setup wizard will guide you)
e3cli login --save

# 2. List your courses
e3cli courses

# 3. Download all course materials
e3cli download --all

# 4. Check assignments and deadlines
e3cli assignments

# 5. Submit an assignment
e3cli submit <assignment-id> homework.pdf

# 6. Enable automatic sync (every hour)
e3cli schedule enable

Commands

e3cli login

Authenticate with your Moodle account and store the API token.

e3cli login                    # Interactive prompt
e3cli login -u <student-id>    # Specify username
e3cli login --save             # Save credentials (encrypted) for auto-refresh
e3cli login --refresh          # Re-authenticate using saved credentials

e3cli logout

Securely erase all stored credentials and tokens.

e3cli logout

e3cli courses

List all enrolled courses in a formatted table.

e3cli courses

e3cli assignments

View assignments with deadlines and submission status.

e3cli assignments                  # All assignments
e3cli assignments --due-soon 7     # Due within 7 days

e3cli download

Download course materials to local disk.

e3cli download --all               # All courses
e3cli download --course "OS"       # Filter by course name/code

Files are saved to ~/e3-downloads/<course>/<section>/ by default. Already-downloaded files are skipped automatically (tracked via SQLite).

e3cli submit

Upload and submit an assignment.

e3cli submit <assignment-id> file1.pdf file2.zip
e3cli submit <assignment-id> report.pdf --text "Some notes"
e3cli submit <assignment-id> late-hw.pdf --force     # Submit past deadline

e3cli sync

Pull all new materials and update assignment status in one command.

e3cli sync                # Interactive output
e3cli sync --quiet        # Silent mode (for cron)

e3cli schedule

Manage automatic sync via system crontab.

e3cli schedule enable                  # Default: every 60 minutes
e3cli schedule enable --interval 30    # Every 30 minutes
e3cli schedule disable                 # Remove cron job
e3cli schedule status                  # Show current schedule

e3cli setup

Re-run the interactive setup wizard (language, Moodle URL, download directory, login).

e3cli setup

e3cli version

e3cli version

Configuration

Config file location: ~/.e3cli/config.toml

[moodle]
url = "https://e3p.nycu.edu.tw"
service = "moodle_mobile_app"

[storage]
download_dir = "~/e3-downloads"

[schedule]
interval_minutes = 60
notify = true

[general]
lang = "zh"    # "zh" or "en", or omit for auto-detect

Auto-created with defaults on first run. Edit to customize, or run e3cli setup to reconfigure interactively.


Security

Credential Storage

e3cli uses PBKDF2-HMAC-SHA256 key derivation with integrity verification to protect stored credentials:

~/.e3cli/
  key               # 256-bit random encryption key  (chmod 600)
  credentials.enc   # Encrypted username + password   (chmod 600)
  token             # Moodle API token                (chmod 600)
Measure Detail
Encryption PBKDF2-HMAC-SHA256 (100k iterations) + XOR stream cipher
Integrity HMAC-SHA256 verification on every read
File permissions chmod 600 — owner-only read/write
Password input getpass — never appears in shell history or CLI args
Logout e3cli logout overwrites files with zeros before deletion
Key separation Encryption key and encrypted data stored in separate files

What's NOT Stored

  • :x: No plaintext passwords on disk
  • :x: No credentials in config.toml
  • :x: No credentials in environment variables
  • :x: No credentials in shell history

Recommendations

  • Use e3cli login --save only on machines you trust
  • Run e3cli logout when done on shared machines
  • The ~/.e3cli/ directory is in .gitignore — never commit it

Local Data

Path Purpose
~/.e3cli/config.toml User configuration
~/.e3cli/token Moodle API token (chmod 600)
~/.e3cli/key Encryption key (chmod 600)
~/.e3cli/credentials.enc Encrypted credentials (chmod 600)
~/.e3cli/data/e3cli.db SQLite tracking DB
~/e3-downloads/ Downloaded course materials

Development

git clone https://github.com/junlinwk/e3cli.git
cd e3cli
make dev       # pip install -e ".[dev]"
make lint      # ruff check
make test      # pytest
make build     # python -m build

Roadmap

  • AI-powered material summarization
  • AI-assisted assignment drafting
  • Smart deadline notifications with priority scoring
  • Desktop notifications (Linux notify-send, macOS osascript)
  • Course filtering by semester
  • Parallel downloads

License

MIT

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

e3cli-0.4.1.tar.gz (35.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

e3cli-0.4.1-py3-none-any.whl (42.3 kB view details)

Uploaded Python 3

File details

Details for the file e3cli-0.4.1.tar.gz.

File metadata

  • Download URL: e3cli-0.4.1.tar.gz
  • Upload date:
  • Size: 35.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for e3cli-0.4.1.tar.gz
Algorithm Hash digest
SHA256 b3a29ac5c695ef7a141d4f1504a840b5ab33f69fea15fdfc7b96f4a111e53aec
MD5 08b35b0c2efeefb052acf5bff84d388d
BLAKE2b-256 b2a2acc153f17c0408fc923f1a6368da2c34913473aa757d2311bd0ef4b72426

See more details on using hashes here.

File details

Details for the file e3cli-0.4.1-py3-none-any.whl.

File metadata

  • Download URL: e3cli-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 42.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for e3cli-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7b40f937d27f3e79e47779685560ff4c8fd072d7d142bf04e734dc364e059711
MD5 2dace78c24876c8516d3ba7a1f4fa850
BLAKE2b-256 05fcd76a7d2796a4f4569eabafe9ecdfc12a1ea7db435bd186ee2fea6fd1ba28

See more details on using hashes here.

Supported by

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