Add ITVX module, transparent mitm_hosts, and DM Telegram announces.
All checks were successful
release / build-and-upload (push) Successful in 6m21s

Wire module mitm_hosts into StartTransparent for ITVX capture, ship the
itv provider stub with Live-list autoplay, refresh the README, and send
Forgejo release announces to private chat 7314901602.
This commit is contained in:
404errordeveloper 2026-10-09 17:35:53 +02:00
parent 3cb259c9b6
commit 2e43e6c3fa
23 changed files with 996 additions and 84 deletions

View file

@ -83,6 +83,12 @@ type TransparentMITM interface {
UseTransparentMITM() bool
}
// MitmHostList is implemented by apps that need extra -mitm-host entries in
// transparent mode (default MITM is only open.live.bbc.co.uk).
type MitmHostList interface {
MitmHosts() []string
}
var (
mu sync.RWMutex
registry = map[string]func() (App, error){}

View file

@ -22,12 +22,13 @@ type Describe struct {
KeyMode string `json:"key_mode"`
ProxyBin string `json:"proxy_bin,omitempty"`
CAHash string `json:"ca_hash,omitempty"`
TransparentMITM bool `json:"transparent_mitm"`
Rewriter string `json:"rewriter,omitempty"`
Channels []Channel `json:"channels"`
Require []string `json:"require,omitempty"`
TransparentMITM bool `json:"transparent_mitm"`
MitmHosts []string `json:"mitm_hosts,omitempty"`
Rewriter string `json:"rewriter,omitempty"`
Channels []Channel `json:"channels"`
Require []string `json:"require,omitempty"`
Score capture.ScoreCfg `json:"score,omitempty"`
HasCatalog bool `json:"has_catalog"`
ValuesPath string `json:"values_path,omitempty"`
ValuesLoaded bool `json:"values_loaded"`
HasCatalog bool `json:"has_catalog"`
ValuesPath string `json:"values_path,omitempty"`
ValuesLoaded bool `json:"values_loaded"`
}

View file

@ -82,6 +82,17 @@ func (r *RemoteApp) MPDRewriter() mpd.Rewriter {
func (r *RemoteApp) UseTransparentMITM() bool { return r.Desc.TransparentMITM }
func (r *RemoteApp) MitmHosts() []string {
out := make([]string, 0, len(r.Desc.MitmHosts))
for _, h := range r.Desc.MitmHosts {
h = strings.TrimSpace(strings.ToLower(h))
if h != "" {
out = append(out, h)
}
}
return out
}
func (r *RemoteApp) RewriterName() string {
if r.Desc.Rewriter == "" {
return "none"
@ -117,6 +128,7 @@ func (r *RemoteApp) ValuesPath() string {
var (
_ app.App = (*RemoteApp)(nil)
_ app.TransparentMITM = (*RemoteApp)(nil)
_ app.MitmHostList = (*RemoteApp)(nil)
_ app.StreamDefaults = (*RemoteApp)(nil)
_ app.Catalog = (*RemoteApp)(nil)
)

View file

@ -209,7 +209,11 @@ func Run(opt Options) (res Result, err error) {
// StartTransparent creates a per-install CA under data/ if needed and pushes cert+key.
proxy.ClearHTTPProxy(c)
remoteDir := "/data/local/tmp/capture/" + a.Package()
if err := proxy.StartTransparent(c, proxyBin, a.Package(), "8080", remoteDir, false); err != nil {
var mitmHosts []string
if mh, ok := a.(app.MitmHostList); ok {
mitmHosts = mh.MitmHosts()
}
if err := proxy.StartTransparent(c, proxyBin, a.Package(), "8080", remoteDir, false, mitmHosts...); err != nil {
return res, fmt.Errorf("transparent MITM start: %w", err)
}
defer proxy.StopTransparent(c)

View file

@ -478,7 +478,9 @@ const (
// StartTransparent pushes appproxy in -transparent mode (no Wi‑Fi http_proxy),
// installs iptables UID REDIRECT for pkg, and writes captures under remoteDir.
func StartTransparent(c *adb.Client, localBin, pkg, port, remoteDir string, reinject bool) error {
// mitmHosts are passed as repeatable -mitm-host flags (suffix match); transparent
// mode otherwise only MITMs open.live.bbc.co.uk.
func StartTransparent(c *adb.Client, localBin, pkg, port, remoteDir string, reinject bool, mitmHosts ...string) error {
if port == "" {
port = "8080"
}
@ -518,6 +520,20 @@ func StartTransparent(c *adb.Client, localBin, pkg, port, remoteDir string, rein
_, _ = c.Shell("mkdir", "-p", remoteDir)
_, _ = c.Shell("rm", "-f", remoteDir+"/cap.json", remoteDir+"/traffic.jsonl", remoteDir+"/appproxy.log")
mitmFlags := ""
seen := map[string]bool{}
for _, h := range mitmHosts {
h = strings.TrimSpace(strings.ToLower(h))
if h == "" || seen[h] || !safeMitmHost(h) {
continue
}
seen[h] = true
mitmFlags += " -mitm-host " + h
}
if mitmFlags != "" {
fmt.Printf("[*] Force MITM hosts:%s\n", mitmFlags)
}
starter := "#!/system/bin/sh\n" +
"mkdir -p '" + remoteDir + "'\n" +
"exec " + RemoteBin +
@ -529,6 +545,7 @@ func StartTransparent(c *adb.Client, localBin, pkg, port, remoteDir string, rein
" -dns 1.1.1.1,1.0.0.1,8.8.8.8" +
" -log-all" +
" -v" +
mitmFlags +
"\n"
tmp := filepath.Join(os.TempDir(), "start_appproxy_tproxy.sh")
if err := os.WriteFile(tmp, []byte(starter), 0o755); err != nil {
@ -597,6 +614,20 @@ func StopTransparent(c *adb.Client) {
fmt.Println("[*] transparent capture stopped")
}
// safeMitmHost allows only hostname characters so flags stay shell-safe.
func safeMitmHost(h string) bool {
if h == "" || len(h) > 253 {
return false
}
for _, r := range h {
if (r >= 'a' && r <= 'z') || (r >= '0' && r <= '9') || r == '.' || r == '-' {
continue
}
return false
}
return true
}
// ResetOptions controls drm proxy reset.
type ResetOptions struct {
KeepCaptures bool // leave /data/local/tmp/capture/