-
-
Notifications
You must be signed in to change notification settings - Fork 318
Expand file tree
/
Copy pathmain.go
More file actions
2011 lines (1754 loc) · 86 KB
/
Copy pathmain.go
File metadata and controls
2011 lines (1754 loc) · 86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
package main
import (
"bytes"
"context"
"crypto/x509"
"encoding/json"
"encoding/pem"
"fmt"
"log/slog"
"net/http"
_ "net/http/pprof"
"os"
"os/signal"
"path/filepath"
"runtime"
"runtime/debug"
"sort"
"strconv"
"strings"
"syscall"
"time"
"golang.org/x/crypto/pkcs12"
"golang.org/x/term"
"github.com/danielpaulus/go-ios/internal/clihelp"
"github.com/danielpaulus/go-ios/ios/debugproxy"
"github.com/danielpaulus/go-ios/ios/tunnel"
"github.com/danielpaulus/go-ios/ios/imagemounter"
"github.com/danielpaulus/go-ios/ios/zipconduit"
"github.com/danielpaulus/go-ios/ios/simlocation"
"github.com/danielpaulus/go-ios/ios"
"github.com/danielpaulus/go-ios/ios/accessibility"
"github.com/danielpaulus/go-ios/ios/diagnostics"
"github.com/danielpaulus/go-ios/ios/forward"
"github.com/danielpaulus/go-ios/ios/installationproxy"
"github.com/danielpaulus/go-ios/ios/instruments"
"github.com/danielpaulus/go-ios/ios/mcinstall"
"github.com/danielpaulus/go-ios/ios/notificationproxy"
"github.com/danielpaulus/go-ios/ios/ostrace"
"github.com/danielpaulus/go-ios/ios/springboard"
syslog "github.com/danielpaulus/go-ios/ios/syslog"
"github.com/docopt/docopt-go"
)
// JSONdisabled enables or disables output in JSON format
var (
JSONdisabled = false
prettyJSON = false
)
func main() {
Main()
}
const version = "local-build"
// Main Exports main for testing
func Main() {
helpCatalog, err := clihelp.Load()
exitIfError("failed loading help definitions", err)
if handled, exitCode := helpCatalog.WriteHelp(os.Args[1:], version, os.Stdout, os.Stderr); handled {
if exitCode != 0 {
os.Exit(exitCode)
}
return
}
usage := fmt.Sprintf(`go-ios %s
Usage:
ios --version | version [options]
ios -h | --help
ios activate [options]
ios apps [--system] [--all] [--list] [--filesharing] [options]
ios assistivetouch (enable | disable | toggle | get) [--force] [options]
ios ax [--font=<fontSize>] [options]
ios ax audit [options]
ios batterycheck [options]
ios batteryregistry [options]
ios crash cp <srcpattern> <target> [options]
ios crash ls [<pattern>] [options]
ios crash rm <cwd> <pattern> [options]
ios date [options]
ios debug [options] [--stop-at-entry] <app_path>
ios devicename [options]
ios devicestate enable <profileTypeId> <profileId> [options]
ios devicestate list [options]
ios devmode (enable | get | reveal) [--enable-post-restart] [options]
ios diagnostics list [options]
ios diskspace [options]
ios dproxy [--binary] [--mode=<all(default)|usbmuxd|utun>] [--iface=<iface>] [options]
ios erase [--force] [options]
ios file ls [--app=<bundleID> | --app-group=<groupID> | --crash | --temp] [--path=<path>] [options]
ios file pull [--app=<bundleID> | --app-group=<groupID> | --crash | --temp] --remote=<remotePath> --local=<localPath> [options]
ios file push [--app=<bundleID> | --app-group=<groupID> | --crash | --temp] --local=<localPath> --remote=<remotePath> [options]
ios forward [options] [<hostPort> <targetPort>] [--port=<mapping>]...
ios fsync [--app=bundleId] [options] (pull | push) --srcPath=<srcPath> --dstPath=<dstPath>
ios fsync [--app=bundleId] [options] (rm [--r] | tree | mkdir) --path=<targetPath>
ios httpproxy <host> <port> [<user>] [<pass>] --p12file=<orgid> --password=<p12password> [options]
ios httpproxy remove [options]
ios image auto [--basedir=<where_dev_images_are_stored>] [options]
ios image list [options]
ios image mount [--path=<imagepath>] [options]
ios image unmount [options]
ios info [display | lockdown] [options]
ios install --path=<ipaOrAppFolder> [options]
ios instruments notifications [options]
ios ip [options]
ios kill (<bundleID> | --pid=<processID> | --process=<processName>) [options]
ios lang [--setlocale=<locale>] [--setlang=<newlang>] [options]
ios launch <bundleID> [--wait] [--kill-existing] [--arg=<a>]... [--env=<e>]... [options]
ios list [options] [--details]
ios listen [options]
ios lockdown get [<key>] [--domain=<domain>] [options]
ios memlimitoff (--process=<processName>) [options]
ios mobilegestalt <key>... [--plist] [options]
ios pair [--p12file=<orgid>] [--password=<p12password>] [options]
ios pcap [options] [--pid=<processID>] [--process=<processName>]
ios prepare [--skip-all] [--skip=<option>]... [--certfile=<cert_file_path>] [--orgname=<org_name>] [--p12password=<p12password>] [--locale=<locale>] [--lang=<lang>] [options]
ios prepare cloudconfig [options]
ios prepare create-cert
ios prepare printskip
ios wifi [--ssid=<ssid>] [--password=<password>] [--enc-type=<encType>] [--remove] [options]
ios profile add <profileFile> [--p12file=<orgid>] [--password=<p12password>] [options]
ios profile list [options]
ios profile remove <profileName> [options]
ios ps [--apps] [options]
ios readpair [options]
ios reboot [options]
ios resetax [options]
ios resetlocation [options]
ios rsd ls [options]
ios runtest [--bundle-id=<bundleid>] [--test-runner-bundle-id=<testrunnerbundleid>] [--xctest-config=<xctestconfig>] [--log-output=<file>] [--xctest] [--test-to-run=<tests>]... [--test-to-skip=<tests>]... [--env=<e>]... [options]
ios runwda [--bundleid=<bundleid>] [--testrunnerbundleid=<testbundleid>] [--xctestconfig=<xctestconfig>] [--log-output=<file>] [--arg=<a>]... [--env=<e>]... [options]
ios runxctest [--xctestrun-file-path=<xctestrunFilePath>] [--log-output=<file>] [options]
ios screenshot [options] [--output=<outfile>] [--stream] [--port=<port>]
ios sign certificate appstoreconnect --asc-key-id=<keyid> --asc-issuer-id=<issuerid> --asc-private-key=<p8file> [--p12-output=<p12file>] [--p12password=<password>] [--revoke-existing] [options]
ios sign provision appstoreconnect --bundleid=<bundleid> --asc-key-id=<keyid> --asc-issuer-id=<issuerid> --asc-private-key=<p8file> --profile-output=<mobileprovision> [--p12-output=<p12file>] [--certificate-id=<id>] [--revoke-existing] [--p12password=<password>] [--bundle-name=<name>] [--profile-name=<name>] [--device-name=<name>] [options]
ios sign app --path=<ipaOrAppFolder> --p12file=<p12file> --profile=<mobileprovision> [--p12password=<password>] [--output=<signedPath>] [--bundleid=<bundleid>] [--install] [options]
ios setlocation [options] [--lat=<lat>] [--lon=<lon>]
ios setlocationgpx [options] [--gpxfilepath=<gpxfilepath>]
ios shutdown [options]
ios set-wallpaper <imagePath> [--screen=<screen>] [--p12file=<orgid>] [--password=<p12password>] [options]
ios get-wallpaper [--output=<outfile>] [options]
ios get-icon-layout [--output=<outfile>] [options]
ios set-icon-layout <layoutFile> [options]
ios syslog [--parse] [options]
ios ostrace [--pid=<processID>] [--process=<processName>] [--follow] [--level=<levels>] [--subsystem=<sub>] [--match=<str>] [--exclude=<str>] [options]
ios sysmontap [options]
ios timeformat (24h | 12h | toggle | get) [--force] [options]
ios tunnel ls [options]
ios tunnel stop [options]
ios tunnel refresh [options]
ios tunnel start [options] [--pair-record-path=<pairrecordpath>] [--userspace]
ios tunnel stopagent
ios ui install (wda | devicekit) --p12file=<p12file> --profile=<mobileprovision> [--p12password=<password>] [--path=<ipaOrZipOrApp>] [--output=<signedPath>] [--bundleid=<bundleid>] [options]
ios ui run (wda | devicekit) [--bundleid=<bundleid>] [--test-runner-bundleid=<id>] [--xctest-config=<name>] [--host-port=<port>] [--log-output=<file>] [options]
ios ui download [(wda | devicekit | all)] [--output=<dir>] [options]
ios ui status [--driver=<driver>] [--wda-url=<url>] [--devicekit-url=<url>] [options]
ios ui api [--driver=<driver>] [--method=<method>] [--http-path=<path>] [--body=<json>] [--body-file=<file>] [--rpc-method=<method>] [--params=<json>] [--params-file=<file>] [--wda-url=<url>] [--devicekit-url=<url>] [options]
ios ui raw [--driver=<driver>] [--method=<method>] [--http-path=<path>] [--body=<json>] [--body-file=<file>] [--rpc-method=<method>] [--params=<json>] [--params-file=<file>] [--wda-url=<url>] [--devicekit-url=<url>] [options]
ios ui tap --x=<x> --y=<y> [--driver=<driver>] [--session-id=<sessionid>] [--wda-url=<url>] [--devicekit-url=<url>] [options]
ios ui swipe --from-x=<x> --from-y=<y> --to-x=<x> --to-y=<y> [--duration=<seconds>] [--driver=<driver>] [--session-id=<sessionid>] [--wda-url=<url>] [--devicekit-url=<url>] [options]
ios ui longpress --x=<x> --y=<y> [--duration=<seconds>] [--driver=<driver>] [--session-id=<sessionid>] [--wda-url=<url>] [--devicekit-url=<url>] [options]
ios ui type --text=<text> [--driver=<driver>] [--session-id=<sessionid>] [--wda-url=<url>] [--devicekit-url=<url>] [options]
ios ui button <button> [--driver=<driver>] [--session-id=<sessionid>] [--wda-url=<url>] [--devicekit-url=<url>] [options]
ios ui screenshot [--output=<outfile>] [--driver=<driver>] [--session-id=<sessionid>] [--wda-url=<url>] [--devicekit-url=<url>] [options]
ios ui source [--output=<outfile>] [--driver=<driver>] [--session-id=<sessionid>] [--wda-url=<url>] [--devicekit-url=<url>] [options]
ios ui size [--driver=<driver>] [--session-id=<sessionid>] [--wda-url=<url>] [--devicekit-url=<url>] [options]
ios ui orientation get [--driver=<driver>] [--session-id=<sessionid>] [--wda-url=<url>] [--devicekit-url=<url>] [options]
ios ui orientation set <orientation> [--driver=<driver>] [--session-id=<sessionid>] [--wda-url=<url>] [--devicekit-url=<url>] [options]
ios ui app launch <bundleID> [--driver=<driver>] [--session-id=<sessionid>] [--wda-url=<url>] [--devicekit-url=<url>] [options]
ios ui app terminate <bundleID> [--driver=<driver>] [--session-id=<sessionid>] [--wda-url=<url>] [--devicekit-url=<url>] [options]
ios ui app foreground [--driver=<driver>] [--devicekit-url=<url>] [options]
ios ui stream (mjpeg | h264) [--fps=<fps>] [--quality=<quality>] [--scale=<scale>] [--bitrate=<bitrate>] [--driver=<driver>] [--wda-url=<url>] [--devicekit-url=<url>] [options]
ios uninstall <bundleID> [options]
ios webinspector list [--timeout=<seconds>] [options]
ios webinspector launch <url> [--bundle-id=<bundleID>] [--timeout=<seconds>] [options]
ios webinspector eval <pageID> <expression> [--timeout=<seconds>] [--console-enable] [options]
ios webinspector js-shell [<url>] [--bundle-id=<bundleID>] [--open-safari] [--timeout=<seconds>] [--console-enable] [options]
ios webinspector cdp [--host=<host>] [--port=<port>] [options]
ios voiceover (enable | disable | toggle | get) [--force] [options]
ios zoom (enable | disable | toggle | get) [--force] [options]
Options:
-v --verbose Enable Debug Logging.
-t --trace Enable Trace Logging (dump every message).
--nojson Disable JSON output
--pretty Pretty-print JSON command output
-h --help Show this screen.
--udid=<udid> UDID of the device. Can also be set via GO_IOS_UDID environment variable.
--tunnel-info-port=<port> When go-ios is used to manage tunnels for iOS 17+,
it exposes them on an HTTP-API (default port: 28100)
--tunnel-info-host=<host> Host the tunnel-info HTTP-API binds to and is queried on.
Defaults to 127.0.0.1, or the GO_IOS_AGENT_HOST environment variable
if set. Use 0.0.0.0 to reach the API from another host or container.
--address=<ipv6addrr> Address of the device on the interface.
This parameter is optional and can be set if a tunnel created by MacOS needs to be used.
To get this value run "log stream --debug --info --predicate 'eventMessage LIKE "*Tunnel established*" OR eventMessage LIKE "*for server port*"'",
connect a device and open Xcode
--rsd-port=<port> Port of remote service discovery on the device through the tunnel
This parameter is similar to '--address' and can be obtained by the same log filter
--proxyurl=<url> Set this if you want go-ios to use a http proxy for outgoing requests,
like for downloading images or contacting Apple during device activation.
A simple format like: "http://PROXY_LOGIN:PROXY_PASS@proxyIp:proxyPort" works.
Otherwise use the HTTP_PROXY system env var.
--userspace-port=<port> Optional. Set this if you run a command supplying rsd-port and address and your device is using userspace tunnel
--asc-key-id=<keyid> App Store Connect API key id. Can also be set via GO_IOS_ASC_KEY_ID.
--asc-issuer-id=<issuerid>
App Store Connect API issuer id. Can also be set via GO_IOS_ASC_ISSUER_ID.
--asc-private-key=<p8file>
App Store Connect API .p8 private key path. Can also be set via GO_IOS_ASC_PRIVATE_KEY.
--revoke-existing Revoke every existing iOS Development certificate before creating a new one. Apple allows only one current development certificate, so set this to keep provisioning repeatable (use only on a dedicated signing account, e.g. CI).
--certificate-id=<id> Provision a profile against an existing App Store Connect certificate (by resource id) instead of creating one. No certificate is created/revoked and no P12 is written; reuse a pre-provisioned signing identity.
--p12file=<p12file> P12 identity file path.
--profile=<mobileprovision>
Provisioning profile path for app signing.
--driver=<driver> UI automation backend: devicekit, wda, or auto. Defaults to devicekit.
--wda-url=<url> WebDriverAgent base URL. Defaults to http://127.0.0.1:8100 or GO_IOS_WDA_URL.
--devicekit-url=<url> DeviceKit base URL. Defaults to http://127.0.0.1:12004 or GO_IOS_DEVICEKIT_URL.
The commands work as following:
The default output of all commands is JSON. Should you prefer human readable outout, specify the --nojson option with your command.
By default, the first device found will be used for a command unless you specify a --udid=some_udid switch.
Specify -v for debug logging and -t for dumping every message.
ios --version | version [options] Prints the version
ios -h | --help Prints this screen.
ios activate [options] Activate a device
ios apps [--system] [--all] [--list] [--filesharing] Retrieves a list of installed applications.
--system prints out preinstalled system apps.
--all prints all apps, including system, user, and hidden apps.
--list only prints bundle ID, bundle name and version number.
--filesharing only prints apps which enable documents sharing.
ios assistivetouch (enable | disable | toggle | get) [--force] [options]
Enables, disables, toggles, or returns the state of the "AssistiveTouch" software home-screen button.
iOS 11+ only (Use --force to try on older versions).
ios ax [--font=<fontSize>] [options] Access accessibility inspector features.
ios ax audit [options] Run the accessibility audit on the focused app and print the issues as JSON.
Each issue includes its type, the element's label and on-screen rect.
ios batterycheck [options] Prints battery info.
ios batteryregistry [options] Prints battery registry stats like Temperature, Voltage.
ios crash cp <srcpattern> <target> [options] Copy "file pattern" to the target dir. Ex.: 'ios crash cp "*" "./crashes"'
ios crash ls [<pattern>] [options] Run "ios crash ls" to get all crashreports in a list,
or use a pattern like 'ios crash ls "*ips*"' to filter
ios crash rm <cwd> <pattern> [options] Remove file pattern from dir. Ex.: 'ios crash rm "." "*"' to delete everything
ios date [options] Prints the device date
ios debug [--stop-at-entry] <app_path> Start debug with lldb
ios devicename [options] Prints the devicename
ios devicestate enable <profileTypeId> <profileId> [options] Enables a profile with ids (use the list command to see options).
It will only stay active until the process is terminated.
Ex. "ios devicestate enable SlowNetworkCondition SlowNetwork3GGood"
ios devicestate list [options] Prints a list of all supported device conditions, like slow network, gpu etc.
ios devmode (enable | get | reveal) [--enable-post-restart] [options]
Enable developer mode on the device, check if it is enabled,
or reveal the Developer Mode toggle in Settings.
Can also completely finalize developer mode setup after device is restarted.
ios diagnostics list [options] List diagnostic infos
ios diskspace [options] Prints disk space info.
ios dproxy [--binary] [--mode=<all(default)|usbmuxd|utun>] [--iface=<iface>] [options]
Starts the reverse engineering proxy server.
It dumps every communication in plain text so it can be implemented easily.
Use "sudo launchctl unload -w /Library/Apple/System/Library/LaunchDaemons/com.apple.usbmuxd.plist"
to stop usbmuxd and load to start it again should the proxy mess up things.
The --binary flag will dump everything in raw binary without any decoding.
ios erase [--force] [options] Erase the device. It will prompt you to input y+Enter unless --force is specified.
ios file ls [--app=<bundleID> | --app-group=<groupID> | --crash | --temp] [--path=<path>] [options]
List files using RemoteXPC (iOS 17+). Requires tunnel.
Use --app for app container, --app-group for app group,
--crash for crash logs, or --temp for temporary files.
ios file pull [--app=<bundleID> | --app-group=<groupID> | --crash | --temp] --remote=<remotePath> --local=<localPath> [options]
Download file using RemoteXPC (iOS 17+). Requires tunnel.
ios file push [--app=<bundleID> | --app-group=<groupID> | --crash | --temp] --local=<localPath> --remote=<remotePath> [options]
Upload file using RemoteXPC (iOS 17+).
Requires tunnel. Preserves source file permissions.
ios forward [options] [<hostPort> <targetPort>] [--port=<mapping>]...
Forward TCP connections to device.
Use --port for multiple ports: --port=8100:8100 --port=9191:9191
ios fsync [--app=bundleId] [options] (pull | push) --srcPath=<srcPath> --dstPath=<dstPath>
Pull or Push file from srcPath to dstPath.
ios fsync [--app=bundleId] [options] (rm [--r] | tree | mkdir) --path=<targetPath>
Remove | treeview | mkdir in target path.
--r used alongside rm will recursively remove all files and directories from target path.
ios httpproxy <host> <port> [<user>] [<pass>] --p12file=<orgid> [--password=<p12password>]
Set global http proxy on supervised device.
Use the password argument or set the environment variable 'P12_PASSWORD'
Specify proxy password either as argument or using the environment var: PROXY_PASSWORD
Use p12 file and password for silent installation on supervised devices.
ios httpproxy remove [options] Removes the global http proxy config. Only works with http proxies set by go-ios!
ios image auto [--basedir=<where_dev_images_are_stored>] [options] Automatically download correct dev image from the internets and mount it.
You can specify a dir where images should be cached.
The default is the current dir.
ios image list [options] List currently mounted developers images' signatures
ios image mount [--path=<imagepath>] [options] Mount a image from <imagepath>
For iOS 17+ (personalized developer disk images),
<imagepath> must point to the "Restore" directory inside the developer disk
ios image unmount [options] Unmount developer disk image
ios info [display | lockdown] [options] Prints a dump of device information from the given source.
ios install --path=<ipaOrAppFolder> [options] Specify a .app folder or an installable ipa file that will be installed.
ios instruments notifications [options] Listen to application state notifications
ios ip [options] Uses the live pcap iOS packet capture to wait until it finds one that contains the IP address of the device.
It relies on the MAC address of the WiFi adapter to know which is the right IP.
You have to disable the "automatic wifi address"-privacy feature of the device for this to work.
If you wanna speed it up, open apple maps or similar to force network traffic.
Ex.: "ios launch com.apple.Maps"
ios kill (<bundleID> | --pid=<processID> | --process=<processName>) [options]
Kill app with the specified bundleID, process id, or process name on the device.
ios lang [--setlocale=<locale>] [--setlang=<newlang>] [options] Sets or gets the Device language. ios lang will print the current language and locale,
as well as a list of all supported langs and locales.
ios launch <bundleID> [--wait] [--kill-existing] [--arg=<a>]... [--env=<e>]... [options]
Launch app with the bundleID on the device. Get your bundle ID from the apps command.
--wait keeps the connection open if you want logs.
ios list [options] [--details] Prints a list of all connected device's udids.
If --details is specified, it includes version, name and model of each device.
ios listen [options] Keeps a persistent connection open and notifies about newly connected or disconnected devices.
ios lockdown get [<key>] [--domain=<domain>] [options] Query lockdown values. Without arguments returns all values. Specify a key to get a specific value.
Use --domain to query from a specific domain (e.g., com.apple.disk_usage, com.apple.PurpleBuddy).
Ex.: "ios lockdown get DeviceName", "ios lockdown get --domain=com.apple.PurpleBuddy"
ios memlimitoff (--process=<processName>) [options] Waives memory limit set by iOS (For instance a Broadcast Extension limit is 50 MB).
ios mobilegestalt <key>... [--plist] [options] Lets you query mobilegestalt keys.
Standard output is json but if desired you can get it in plist format by adding the --plist param.
Ex.: "ios mobilegestalt MainScreenCanvasSizes ArtworkTraits --plist"
ios pair [--p12file=<orgid>] [--password=<p12password>] [options] Pairs the device. If the device is supervised, specify the path to the p12 file
to pair without a trust dialog. Specify the password either with the argument or
by setting the environment variable 'P12_PASSWORD'
ios pcap [options] [--pid=<processID>] [--process=<processName>] Starts a pcap dump of network traffic, use --pid or --process to filter specific processes.
ios prepare [--skip-all] [--skip=<option>]... [--certfile=<cert_file_path>] [--orgname=<org_name>] [--p12password=<p12password>] [--locale] [--lang] [options]
Prepare a device. Use skip-all to skip everything multiple --skip args to skip only a subset.
You can use 'ios prepare printskip' to get a list of all options to skip.
Use certfile and orgname if you want to supervise the device.
The certfile can be a DER file, PEM file, or P12 file. For P12 files,
specify the password with --p12password or P12_PASSWORD env var.
If you need certificates to supervise,
run 'ios prepare create-cert' and go-ios will generate one you can use.
--locale and --lang are optional, the default is en_US and en.
Run 'ios lang' to see a list of all supported locales and languages.
ios prepare cloudconfig Print the cloud configuration of the device as JSON.
ios prepare create-cert A nice util to generate a certificate you can use for supervising devices.
Make sure you rename and store it in a safe place.
ios prepare printskip Print all options you can skip.
ios wifi [--ssid=<ssid>] [--password=<password>] [--enc-type=<encType>] [--remove]
Installs a wifi profile on the device forcing a connection to the provided WiFi network
If --remove is specified, the wifi profile of the provided ssid will be removed.
ios profile add <profileFile> [--p12file=<orgid>] [--password=<p12password>]
Install profile file on the device.
If supervised set p12file and password or the environment variable 'P12_PASSWORD'
ios profile list List the profiles on the device
ios profile remove <profileName> Remove the profileName from the device
ios ps [--apps] [options] Dumps a list of running processes on the device.
Use --nojson for a human-readable listing including BundleID when available (not included with JSON output).
--apps limits output to processes flagged by iOS as "isApplication".
This greatly-filtered list should at least include user-installed software.
Additional packages will also be displayed depending on the version of iOS.
ios readpair Dump detailed information about the pairrecord for a device.
ios reboot [options] Reboot the given device
ios resetax [options] Reset accessibility settings to defaults.
ios resetlocation [options] Resets the location of the device to the actual one
ios rsd ls [options] List RSD services and their port.
ios runtest [--bundle-id=<bundleid>] [--test-runner-bundle-id=<testbundleid>] [--xctest-config=<xctestconfig>] [--log-output=<file>] [--xctest] [--test-to-run=<tests>]... [--test-to-skip=<tests>]... [--env=<e>]... [options]
Run a XCUITest.
If you provide only bundle-id go-ios will try to dynamically create test-runner-bundle-id and xctest-config.
If you provide '-' as log output, it prints resuts to stdout.
To be able to filter for tests to run or skip, use one argument per test selector.
Ex.: runtest --test-to-run=(TestTarget.)TestClass/testMethod (the value for 'TestTarget' is optional)
The method name can also be omitted and in this case all tests of the specified class are run
ios runwda [--bundleid=<bundleid>] [--testrunnerbundleid=<testbundleid>] [--xctestconfig=<xctestconfig>] [--log-output=<file>] [--arg=<a>]... [--env=<e>]...[options]
Runs WebDriverAgents
Specify runtime args and env vars like --env ENV_1=something --env ENV_2=else and --arg ARG1 --arg ARG2
ios runxctest [--xctestrun-file-path=<xctestrunFilePath>] [--log-output=<file>] [options]
Run a XCTest.
The --xctestrun-file-path specifies the path to the .xctestrun file to configure the test execution.
If you provide '-' as log output, it prints resuts to stdout.
ios screenshot [options] [--output=<outfile>] [--stream] [--port=<port>]
Takes a screenshot and writes it to the current dir or to <outfile>
If --stream is supplied it starts an mjpeg server at 0.0.0.0:3333.
Use --port to set another port.
ios sign provision appstoreconnect --bundleid=<bundleid> --asc-key-id=<keyid> --asc-issuer-id=<issuerid> --asc-private-key=<p8file> --p12-output=<p12file> --profile-output=<mobileprovision>
Creates an iOS development signing certificate, P12, and provisioning profile through App Store Connect.
This command does not sign an app. Pass --revoke-existing to revoke a leftover go-ios certificate first (repeatable provisioning).
ios sign app --path=<ipaOrAppFolder> --p12file=<p12file> --profile=<mobileprovision>
Resigns the IPA or .app with go-codesign using local signing files,
and optionally installs the signed result with --install.
For WDA or DeviceKit artifacts, run "ios ui download" first and pass the downloaded path with --path.
ios ui install (wda | devicekit) --p12file=<p12file> --profile=<mobileprovision>
Downloads the default DeviceKit or WDA artifact from deviceboxhq.com unless --path is provided,
signs it with local signing files, and installs it on the selected device.
Run "ios ui download" to pre-download artifacts, or pass --path to use your own local build.
ios ui run (wda | devicekit) [--bundleid=<bundleid>] [--host-port=<port>] [--log-output=<file>]
Runs an installed UI automation runner (WebDriverAgent or DeviceKit) and forwards
its port to the host, so "ios ui ..." can reach it at http://127.0.0.1:<host-port>
(defaults: WDA 8100, DeviceKit 12004). Blocks until interrupted. The run
counterpart to "ios ui install".
ios ui download [(wda | devicekit | all)] [--output=<dir>] Downloads default WDA and/or DeviceKit artifacts from deviceboxhq.com,
extracts zip artifacts, and prints JSON describing the files.
Use the printed artifactPath or appPath with "ios ui install --path" or "ios sign app --path".
ios ui status [--driver=<driver>] Checks the configured UI automation backend. Defaults to DeviceKit.
ios ui api [--driver=<driver>] Calls a backend-specific API directly.
For WDA, pass --http-path=<path>, optionally --method=<method> and --body=<json>.
For DeviceKit, pass --rpc-method=<method>, optionally --params=<json>.
Use --driver=auto to probe DeviceKit first, then WDA.
"raw" is accepted as an alias for "api".
ios ui tap --x=<x> --y=<y> Taps at screen coordinates.
ios ui swipe --from-x=<x> --from-y=<y> --to-x=<x> --to-y=<y> Swipes between screen coordinates.
ios ui longpress --x=<x> --y=<y> [--duration=<seconds>] Long-presses at screen coordinates.
ios ui type --text=<text> Types text.
ios ui button <button> Presses a button. DeviceKit supports more buttons; WDA supports home.
ios ui screenshot [--output=<outfile>] Saves a screenshot, or writes PNG bytes to stdout.
ios ui source [--output=<outfile>] Dumps the UI hierarchy.
ios ui size Prints screen or window size information.
ios ui orientation (get | set <orientation>) Gets or sets orientation.
ios ui app (launch | terminate) <bundleID> Launches or terminates an app.
ios ui app foreground Prints the foreground app through DeviceKit.
ios ui stream (mjpeg | h264) Streams video to stdout. H264 requires DeviceKit; WDA supports MJPEG.
ios setlocation [options] [--lat=<lat>] [--lon=<lon>] Updates the location of the device to the provided by latitude and longitude coordinates.
Ex.: setlocation --lat=40.730610 --lon=-73.935242
ios setlocationgpx [options] [--gpxfilepath=<gpxfilepath>] Updates the location of the device based on the data in a GPX file.
Ex.: setlocationgpx --gpxfilepath=/home/username/location.gpx
ios shutdown [options] Shuts down the device
ios set-wallpaper <imagePath> [--screen=<screen>] [--p12file=<orgid>] [--password=<p12password>] [options]
Set the device wallpaper from a JPEG/PNG file. --screen is lock|home|both (default home).
Requires supervision: pass the supervisor identity .p12 with --p12file and the password
via --password or P12_PASSWORD env var. Note: on iOS 16+ both lock and home screens are
linked as a pair, so the device sets both regardless of --screen. The flag is preserved
for older-iOS / forward-compat. Apple's own cfgutil exhibits the same behavior.
ios get-wallpaper [--output=<outfile>] [options] Save the home screen wallpaper as PNG. Default output is wallpaper.png.
Does not require supervision. Lock screen wallpaper is not exposed by iOS.
Note: this RPC may EOF on iOS 18 (see pymobiledevice3 #1450).
ios get-icon-layout [--output=<outfile>] [options] Save the home screen icon layout as JSON (default stdout). Round-trippable: feed the
file back to set-icon-layout to restore. Note: the iOS 14+ "Edit Pages" per-page
hidden bit is not exposed by springboardservices, so a fetched layout will not include
hidden pages.
ios set-icon-layout <layoutFile> [options] Push a previously-saved icon layout JSON file back to the device.
iOS requires every installed app to occupy a slot. Per cfgutil docs: "unexpected
behavior may occur if the given layout does not contain every icon on the device".
Missing apps are re-paginated, not hidden.
ios syslog [--parse] [options] Prints a device's log output, Use --parse to parse the fields from the log
ios ostrace [--pid=<processID>] [--process=<processName>] [--follow] [--level=<levels>] [--subsystem=<sub>] [--match=<str>] [--exclude=<str>]
Stream structured syslog via os_trace_relay. Note: streaming logs
places significant CPU load on the device.
--follow Keep running and reconnect when the process exits or restarts.
When used with --process, polls until the process appears.
Device-side filters (reduce USB traffic):
--pid=<pid> Only stream logs from this process ID
--process=<name> Resolve process name to PID, then filter device-side
--level=<levels> Filter by OS log type (comma-separated): default,info,debug,error,fault
Client-side filters (applied after receiving, does not reduce USB traffic):
--subsystem=<sub> Only show entries matching this subsystem (substring match)
--match=<str> Only show entries where the message contains this string
--exclude=<str> Hide entries where the message contains this string
ios sysmontap Get system stats like MEM, CPU
ios timeformat (24h | 12h | toggle | get) [--force] [options] Sets, or returns the state of the "time format".
iOS 11+ only (Use --force to try on older versions).
ios tunnel ls List currently started tunnels.
Use --enabletun to activate using TUN devices rather than user space network.
Requires sudo/admin shells.
ios tunnel stop --udid=<udid> Stop the tunnel for one device without stopping the tunnel agent.
ios tunnel refresh --udid=<udid> Stop the tunnel for one device and wait until the agent recreates it.
ios tunnel start [options] [--pair-record-path=<pairrecordpath>] [--enabletun]
Creates a tunnel connection to the device.
If the device was not paired with the host yet, device pairing will also be executed.
On systems with System Integrity Protection enabled the argument '--pair-record-path=default'
can be used to point to /var/db/lockdown/RemotePairing/user_501.
WARNING: macOS 26 (Tahoe) and newer block that path for third-party binaries via TCC
('operation not permitted'). On those systems do NOT use '=default'; pass a stable
writable directory instead (e.g. --pair-record-path=/Users/Shared/go-ios) and go-ios
will manage its own tunnel identity. See https://github.com/danielpaulus/go-ios/issues/710
If nothing is specified, the current dir is used for the pair record.
Pass --udid=<udid> to restrict the agent to a single device (isolated
per-device tunnel agent); run one per device on its own --tunnel-info-port.
This command needs to be executed with admin privileges.
(On MacOS the process 'remoted' must be paused before starting a tunnel,
is possible 'sudo pkill -SIGSTOP remoted', and 'sudo pkill -SIGCONT remoted' to resume)
ios webinspector list [--timeout=<seconds>] [options] List inspectable Safari/WebView pages.
ios webinspector launch <url> [--bundle-id=<bundleID>] [--timeout=<seconds>] [options]
Launch Safari or another app and navigate by Remote Automation.
ios webinspector eval <pageID> <expression> [--timeout=<seconds>] [--console-enable] [options]
Evaluate JavaScript in an inspectable page.
ios webinspector js-shell [<url>] [--bundle-id=<bundleID>] [--open-safari] [--timeout=<seconds>] [--console-enable] [options]
Start an interactive JavaScript shell for an inspectable page.
ios webinspector cdp [--host=<host>] [--port=<port>] [options] Start a Chrome DevTools Protocol bridge.
ios voiceover (enable | disable | toggle | get) [--force] [options] Enables, disables, toggles, or returns the state of the "VoiceOver" software home-screen button.
iOS 11+ only (Use --force to try on older versions).
ios zoom (enable | disable | toggle | get) [--force] [options] Enables, disables, toggles, or returns the state of the "ZoomTouch" software home-screen button.
iOS 11+ only (Use --force to try on older versions).
`, version)
arguments, err := docopt.ParseDoc(usage)
exitIfError("failed parsing args", err)
configureCLI(arguments)
if dispatchCommand(commandContext{Args: arguments}, preProxyCommands) {
return
}
proxyUrl, _ := arguments.String("--proxyurl")
exitIfError("could not parse proxy url", ios.UseHttpProxy(proxyUrl))
if dispatchCommand(commandContext{Args: arguments}, globalCommands) {
return
}
tunnelInfo := tunnelInfoConfigFromArgs(arguments)
device := resolveDevice(arguments, tunnelInfo)
if dispatchCommand(commandContext{Args: arguments, Device: device}, deviceCommands) {
return
}
if dispatchTunnelCommand(tunnelCommandContext{
Args: arguments,
TunnelInfoHost: tunnelInfo.Host,
TunnelInfoPort: tunnelInfo.Port,
}) {
return
}
}
func printSysmontapStats(device ios.DeviceEntry) {
const xcodeDefaultSamplingRate = 10
sysmon, err := instruments.NewSysmontapService(device, xcodeDefaultSamplingRate)
if err != nil {
exitIfError("systemMonitor creation error", err)
}
defer sysmon.Close()
cpuUsageChannel := sysmon.ReceiveCPUUsage()
c := make(chan os.Signal, 1)
signal.Notify(c, os.Interrupt)
slog.Info("starting to monitor CPU usage... Press CTRL+C to stop.")
for {
select {
case cpuUsageMsg, ok := <-cpuUsageChannel:
if !ok {
slog.Info("CPU usage channel closed.")
return
}
slog.Info("received CPU usage data",
"cpu_count", cpuUsageMsg.CPUCount,
"enabled_cpus", cpuUsageMsg.EnabledCPUs,
"end_time", cpuUsageMsg.EndMachAbsTime,
"cpu_total_load", cpuUsageMsg.SystemCPUUsage.CPU_TotalLoad,
)
case <-c:
slog.Info("shutting down sysmontap")
return
}
}
}
func toArgs(argsIn []string) []interface{} {
args := []interface{}{}
for _, arg := range argsIn {
args = append(args, arg)
}
return args
}
func toEnvs(envsIn []string) map[string]interface{} {
env := map[string]interface{}{}
for _, entrystring := range envsIn {
entry := strings.Split(entrystring, "=")
key := entry[0]
value := entry[1]
env[key] = value
}
return env
}
func deviceState(device ios.DeviceEntry, list bool, enable bool, profileTypeId string, profileId string) {
control, err := instruments.NewDeviceStateControl(device)
exitIfError("failed to connect to deviceStateControl", err)
profileTypes, err := control.List()
if list {
if JSONdisabled {
outputPrettyStateList(profileTypes)
} else {
b, err := marshalJSON(profileTypes)
exitIfError("failed json conversion", err)
fmt.Println(string(b))
}
return
}
exitIfError("failed listing device states", err)
if enable {
pType, profile, err := instruments.VerifyProfileAndType(profileTypes, profileTypeId, profileId)
exitIfError("invalid arguments", err)
slog.Info("Enabling profile.. (this can take a while for ThermalConditions)")
err = control.Enable(pType, profile)
exitIfError("could not enable profile", err)
slog.Info(fmt.Sprintf("Profile %s - %s is active! waiting for SIGTERM..", profileTypeId, profileId))
c := make(chan os.Signal, syscall.SIGTERM)
signal.Notify(c, os.Interrupt)
<-c
slog.Info(fmt.Sprintf("Disabling profiletype %s", profileTypeId))
err = control.Disable(pType)
exitIfError("could not disable profile", err)
slog.Info("ok")
}
}
func outputPrettyStateList(types []instruments.ProfileType) {
var buffer bytes.Buffer
for i, ptype := range types {
buffer.WriteString(
fmt.Sprintf("ProfileType %d\nName:%s\nisActive:%v\nIdentifier:%s\n\n",
i, ptype.Name, ptype.IsActive, ptype.Identifier,
),
)
for i, profile := range ptype.Profiles {
buffer.WriteString(fmt.Sprintf("\tProfile %d:%s\n\tIdentifier:%s\n\t%s",
i, profile.Name, profile.Identifier, profile.Description),
)
buffer.WriteString("\n\t------\n")
}
buffer.WriteString("\n\n")
}
fmt.Println(buffer.String())
}
func listMountedImages(device ios.DeviceEntry) {
conn, err := imagemounter.NewImageMounter(device)
exitIfError("failed connecting to image mounter", err)
signatures, err := conn.ListImages()
exitIfError("failed getting image list", err)
if len(signatures) == 0 {
slog.Info("none")
return
}
for _, sig := range signatures {
slog.Info("image signature", "signature", fmt.Sprintf("%x", sig))
}
}
func installApp(device ios.DeviceEntry, path string) {
slog.Info("installing", "appPath", path, "device", device.Properties.SerialNumber)
conn, err := zipconduit.New(device)
exitIfError("failed connecting to zipconduit, dev image installed?", err)
err = conn.SendFile(path)
exitIfError("failed writing", err)
}
func uninstallApp(device ios.DeviceEntry, bundleId string) {
slog.Info("uninstalling", "appPath", bundleId, "device", device.Properties.SerialNumber)
svc, err := installationproxy.New(device)
exitIfError("failed connecting to installationproxy", err)
err = svc.Uninstall(bundleId)
exitIfError("failed uninstalling", err)
}
func language(device ios.DeviceEntry, locale string, language string) {
lang, err := ios.GetLanguage(device)
exitIfError("failed getting language", err)
err = ios.SetLanguage(device, ios.LanguageConfiguration{Language: language, Locale: locale})
exitIfError("failed setting language", err)
if lang.Language != language && language != "" {
slog.Debug("Language should be changed waiting for Springboard to reboot", "from", lang.Language, "to", language)
notificationproxy.WaitUntilSpringboardStarted(device)
}
lang, err = ios.GetLanguage(device)
exitIfError("failed getting language", err)
fmt.Println(convertToJSONString(lang))
}
func assistiveTouch(device ios.DeviceEntry, operation string, force bool) {
var enable bool
if !force {
version, err := ios.GetProductVersion(device)
exitIfError("failed getting device product version", err)
if version.LessThan(ios.IOS11()) {
slog.Error("iOS Version 11.0+ required to manipulate AssistiveTouch. Use --force to override.", "version", version)
os.Exit(1)
}
}
wasEnabled, err := ios.GetAssistiveTouch(device)
if err != nil {
if force && (operation == "enable" || operation == "disable") {
slog.Warn("Failed getting current AssistiveTouch status. Continuing anyway.", "error", err)
} else {
exitIfError("failed getting current AssistiveTouch status", err)
}
}
switch {
case operation == "enable":
enable = true
case operation == "disable":
enable = false
case operation == "toggle":
enable = !wasEnabled
default: // get
enable = wasEnabled
}
if operation != "get" && (force || wasEnabled != enable) {
err = ios.SetAssistiveTouch(device, enable)
exitIfError("failed setting AssistiveTouch", err)
}
if operation == "get" {
if JSONdisabled {
fmt.Printf("%t\n", enable)
} else {
fmt.Println(convertToJSONString(map[string]bool{"AssistiveTouchEnabled": enable}))
}
}
}
func voiceOver(device ios.DeviceEntry, operation string, force bool) {
var enable bool
if !force {
version, err := ios.GetProductVersion(device)
exitIfError("failed getting device product version", err)
if version.LessThan(ios.IOS11()) {
slog.Error("iOS Version 11.0+ required to manipulate VoiceOver. Use --force to override.", "version", version)
os.Exit(1)
}
}
wasEnabled, err := ios.GetVoiceOver(device)
if err != nil {
if force && (operation == "enable" || operation == "disable") {
slog.Warn("Failed getting current VoiceOver status. Continuing anyway.", "error", err)
} else {
exitIfError("failed getting current VoiceOver status", err)
}
}
switch {
case operation == "enable":
enable = true
case operation == "disable":
enable = false
case operation == "toggle":
enable = !wasEnabled
default: // get
enable = wasEnabled
}
if operation != "get" && (force || wasEnabled != enable) {
err = ios.SetVoiceOver(device, enable)
exitIfError("failed setting VoiceOver", err)
}
if operation == "get" {
if JSONdisabled {
fmt.Printf("%t\n", enable)
} else {
fmt.Println(convertToJSONString(map[string]bool{"VoiceOverTouchEnabled": enable}))
}
}
}
func zoomTouch(device ios.DeviceEntry, operation string, force bool) {
var enable bool
if !force {
version, err := ios.GetProductVersion(device)
exitIfError("failed getting device product version", err)
if version.LessThan(ios.IOS11()) {
slog.Error("iOS Version 11.0+ required to manipulate ZoomTouch. Use --force to override.", "version", version)
os.Exit(1)
}
}
wasEnabled, err := ios.GetZoomTouch(device)
if err != nil {
if force && (operation == "enable" || operation == "disable") {
slog.Warn("Failed getting current ZoomTouch status. Continuing anyway.", "error", err)
} else {
exitIfError("failed getting current VoiceOver status", err)
}
}
switch {
case operation == "enable":
enable = true
case operation == "disable":
enable = false
case operation == "toggle":
enable = !wasEnabled
default: // get
enable = wasEnabled
}
if operation != "get" && (force || wasEnabled != enable) {
err = ios.SetZoomTouch(device, enable)
exitIfError("failed setting VoiceOver", err)
}
if operation == "get" {
if JSONdisabled {
fmt.Printf("%t\n", enable)
} else {
fmt.Println(convertToJSONString(map[string]bool{"ZoomTouchEnabled": enable}))
}
}
}
func timeFormat(device ios.DeviceEntry, operation string, force bool) {
var enable bool
if !force {
version, err := ios.GetProductVersion(device)
exitIfError("failed getting device product version", err)
if version.LessThan(ios.IOS11()) {
slog.Error("iOS Version 11.0+ required to manipulate Time Format. Use --force to override.", "version", version)
os.Exit(1)
}
}
wasEnabled, err := ios.GetUses24HourClock(device)
if err != nil {
if force && (operation == "24h" || operation == "12h") {
slog.Warn("Failed getting current TimeFormat value. Continuing anyway.", "error", err)
} else {
exitIfError("failed getting current TimeFormat value", err)
}
}
switch {
case operation == "24h":
enable = true
case operation == "12h":
enable = false
case operation == "toggle":
enable = !wasEnabled
default: // get
enable = wasEnabled
}
if operation != "get" && (force || wasEnabled != enable) {
err = ios.SetUses24HourClock(device, enable)
exitIfError("failed setting Time Format", err)
}
if operation == "get" {
timeFormat := "24h"
if !enable {
timeFormat = "12h"
}
if JSONdisabled {
fmt.Printf("%s\n", timeFormat)
} else {
fmt.Println(convertToJSONString(map[string]string{"TimeFormat": timeFormat}))
}
}
}
func startAx(device ios.DeviceEntry, arguments docopt.Opts) {
go func() {
conn, err := accessibility.NewWithoutEventChangeListeners(device)
exitIfError("failed starting ax", err)
conn.SwitchToDevice()
conn.EnableSelectionMode()
size, _ := arguments.Float64("--font")
if size != 0 {
conn.UpdateAccessibilitySetting("DYNAMIC_TYPE", size)
}
for i := 0; i < 3; i++ {
conn.GetElement(context.Background())
time.Sleep(time.Second)
}
/* conn.GetElement()
time.Sleep(time.Second)
conn.TurnOff()*/
// conn.GetElement()
// conn.GetElement()
exitIfError("ax failed", err)
}()
c := make(chan os.Signal, 1)
signal.Notify(c, os.Interrupt)
<-c
}
// axSilentNotifier is a no-op AccessibilityInspectorNotifier for one-shot AX
// commands that don't stream device events.
type axSilentNotifier struct{}
func (axSilentNotifier) HostAppStateChanged(accessibility.Notification) {}
func (axSilentNotifier) HostInspectorNotificationReceived(accessibility.Notification) {}
func runAxAudit(device ios.DeviceEntry) {
ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second)
defer cancel()
conn, err := accessibility.New(ctx, device, axSilentNotifier{})
exitIfError("failed starting ax", err)
defer conn.Close()
issues, err := conn.RunAudit(ctx)
exitIfError("ax audit failed", err)
fmt.Println(convertToJSONString(issues))
}
func resetAx(device ios.DeviceEntry) {
conn, err := accessibility.NewWithoutEventChangeListeners(device)
exitIfError("failed creating ax service", err)
err = conn.ResetToDefaultAccessibilitySettings()
exitIfError("failed resetting ax", err)
}
func printVersion() {
versionMap := map[string]interface{}{
"version": version,
}
if JSONdisabled {