fixed issues with CA now generates its own new cert
All checks were successful
release / build-and-upload (push) Successful in 16m53s
All checks were successful
release / build-and-upload (push) Successful in 16m53s
This commit is contained in:
parent
a930a697fa
commit
c1948a1439
11 changed files with 458 additions and 34 deletions
30
apps/capture/capturecmd/args_test.go
Normal file
30
apps/capture/capturecmd/args_test.go
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
package capturecmd
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestNormalizeArgsUnicodeDashes(t *testing.T) {
|
||||
in := []string{"\u2014app", "bbc", "\u2013channel", "bbcone"}
|
||||
out := normalizeArgs(in)
|
||||
if out[0] != "--app" {
|
||||
t.Fatalf("em-dash app: got %q want --app", out[0])
|
||||
}
|
||||
if out[1] != "bbc" {
|
||||
t.Fatalf("app value: got %q", out[1])
|
||||
}
|
||||
if out[2] != "--channel" {
|
||||
t.Fatalf("en-dash channel: got %q want --channel", out[2])
|
||||
}
|
||||
if out[3] != "bbcone" {
|
||||
t.Fatalf("channel value: got %q", out[3])
|
||||
}
|
||||
}
|
||||
|
||||
func TestNormalizeArgsASCIIUnchanged(t *testing.T) {
|
||||
in := []string{"--app", "bbc", "--channel", "bbcone"}
|
||||
out := normalizeArgs(in)
|
||||
for i := range in {
|
||||
if out[i] != in[i] {
|
||||
t.Fatalf("index %d: got %q want %q", i, out[i], in[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -7,6 +7,7 @@ import (
|
|||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
"unicode"
|
||||
|
||||
"drmdecryption/adb"
|
||||
"drmdecryption/app"
|
||||
|
|
@ -17,7 +18,9 @@ import (
|
|||
// Run performs one capture. App modules are compiled in, so there is no modules
|
||||
// directory to scan: --app names a registered provider.
|
||||
func Run(args []string) error {
|
||||
fs := flag.NewFlagSet("capture", flag.ExitOnError)
|
||||
args = normalizeArgs(args)
|
||||
|
||||
fs := flag.NewFlagSet("capture", flag.ContinueOnError)
|
||||
appName := fs.String("app", "", "app module. Empty = passive MITM, no launch/auto-play")
|
||||
channel := fs.String("channel", "", "channel id for --auto-play")
|
||||
autoPlay := fs.Bool("auto-play", false, "auto-navigate to --channel (requires --app and --channel)")
|
||||
|
|
@ -31,12 +34,16 @@ func Run(args []string) error {
|
|||
// Each module contributes --<app>.<field> overrides for its local values.
|
||||
app.BindFlags(fs)
|
||||
fs.Usage = func() {
|
||||
fmt.Fprintf(fs.Output(), "capture — one-shot phone MITM capture\n\nUsage:\n capture --app <%s> [--channel ID] [--auto-play] [--wvd PATH]\n capture (passive: play anything on the phone)\n\nFlags:\n", strings.Join(app.Names(), "|"))
|
||||
fmt.Fprintf(fs.Output(), "capture — one-shot phone MITM capture\n\nUsage:\n capture --app <%s> [--channel ID] [--auto-play] [--wvd PATH]\n capture (passive: play anything on the phone)\n\nExample (BBC + NordVPN UK):\n capture --app bbc --channel bbcone --wait 120\n\nFlags:\n", strings.Join(app.Names(), "|"))
|
||||
fs.PrintDefaults()
|
||||
}
|
||||
|
||||
if err := fs.Parse(args); err != nil {
|
||||
return err
|
||||
}
|
||||
if rest := fs.Args(); len(rest) > 0 {
|
||||
return fmt.Errorf("unexpected arguments %v — use flags only (example: capture --app bbc --channel bbcone)", rest)
|
||||
}
|
||||
|
||||
c := adb.New()
|
||||
if *serial != "" {
|
||||
|
|
@ -85,6 +92,34 @@ func Run(args []string) error {
|
|||
return err
|
||||
}
|
||||
|
||||
// normalizeArgs rewrites Unicode dashes Word/Terminal often insert (— – −)
|
||||
// into ASCII - so `--app` is not silently dropped as a positional token.
|
||||
func normalizeArgs(args []string) []string {
|
||||
out := make([]string, len(args))
|
||||
for i, a := range args {
|
||||
var b strings.Builder
|
||||
b.Grow(len(a) + 4)
|
||||
for _, r := range a {
|
||||
switch r {
|
||||
case '\u2014', '\u2013', '\u2212': // em, en, minus
|
||||
// "—app" → "--app"; standalone dash stays single "-"
|
||||
if b.Len() == 0 {
|
||||
b.WriteString("--")
|
||||
} else {
|
||||
b.WriteByte('-')
|
||||
}
|
||||
default:
|
||||
if unicode.Is(unicode.Cf, r) {
|
||||
continue // strip zero-width / format chars
|
||||
}
|
||||
b.WriteRune(r)
|
||||
}
|
||||
}
|
||||
out[i] = b.String()
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
// knownChannels describes what the operator can pick, or where to declare it when
|
||||
// the module has no local values file yet.
|
||||
func knownChannels(a app.App) string {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue