Null-DRM-Official/apps/cli/main.go
404errordeveloper 1d36961a7c
All checks were successful
release / build-and-upload (push) Successful in 6m38s
Bugs fixed
2026-10-08 20:44:10 +02:00

89 lines
2.7 KiB
Go

// Command drm is the single entry point for the toolchain: phone capture,
// catalog lookups, the always-on agent, the streamd control plane and the
// on-device MITM. Every app module under apps/modules is compiled in.
package main
import (
"fmt"
"os"
"drmdecryption/apps/agent/agentcmd"
"drmdecryption/apps/capture/capturecmd"
"drmdecryption/apps/cli/catalogcmd"
"drmdecryption/apps/cli/modulescmd"
"drmdecryption/apps/proxy/proxyctlcmd"
"drmdecryption/apps/streamd/servecmd"
"drmdecryption/bootstrap"
// Links every app module into this binary.
_ "drmdecryption/modules/all"
)
func main() {
if len(os.Args) < 2 {
usage()
os.Exit(2)
}
cmd, args := os.Args[1], os.Args[2:]
// Materialise apps/, bin/, outputs/, … next to this exe when missing
// so a lone downloaded drm.exe becomes a GitHub-like install tree.
if cmd != "help" && cmd != "-h" && cmd != "--help" {
if err := bootstrap.EnsureAndLog(); err != nil {
fmt.Fprintln(os.Stderr, "[!] bootstrap:", err)
os.Exit(1)
}
}
var err error
switch cmd {
case "capture":
err = capturecmd.Run(args)
case "catalog":
err = catalogcmd.Run(args)
case "modules":
err = modulescmd.Run(args)
case "agent":
err = agentcmd.Run(args)
case "serve":
err = servecmd.Run(append([]string{"serve"}, args...))
case "proxy":
err = proxyctlcmd.Run(args)
case "help", "-h", "--help":
usage()
return
default:
usage()
err = fmt.Errorf("unknown command %q", cmd)
}
if err != nil {
fmt.Fprintln(os.Stderr, "[!]", err)
os.Exit(1)
}
}
func usage() {
fmt.Fprint(os.Stderr, `drm — DRM capture / restream toolchain
Usage:
drm modules list compiled-in app modules and their channels
drm capture --app NAME [--channel ID] [--auto-play] [--wvd PATH]
one-shot phone MITM capture
drm catalog --app NAME --channel ID [--keys] [--json] [--list]
resolve a channel from its public catalog (no phone)
drm agent run|status|devices|enqueue|cancel [--config …]
always-on credential refresher
drm serve [--bind …] [--data …] [--token …]
streamd control plane + dashboard
drm proxy build|push|install-ca|start|stop|discover|pull|clear-proxy
on-device HTTPS MITM
App module *code* is compiled in; module *values* are never inside the exe.
Put configs at apps/modules/<name>/module.yaml yourself (see the GitHub repo).
On first run, drm only creates the scaffold (apps/pkg, bin/proxy, outputs, …).
Overrides: --<app>.<field> flags or <APP>_<FIELD> environment variables.
Run any subcommand with --help for its own flags.
`)
}