Giter VIP home page Giter VIP logo

danielpaulus / go-ios Goto Github PK

View Code? Open in Web Editor NEW
748.0 29.0 155.0 73.04 MB

This is an operating system independent implementation of iOS device features. You can run UI tests, launch or kill apps, install apps etc. with it.

License: MIT License

Go 98.86% Swift 0.22% JavaScript 0.25% Objective-C 0.38% Makefile 0.15% Dockerfile 0.14%
ios linux xcuitest instruments dtx-framework dtx appium-ios hacktoberfest golang hacktoberfest2022

go-ios's Introduction

NPM License: MIT Twitter NPM

Welcome ๐Ÿ‘‹

npm install -g go-ios can be used to get going. Run ios --help after the installation for details.

The goal of this project is to provide a stable and production ready opensource solution to automate iOS device on Linux, Windows and Mac OS X. I am delighted to announce that a few companies including headspin.io and Sauce Labs will use or are using go-iOS.

Follow my twitter for updates or check out my medium blog: https://daniel-paulus.medium.com/

If you are interested in using go-iOS please get in touch on LinkedIn, Twitter or the Github discussions above, I always love to hear what people are doing with it.

If you miss something your Mac can do but go-iOS can't, just request a feature in the issues tab.

New REST-API

Go-iOS is getting an experimental REST-API check it out https://github.com/danielpaulus/go-ios/tree/main/restapi

Design principles:

  1. Using golang to compile static, small and fast binaries for all platforms very easily.

    Build Manual: Install golang and run go build

  2. All output as JSON so you can easily use go-iOS from any other programming language

  3. Everything is a module, you can use go-iOS in golang projects as a module dependency easily

Features:

Most notable:

  • Install apps zipped as ipa or unzipped from their .app folder ios install --path=/path/to/app
  • Run XCTests including WebdriverAgent on Linux, Windows and Mac
  • Start and Stop apps
  • Use a debug proxy to reverse engineer every tool Mac OSX has, so you can contrib to go-ios or build your own
  • Pair devices without manual tapping on a popup
  • Install developer images automatically by running ios image auto
  • Set thermal states and network emulation on the device with the ios devicestate command

All features:

Options:
  -v --verbose   Enable Debug Logging.
  -t --trace     Enable Trace Logging (dump every message).
  --nojson       Disable JSON output (default).
  -h --help      Show this screen.
  --udid=<udid>  UDID of the device.

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 listen [options]                                               Keeps a persistent connection open and notifies about newly connected or disconnected devices.
   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 info [options]                                                 Prints a dump of Lockdown getValues.
   ios image list [options]                                           List currently mounted developers images' signatures
   ios image mount [--path=<imagepath>] [options]                     Mount a image from <imagepath>
   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 syslog [options]                                               Prints a device's log output
   ios screenshot [options] [--output=<outfile>]                      Takes a screenshot and writes it to the current dir or to <outfile>
   ios instruments notifications [options]                            Listen to application state notifications
   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 cp <srcpattern> <target> [options]                       copy "file pattern" to the target dir. Ex.: 'ios crash cp "*" "./crashes"'
   ios crash rm <cwd> <pattern> [options]                             remove file pattern from dir. Ex.: 'ios crash rm "." "*"' to delete everything
   ios devicename [options]                                           Prints the devicename
   ios date [options]                                                 Prints the device date
   ios devicestate list [options]                                     Prints a list of all supported device conditions, like slow network, gpu etc.
   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 lang [--setlocale=<locale>] [--setlang=<newlang>] [options]    Sets or gets the Device language
   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 diagnostics list [options]                                     List diagnostic infos
   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 profile list                                                   List the profiles on the device
   ios profile remove <profileName>                                   Remove the profileName from the device
   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 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 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 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.
   >                                                                  f.ex. "ios launch com.apple.Maps"
   ios forward [options] <hostPort> <targetPort>                      Similar to iproxy, forward a TCP connection to the device.
   ios dproxy [--binary]                                              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 readpair                                                       Dump detailed information about the pairrecord for a device.
   ios install --path=<ipaOrAppFolder> [options]                      Specify a .app folder or an installable ipa file that will be installed.
   ios pcap [options] [--pid=<processID>] [--process=<processName>]   Starts a pcap dump of network traffic, use --pid or --process to filter specific processes.
   ios apps [--system] [--all] [--list]                               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.
   ios launch <bundleID>                                              Launch app with the bundleID on the device. Get your bundle ID from the apps command.
   ios kill (<bundleID> | --pid=<processID> | --process=<processName>) [options] Kill app with the specified bundleID, process id, or process name on the device.
   ios runtest <bundleID>                                             Run a XCUITest.
   ios runwda [--bundleid=<bundleid>] [--testrunnerbundleid=<testbundleid>] [--xctestconfig=<xctestconfig>] [--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 ax [options]                                                   Access accessibility inspector features.
   ios debug [--stop-at-entry] <app_path>                             Start debug with lldb
   ios fsync (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 fsync (pull | push) --srcPath=<srcPath> --dstPath=<dstPath>    Pull or Push file from srcPath to dstPath.
   ios reboot [options]                                               Reboot the given device
   ios -h | --help                                                    Prints this screen.
   ios --version | version [options]                                  Prints the version
   ios setlocation [options] [--lat=<lat>] [--lon=<lon>]              Updates the location of the device to the provided by latitude and longitude coordinates. Example: 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. Example: setlocationgpx --gpxfilepath=/home/username/location.gpx
   ios resetlocation [options]                                        Resets the location of the device to the actual one
   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 diskspace [options]											  Prints disk space info.

go-ios's People

Contributors

appl3s avatar ash-kamrip avatar bartekpacia avatar briankrznarich avatar ccouton avatar cedriccouton avatar chocolateofpain avatar codeskyblue avatar compoundradius avatar danielpaulus avatar diegoperini avatar diemol avatar dmissmann avatar eyjhb avatar felixruan avatar fish-sauce avatar harshitshah4 avatar hsorbo avatar jochen-testingbot avatar kazzmir avatar luc-git avatar milicak93 avatar mykola-mokhnach avatar nanoscopic avatar pe-ge avatar prife avatar shamanec avatar solskgaer avatar wangchaohz avatar yasharazari avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

go-ios's Issues

Do you support setting mobile phone language? Does it support setting WLAN network proxy?

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

'ios launch' unable to launch app

Hello, i try to use go-ios v1.0.24 to launch apps on my iphone, but it failed.
i tried other commands like ios screenshot/apps/info/syslog work
, ios ps & kill not work
my phone & sysver: iphone11 pro max ios14.3
here is my log output:

โฏ ./ios launch com.apple.Preferences

{"channel_id":"com.apple.instruments.server.services.processcontrol","error":"Timed out waiting for response for message:5 channel:0","level":"error","msg":"failed requesting channel","time":"2021-08-17T15:31:20+08:00"}
{"bundleID":"com.apple.Preferences","channel_id":"com.apple.instruments.server.services.processcontrol","level":"info","msg":"Launching process","time":"2021-08-17T15:31:20+08:00"}
{"level":"error","msg":"DeviceConnection failed writing 1383 bytes, only 0 sent","time":"2021-08-17T15:31:20+08:00"}
{"level":"error","msg":"Failed sending: write unix -\u003e/var/run/usbmuxd: write: broken pipe","time":"2021-08-17T15:31:20+08:00"}
{"channel_id":"com.apple.instruments.server.services.processcontrol","error":"write unix -\u003e/var/run/usbmuxd: write: broken pipe","level":"info","methodselector":"launchSuspendedProcessWithDevicePath:bundleIdentifier:environment:arguments:options:","msg":"failed starting invoking method","time":"2021-08-17T15:31:20+08:00"}
panic: runtime error: index out of range [0] with length 0

goroutine 1 [running]:
github.com/danielpaulus/go-ios/ios/instruments.ProcessControl.StartProcess(0xc000446a20, 0xc0003f5f40, 0x7ffeefbff91d, 0x15, 0xc0003f18f0, 0x1793228, 0x0, 0x0, 0xc0003f18c0, 0x0, ...)
	/Users/runner/work/go-ios/go-ios/ios/instruments/processcontrol.go:65 +0x9f1
github.com/danielpaulus/go-ios/ios/instruments.(*ProcessControl).LaunchApp(0xc0003cad70, 0x7ffeefbff91d, 0x15, 0x0, 0xc000318996, 0x3)
	/Users/runner/work/go-ios/go-ios/ios/instruments/processcontrol.go:23 +0xe5
main.Main()
	/Users/runner/work/go-ios/go-ios/main.go:335 +0x267d
main.main()
	/Users/runner/work/go-ios/go-ios/main.go:41 +0x25

Can't use 'ios image *' cli commands as intended

If I have an image already mounted on the device and I execute 'ios image list' I get a proper looking response like this:
{"level":"info","msg":"2f44230545372e7e64bdd6f19ee7c37154d1ea1359bb84db4b0ad1220137cfe5e8021dac74faf5f6163ab1bfb7705da56b5046cb6ae12a041f10c3c0e9175348d4551f05b48c255ad25ba1bfd0fee8d6f07f71389a6139f5341b2bae7c4e39bc57b0be6a721550ef8fcde7711bb64e6b523f839cd3df741272cb135ec986712e","time":"2021-08-23T10:20:59+03:00"}
If I have an image already mounted on the device and I try to mount another I also get a proper looking response like this:
{"level":"fatal","msg":"there is already a developer image mounted, reboot the device if you want to remove it. aborting.","time":"2021-08-23T10:21:24+03:00"}
BUT
if I don't have an image already mounted on the device and I try executing either 'ios image list', 'ios image mount' or 'ios image auto' I always get the same error:
{"err":"invalid response: \u003cnil\u003e","level":"fatal","msg":"failed getting image list","time":"2021-08-23T10:23:33+03:00"}
The issue occurs regardless if I pair the device beforehand or not
Tested on Ubuntu 18.04.5 LTS

ios reboot is not working

Describe the bug
When execute "ios reboot" command nothing happens on the device.

To Reproduce
Steps to reproduce the behavior:

  1. ios-go is installed via "npm -g install ios-go"
  2. Open terminal and execute command "ios reboot"
  3. Following logs appeared: - {"level":"info","msg":"no udid specified using first device in list","time":"2022-05-02T12:35:35+05:30","udid":""}
    {"level":"info","msg":"ok","time":"2022-05-02T12:35:35+05:30"}

Expected behavior
Device with should reboot

Actual behavior
Device stays as is.

Desktop:

  • OS: [MAC OS]
  • Version [12.3.1]

Smartphone:

  • Device: [iPhone11]
  • OS: [iOS15.4.1]

Deviceinfo doesn't work

I cloned and built the repo.
I can run ./go-ios list and the UUID of the IOS phone I have attached shows up.
I run ./go-ios info and nothing is output, nor is any errorcode set.
I run ./go-ios info -u[my uuid] and the same thing happens.
I run ./go-ios info -u=[my uuid] and I get an error saying uuid =[my uuid] is not found.

Should I be expecting this to output some info? I feel like if something went wrong an error of any sort should be indicated/output.

Is there some other setup that I need to do before it will function? I currently have libusbmuxd and libimobiledevice installed. Would those interfere in some way?

One other detail: I am running this on Mac OS. Does it only work on Linux?

Update: I do see the PR for 'addDeviceInfo'. I checked out that branch and built it. Also does not work; same result as stated above.

"'InvalidService'. Have you mounted the Developer Image?" error with developer image mounted

Describe the bug
I am currently unable to use most of the commands (all those that require launching applications) because of errors like this:

"Could not start service:com.apple.mobile.screenshotr with reason:'InvalidService'. Have you mounted the Developer Image?"

However, it seems my developer image is correctly mounted:

โฏ ios image auto
{"level":"info","msg":"no udid specified using first device in list","time":"2022-05-05T18:38:37+02:00","udid":"[REDACTED]"}
{"level":"warning","msg":"there is already a developer image mounted, reboot the device if you want to remove it. aborting.","time":"2022-05-05T18:38:37+02:00"}
{"basedir":".","level":"info","msg":"success mounting image","time":"2022-05-05T18:38:37+02:00","udid":"[REDACTED]"}
โฏ ios ps
{"level":"info","msg":"no udid specified using first device in list","time":"2022-05-05T18:38:38+02:00","udid":"[REDACTED]"}
{"err":"Could not start service:com.apple.instruments.remoteserver.DVTSecureSocketProxy with reason:'InvalidService'. Have you mounted the Developer Image?","level":"fatal","msg":"failed opening deviceInfoService for getting process list","time":"2022-05-05T18:38:38+02:00"}

Anything I might be missing here?

Smartphone (please complete the following information):

  • Device: iPhone X
  • OS: iOS 14.4
  • Jailbroken with checkra1n

The bundle โ€œPlugInsโ€ couldnโ€™t be loaded

Good day. Please, tell what I'm doing wrong or there's a real issue
XCUITest bundle built with Xcode 12.2 beta 3.
iPhone 12 Pro Max. iOS-14.3
iPhone 7. iOS-12.4

cmd:
./go-ios runtest "bundleID"
(app and xctest-runner have been already installed on device. app and xctest-runnder bundleIDs are fit naming convention:
bundleID && bundleIDUITests.xctrunner)

Output:
{"bundleID":"bundleIDUITests.xctrunner","channel_id":"com.apple.instruments.server.services.processcontrol","level":"info","msg":"Launching process","time":"2021-07-02T16:54:43+03:00"}
{"channel_id":"com.apple.instruments.server.services.processcontrol","level":"info","msg":"Process started successfully","pid":388,"time":"2021-07-02T16:54:43+03:00"}
{"level":"info","msg":"2021-07-02 16:54:43.915240+0300 BelfarmUITests-Runner[388:10124] Running tests...\n","time":"2021-07-02T16:54:44+03:00"}
{"level":"info","msg":"2021-07-02 16:54:43.926804+0300 BelfarmUITests-Runner[388:10124] The bundle โ€œPlugInsโ€ couldnโ€™t be loaded because its executable couldnโ€™t be located. Try reinstalling the bundle.\n","time":"2021-07-02T16:54:44+03:00"}
{"level":"info","msg":"device called local method","sel":"_XCT_didFailToBootstrapWithError:","time":"2021-07-02T16:54:44+03:00"}
{"level":"error","msg":"DeviceConnection failed writing 402 bytes, only 0 sent","time":"2021-07-02T16:54:45+03:00"}
{"level":"error","msg":"Failed sending: write unix -\u003e/var/run/usbmuxd: write: broken pipe","time":"2021-07-02T16:54:45+03:00"}
{"channel_id":"dtxproxy:XCTestDriverInterface:XCTestManager_IDEInterface","error":"write unix -\u003e/var/run/usbmuxd: write: broken pipe","level":"info","methodselector":"_IDE_startExecutingTestPlanWithProtocolVersion:","msg":"failed starting invoking method","time":"2021-07-02T16:54:45+03:00"}

Structure of my xctrunner is straightforward: other resources including Plugins container(with *.xctest bundle) are presented.
I tried another sample app with XCUITest scheme with the only one test which loads application but the result is the same.
Thanks in advance.

runwda fails on iOS 13.7

user@Mac-Monterey ios_remote_provider % ./bin/go-ios info | python -m json.tool | grep "\"Product"
    "ProductType": "iPhone9,1", ( iPhone 7 )
    "ProductVersion": "13.7",
user@Mac-Monterey ios_remote_provider % ./bin/go-ios runwda --bundleid com.dryark.CFAgent.xctrunner --testrunnerbundleid com.dryark.CFAgent.xctrunner --xctestconfig CFAgent.xctest
{"bundleid":"com.dryark.CFAgent.xctrunner","level":"info","msg":"Running wda","testbundleid":"com.dryark.CFAgent.xctrunner","time":"2021-10-07T15:44:08-07:00","xctestconfig":"CFAgent.xctest"}
{"error":"_IDE_initiateControlSessionWithCapabilities got wrong returnvalue: [{%!s(uint64=1) DTXMessage map[NSLocalizedDescription:Unable to invoke -[\u003cXCIDESession: 0x119f2ee90\u003e (socket 5) created Thursday, October 7, 2021 at 3:44:08 PM Pacific Daylight Time _IDE_initiateControlSessionWithCapabilities:] - it does not respond to the selector]}]","level":"fatal","msg":"Failed running WDA","time":"2021-10-07T15:44:10-07:00"}

It also fails on the following, in I believe the same way:

  • iPhone SE 2nd edition iOS 13.5.1
  • iPhone 8 iOS 12.4
  • iPhone 8 plus iOS 12.3.2
  • iPhone 11 iOS 13.7

Developer Disk Image is not saved in the proper path

Describe the bug
Developer Disk Image is not saved in the proper path. The OS version folder is outside the devimages folder.

See screenshot for details.

To Reproduce
Steps to reproduce the behavior:

  1. run ios image auto

Expected behavior
devimages\15.6.1\

Screenshots
image

go-ios version

  • v1.0.80

Desktop (please complete the following information):

  • OS: Windows10 20H2

Smartphone (please complete the following information):

  • Device: iPhone12 mini
  • OS: iOS 15.6.1

"Failed closing wda-testrunner", runwda does not shutdown cleanly since 94f24f8dd01f9dfbb973900175477a3d5683a635

Note: I have submitted pull-requests which include a fix for this bug: PR-159, PR-160

Describe the bug
The runwda command still launches XCTests correctly, but no longer shuts them down. After the built-in 5 second timeout, exits with
"Failed closing wda-testrunner"

To Reproduce
go-ios runwda ....
ctrl-c

Expected behavior
clean shutdown message

Additional context
I have a complete fix for this (comes with other baggage though), primarily in PR-159, with a test fix in PR-160.

Alternatively, you can replace context.Background() in main.go with "nil".

The recent addition of context support for launching of XCTests (94f24f8 [wangchaoHZ]) included an update to the legacy context-free method invocations in main.go and a corresponding test (PR-160). context.Background() (a default no-op context) was used, but it appears "nil" should have been passed instead. When using a context, there is a clear hang waiting for context.Done(), which requires a corresponding cancel() call that was not added here.

For the record, the context support itself is quite nice, so I hope this isn't considered a dig at anyone.

If the ios httpproxy remove does not take effect immediately, how can it be resolved?

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

Panic: non string key dict found, lazy decoding by converting keys to strings :-), fix later

To Reproduce
Steps to reproduce the behavior:

sudo ./go-ios dproxy

Output

WARN[0071] non string key dict found, lazy decoding by converting keys to strings :-), fix later
INFO[0071] 14.1 c4 response: map[uint64{1087}:map[net.bytes:%!s(uint64=0) net.bytes.delta:%!s(uint64=0) net.connections[]:[] net.packets:%!s(uint64=0) net.packets.delta:%!s(uint64=0) net.rx.bytes:%!s(uint64=0) net.rx.bytes.delta:%!s(uint64=0) net.rx.packets:%!s(uint64=0) net.rx.packets.delta:%!s(uint64=0) net.tx.bytes:%!s(uint64=0) net.tx.bytes.delta:%!s(uint64=0) net.tx.packets:%!s(uint64=0) net.tx.packets.delta:%!s(uint64=0) pid:%!s(uint64=1087) time:2022-04-21 13:56:42.279 +0800 CST]]  d=in id="#226"
panic: interface conversion: interface {} is int64, not map[string]interface {}

Desktop (please complete the following information):

  • OS: iOS 13

Why dproxy not work on my mac?

it prints below ,any problem of my env or cmd? Thanks a lot.
I build locally and run : sudo ./go-ios dproxy

{"level":"debug","msg":"map[--arg:[] --basedir:\u003cnil\u003e --binary:false --bundleid:\u003cnil\u003e --details:false --env:[] --help:false --nojson:false --output:\u003cnil\u003e --p12file:\u003cnil\u003e --password:\u003cnil\u003e --path:\u003cnil\u003e --pid:\u003cnil\u003e --plist:false --process:\u003cnil\u003e --setlang:\u003cnil\u003e --setlocale:\u003cnil\u003e --stop-at-entry:false --system:false --testrunnerbundleid:\u003cnil\u003e --trace:false --udid:\u003cnil\u003e --verbose:false --version:false --xctestconfig:\u003cnil\u003e \u003capp_path\u003e:\u003cnil\u003e \u003cbundleID\u003e:\u003cnil\u003e \u003chostPort\u003e:\u003cnil\u003e \u003ckey\u003e:[] \u003cprofileId\u003e:\u003cnil\u003e \u003cprofileTypeId\u003e:\u003cnil\u003e \u003ctargetPort\u003e:\u003cnil\u003e apps:false auto:false ax:false date:false debug:false devicename:false devicestate:false diagnostics:false dproxy:true enable:false forward:false image:false info:false install:false kill:false lang:false launch:false list:false listen:false mobilegestalt:false mount:false pair:false pcap:false ps:false readpair:false reboot:false runtest:false runwda:false screenshot:false syslog:false uninstall:false version:false]","time":"2022-02-18T19:25:09+08:00"}
{"level":"debug","msg":"Looking for device ''","time":"2022-02-18T19:25:09+08:00"}
{"level":"info","msg":"no udid specified using first device in list","time":"2022-02-18T19:25:09+08:00","udid":"7978366093cb268c5521e7f07aa511e8aaf5938e"}
{"EnableServiceSSL":true,"Port":65164,"Request":"StartService","Service":"com.apple.mobile.diagnostics_relay","level":"debug","msg":"Service started on device","time":"2022-02-18T19:25:09+08:00"}
INFO[0000] Successfully retrieved pairrecord: 55EA1968-313F-4B8B-BDF8-EE20A7AADC70 for device 7978366093cb268c5521e7f07aa511e8aaf5938e
INFO[0000] Moving socket /var/run/usbmuxd to /var/run/usbmuxd.f5c85170-dfc4-4a07-bd6c-ad6eeae9e1dd.real_socket
INFO[0005] Creating binary dump of all communication between MAC OS and debugproxy at: dump-2022.02.18-11.25.09.461/connection-#1-2022.02.18-11.25.14.242/bindump-hostservice-to-proxy.txt
INFO[0005] Creating binary dump of all communication between MAC OS and debugproxy at: dump-2022.02.18-11.25.09.461/connection-#2-2022.02.18-11.25.14.244/bindump-hostservice-to-proxy.txt
INFO[0005] Creating binary dump of all communication between MAC OS and debugproxy at: dump-2022.02.18-11.25.09.461/connection-#3-2022.02.18-11.25.14.245/bindump-hostservice-to-proxy.txt
INFO[0005] Creating binary dump of all communication between MAC OS and debugproxy at: dump-2022.02.18-11.25.09.461/connection-#4-2022.02.18-11.25.14.245/bindump-hostservice-to-proxy.txt
panic: ServiceInfo for port: 48900 not found, this is a bug :-)reqheader: {Length:348 Version:1 Request:8 Tag:0} repayload: 3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d38223f3e0a3c21444f435459504520706c697374205055424c494320222d2f2f4170706c652f2f44544420504c49535420312e302f2f454e222022687474703a2f2f7777772e6170706c652e636f6d2f445444732f50726f70657274794c6973742d312e302e647464223e0a3c706c6973742076657273696f6e3d22312e30223e0a3c646963743e0a093c6b65793e44657669636549443c2f6b65793e0a093c696e74656765723e3139313c2f696e74656765723e0a093c6b65793e4d657373616765547970653c2f6b65793e0a093c737472696e673e436f6e6e6563743c2f737472696e673e0a093c6b65793e506f72744e756d6265723c2f6b65793e0a093c696e74656765723e34383930303c2f696e74656765723e0a3c2f646963743e0a3c2f706c6973743e0a

goroutine 24 [running]:
github.com/danielpaulus/go-ios/ios/debugproxy.handleConnect({{0x15c, 0x1, 0x8, 0x0}, {0xc0000aa580, 0x14c, 0x14c}}, 0x3ed, 0xc00057a280, 0xc00038a0c0, ...)
/Users/jinrong.sjr/desktop/reverse/go-ios/ios/debugproxy/muxhandler.go:104 +0x3f4
github.com/danielpaulus/go-ios/ios/debugproxy.proxyUsbMuxConnection(0xc00057a280, 0xc00038a0c0, 0xc00038a0d8)
/Users/jinrong.sjr/desktop/reverse/go-ios/ios/debugproxy/muxhandler.go:37 +0xe65
created by github.com/danielpaulus/go-ios/ios/debugproxy.startProxyConnection
/Users/jinrong.sjr/desktop/reverse/go-ios/ios/debugproxy/debugproxy.go:160 +0x6d6

Pair devices without manual tapping on a popup

Describe the bug
Not sure if it is a bug

To Reproduce
Plug in device and run ./go-ios pair

Expected behavior
The device is paired with the host no manual intervention required

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Ubuntu

Smartphone (please complete the following information):
ProductName: iPhone OS
ProductType: iPhone9,3
ProductVersion: 15.4.1

Additional context
How would you run the ./go-ios pair command, I do not have physical access to the device and would like to pair the device using command line only, IE bypass the "tapping the trust message on the device", Is this possible, if so, could you please give me a procedure on how to do this?

be able to detect ip address of the attached device

so far detecting of actual device ip is pretty complicated and might be done by WDA logs analysis.
it would be great to identify IPv4 and IPv6 via go ios utility so we can integrate appium etc with no extra steps

On iOS16, the DeveloperDiskImage is shown as successfully mounted, but in fact the mount fails.

Describe the bug
On iOS16, the DeveloperDiskImage is shown as successfully mounted, but in fact the mount fails.
The DeveloperDiskImage itself is successfully downloaded, but fails to mount.
I think there is a problem with DeveloperDiskImage, as it failed to mount even with libimobiledevice's ideviceimagemounter.
However, it is a problem that the success log is displayed as "success mounting image".

To Reproduce
Steps to reproduce the behavior:

  1. ios image auto

Expected behavior
If the mount fails, it is expected to display "Failed to mount".

Screenshots
image

go-ios version

  • v1.0.80

Desktop (please complete the following information):

  • OS: Windows10 20H2

Smartphone (please complete the following information):

  • Device: iPhone12 mini
  • OS: iOS 15.6.1

ios runwda on mac does not start server

I'm trying to execute the runwda command on a mac machine but it does not seem to fully start up the WDA process.

Why am I running this on a mac ?
Well ultimately, I would like to have a linux box that has an SSH tunnel to the mac and simply use unix socket forwarding to forward /var/run/usbmuxd to expose the devices to the linux machine.
At first I was performing ios runwda from the linux box with the ssh tunnelled /var/run/usbmuxd, but that didn't work, so I figured, let's try it on the mac itself, and also there, it seems to 'hang'. It seems to work 'partially' as in, the process starts, but I never get output that the wda server is up and running with the device ip and the wda port printed out in the output.

Here is the output of the runwda command on the mac with tracing enabled.

./ios runwda --bundleid=com.test.WebDriverAgentRunner.xctrunner --testrunnerbundleid=com.test.WebDriverAgentRunner.xctrunner --xctestconfig=WebDriverAgentRunner.xctest --udid=40xxxxxxxxxxxxxxxx --nojson --env USE_PORT=8100 -t

DEBU[0000] Looking for device '40xxxxxxxxxxxxxxxx'
DEBU[0000] Opening connection:0xc00033edc0
DEBU[0000] UsbMux sendios.ReadDevicesType on 0xc00000e9c8
DEBU[0000] UsbMux Receive on 0xc00000ea10
DEBU[0000] Opening connection:0xc00033f2c0
DEBU[0000] UsbMux sendios.ReadPair on 0xc00000fc70
DEBU[0000] UsbMux Receive on 0xc00000fcb8
DEBU[0000] UsbMux sendios.connectMessage on 0xc00000fc70
DEBU[0000] UsbMux Receive on 0xc000378410
DEBU[0000] Lockdown sendios.startSessionRequest
DEBU[0000] enable session ssl on0xc000343be0 and wrap with tlsConn0xc000319328
DEBU[0000] Lockdown sendios.startServiceRequest
DEBU[0000] Service started on device                     EnableServiceSSL=true Port=54418 Request=StartService Service=com.apple.mobile.diagnostics_relay
DEBU[0000] Lockdown sendios.stopSessionRequest
DEBU[0000] Closing connection:0xc000343be0
DEBU[0000] Opening connection:0xc00033fc30
DEBU[0000] UsbMux sendios.ReadPair on 0xc000378dd0
DEBU[0000] UsbMux Receive on 0xc000378e00
DEBU[0000] Opening connection:0xc00033fdd0
DEBU[0000] UsbMux sendios.connectMessage on 0xc000379508
DEBU[0000] UsbMux Receive on 0xc000379538
DEBU[0000] enable session ssl on0xc00037fac0 and wrap with tlsConn0xc000319348
INFO[0000] Running wda                                   bundleid=com.test.WebDriverAgentRunner.xctrunner testbundleid=com.test.WebDriverAgentRunner.xctrunner xctestconfig=WebDriverAgentRunner.xctest
DEBU[0000] Opening connection:0xc000096000
DEBU[0000] UsbMux sendios.ReadPair on 0xc0000aa020
DEBU[0000] UsbMux Receive on 0xc0000aa050
DEBU[0000] UsbMux sendios.connectMessage on 0xc0000aa020
DEBU[0000] UsbMux Receive on 0xc0000aa758
DEBU[0000] Lockdown sendios.startSessionRequest
DEBU[0000] enable session ssl on0xc000094000 and wrap with tlsConn0xc00009c010
DEBU[0000] Lockdown sendios.startServiceRequest
DEBU[0000] Lockdown sendios.stopSessionRequest
DEBU[0000] Closing connection:0xc000094000
DEBU[0000] Failed connecting to com.apple.testmanagerd.lockdown.secure with Could not start service:com.apple.testmanagerd.lockdown.secure with reason:'InvalidService'. Have you mounted the Developer Image?, trying com.apple.testmanagerd.lockdown
DEBU[0000] Opening connection:0xc000052880
DEBU[0000] UsbMux sendios.ReadPair on 0xc00000e188
DEBU[0000] UsbMux Receive on 0xc00000e1b8
DEBU[0000] UsbMux sendios.connectMessage on 0xc00000e188
DEBU[0000] UsbMux Receive on 0xc000378800
DEBU[0000] Lockdown sendios.startSessionRequest
DEBU[0000] enable session ssl on0xc000342000 and wrap with tlsConn0xc00009c020
DEBU[0000] Lockdown sendios.startServiceRequest
DEBU[0000] Service started on device                     EnableServiceSSL=true Port=54422 Request=StartService Service=com.apple.testmanagerd.lockdown
DEBU[0000] Lockdown sendios.stopSessionRequest
DEBU[0000] Closing connection:0xc000342000
DEBU[0000] Opening connection:0xc00040c3a0
DEBU[0000] UsbMux sendios.ReadPair on 0xc000378c20
DEBU[0000] UsbMux Receive on 0xc000378c50
DEBU[0000] Opening connection:0xc00040c540
DEBU[0000] UsbMux sendios.connectMessage on 0xc000379388
DEBU[0000] UsbMux Receive on 0xc0003793b8
DEBU[0000] enable session ssl on0xc00005d640 and wrap with tlsConn0xc000318010
DEBU[0000] Opening connection:0xc00040c610
DEBU[0000] UsbMux sendios.ReadPair on 0xc000379418
DEBU[0000] Dispatching:_notifyOfPublishedCapabilities:
DEBU[0000] Global Dispatcher Received: [_notifyOfPublishedCapabilities:] [{t:binary, v:{"com.apple.private.DTXBlockCompression":2,"com.apple.private.DTXConnection":1}},]
DEBU[0000] UsbMux Receive on 0xc000379448
DEBU[0000] UsbMux sendios.connectMessage on 0xc000379418
DEBU[0000] UsbMux Receive on 0xc00000ed40
DEBU[0000] Lockdown sendios.startSessionRequest
DEBU[0000] enable session ssl on0xc00005d6c0 and wrap with tlsConn0xc000010048
DEBU[0000] Lockdown sendios.valueRequest
DEBU[0000] Lockdown sendios.stopSessionRequest
DEBU[0000] Closing connection:0xc00005d6c0
DEBU[0000] Opening connection:0xc00033e430
DEBU[0000] UsbMux sendios.ReadPair on 0xc0001ff550
DEBU[0000] UsbMux Receive on 0xc0001ff580
DEBU[0000] UsbMux sendios.connectMessage on 0xc0001ff550
DEBU[0000] UsbMux Receive on 0xc0000ab100
DEBU[0000] Lockdown sendios.startSessionRequest
DEBU[0000] enable session ssl on0xc000214240 and wrap with tlsConn0xc000318078
DEBU[0000] Lockdown sendios.startServiceRequest
DEBU[0000] Service started on device                     EnableServiceSSL=false Port=54426 Request=StartService Service=com.apple.mobile.installation_proxy
DEBU[0000] Lockdown sendios.stopSessionRequest
DEBU[0000] Closing connection:0xc000214240
DEBU[0000] Opening connection:0xc00040cb30
DEBU[0000] UsbMux sendios.ReadPair on 0xc000379c88
DEBU[0000] UsbMux Receive on 0xc000379cb8
DEBU[0000] Opening connection:0xc00040ccd0
DEBU[0000] UsbMux sendios.connectMessage on 0xc0003403c8
DEBU[0000] UsbMux Receive on 0xc0003403f8
DEBU[0000] Lockdown sendmap[string]interface {}
DEBU[0000] Opening connection:0xc000392b70
DEBU[0000] UsbMux sendios.ReadPair on 0xc0000aa230
DEBU[0000] UsbMux Receive on 0xc0000aa260
DEBU[0000] UsbMux sendios.connectMessage on 0xc0000aa230
DEBU[0000] UsbMux Receive on 0xc0000aa968
DEBU[0000] Lockdown sendios.startSessionRequest
DEBU[0000] enable session ssl on0xc0003949a0 and wrap with tlsConn0xc00009c010
DEBU[0000] Lockdown sendios.startServiceRequest
DEBU[0000] Service started on device                     EnableServiceSSL=true Port=54429 Request=StartService Service=com.apple.mobile.house_arrest
DEBU[0000] Lockdown sendios.stopSessionRequest
DEBU[0000] Closing connection:0xc0003949a0
DEBU[0000] Opening connection:0xc00033e190
DEBU[0000] UsbMux sendios.ReadPair on 0xc0001fe350
DEBU[0000] UsbMux Receive on 0xc0001fe380
DEBU[0000] Opening connection:0xc00033e350
DEBU[0000] UsbMux sendios.connectMessage on 0xc0001fea88
DEBU[0000] UsbMux Receive on 0xc0001feab8
DEBU[0000] enable session ssl on0xc000310b80 and wrap with tlsConn0xc00009c030
DEBU[0000] Lockdown sendmap[string]interface {}
DEBU[0001] Closing connection:0xc000310b80
DEBU[0001] Closing connection:0xc0003108c0
DEBU[0001] Requesting channel                            channel_id="dtxproxy:XCTestManager_IDEInterface:XCTestManager_DaemonConnectionInterface"
DEBU[0001] i5.1 c0 t:Ack mlen:16 aux_len0 paylen0
DEBU[0001] Channel open                                  channel_id="dtxproxy:XCTestManager_IDEInterface:XCTestManager_DaemonConnectionInterface"
DEBU[0001] expected err_IDE_initiateControlSessionWithCapabilities got wrong returnvalue: [{%!s(uint64=1) DTXMessage map[NSLocalizedDescription:Unable to invoke -[<XCIDESession: 0x155e89de0> (socket 6) created Monday, November 22, 2021 at 9:00:19 PM Eastern Standard Time _IDE_initiateControlSessionWithCapabilities:] - it does not respond to the selector]}]
DEBU[0001] initiateControlSessionForTestProcessID reply  channel_id="dtxproxy:XCTestManager_IDEInterface:XCTestManager_DaemonConnectionInterface" reply="i2.1 c1 t:ResponseWithReturnValueInPayload mlen:155 aux_len0 paylen139"
DEBU[0001] got protocolversion:30
DEBU[0001] Opening connection:0xc000610a00
DEBU[0001] UsbMux sendios.ReadPair on 0xc0001ffa60
DEBU[0001] UsbMux Receive on 0xc0001ffa90
DEBU[0001] UsbMux sendios.connectMessage on 0xc0001ffa60
DEBU[0001] UsbMux Receive on 0xc0004021b8
DEBU[0001] Lockdown sendios.startSessionRequest
DEBU[0001] enable session ssl on0xc0003114e0 and wrap with tlsConn0xc000010070
DEBU[0001] Lockdown sendios.startServiceRequest
DEBU[0001] Service started on device                     EnableServiceSSL=true Port=54432 Request=StartService Service=com.apple.testmanagerd.lockdown
DEBU[0001] Lockdown sendios.stopSessionRequest
DEBU[0001] Closing connection:0xc0003114e0
DEBU[0001] Opening connection:0xc000611080
DEBU[0001] UsbMux sendios.ReadPair on 0xc000402a88
DEBU[0001] UsbMux Receive on 0xc000402ab8
DEBU[0001] Opening connection:0xc000611220
DEBU[0001] UsbMux sendios.connectMessage on 0xc0004031c0
DEBU[0001] UsbMux Receive on 0xc0004031f0
DEBU[0001] enable session ssl on0xc00037f140 and wrap with tlsConn0xc000010098
DEBU[0001] connections ready
DEBU[0001] Requesting channel                            channel_id="dtxproxy:XCTestManager_IDEInterface:XCTestManager_DaemonConnectionInterface"
DEBU[0001] Dispatching:_notifyOfPublishedCapabilities:
DEBU[0001] Global Dispatcher Received: [_notifyOfPublishedCapabilities:] [{t:binary, v:{"com.apple.private.DTXBlockCompression":2,"com.apple.private.DTXConnection":1}},]
DEBU[0001] i5.1 c0 t:Ack mlen:16 aux_len0 paylen0
DEBU[0001] Channel open                                  channel_id="dtxproxy:XCTestManager_IDEInterface:XCTestManager_DaemonConnectionInterface"
DEBU[0001] {map[]}
DEBU[0001] error initiateSessionWithIdentifierAndCaps, _IDE_initiateSessionWithIdentifier:capabilities: got wrong returnvalue: [{%!s(uint64=1) DTXMessage map[NSLocalizedDescription:Unable to invoke -[<XCIDESession: 0x155da28f0> (socket 9) created Monday, November 22, 2021 at 9:00:21 PM Eastern Standard Time _IDE_initiateSessionWithIdentifier:capabilities:] - it does not respond to the selector]}]
DEBU[0001] Launching init test Session                   channel_id="dtxproxy:XCTestManager_IDEInterface:XCTestManager_DaemonConnectionInterface"
DEBU[0001] init test session reply                       channel_id="dtxproxy:XCTestManager_IDEInterface:XCTestManager_DaemonConnectionInterface" reply="i2.1 c1 t:ResponseWithReturnValueInPayload mlen:155 aux_len0 paylen139"
DEBU[0001] protocol version received: 30
DEBU[0001] {map[]}
DEBU[0001] Opening connection:0xc000401b10
DEBU[0001] UsbMux sendios.ReadPair on 0xc00000eae8
DEBU[0001] UsbMux Receive on 0xc00000eb18
DEBU[0001] UsbMux sendios.connectMessage on 0xc00000eae8
DEBU[0001] UsbMux Receive on 0xc00000f220
DEBU[0001] Lockdown sendios.startSessionRequest
DEBU[0001] enable session ssl on0xc00037ffa0 and wrap with tlsConn0xc0000100b0
DEBU[0001] Lockdown sendios.startServiceRequest
DEBU[0001] Service started on device                     EnableServiceSSL=true Port=54435 Request=StartService Service=com.apple.instruments.remoteserver
DEBU[0001] Lockdown sendios.stopSessionRequest
DEBU[0001] Closing connection:0xc00037ffa0
DEBU[0001] Opening connection:0xc0000529b0
DEBU[0001] UsbMux sendios.ReadPair on 0xc00000fad8
DEBU[0001] UsbMux Receive on 0xc00000fb08
DEBU[0001] Opening connection:0xc0000530c0
DEBU[0001] UsbMux sendios.connectMessage on 0xc0003782c0
DEBU[0001] UsbMux Receive on 0xc0003782f0
DEBU[0001] enable session ssl on0xc00005db20 and wrap with tlsConn0xc0000100d0
DEBU[0001] Requesting channel                            channel_id=com.apple.instruments.server.services.processcontrol
DEBU[0001] Dispatching:_notifyOfPublishedCapabilities:
DEBU[0001] Global Dispatcher Received: [_notifyOfPublishedCapabilities:] [{t:binary, v:{"com.apple.dt.Instruments.inlineCapabilities":1,"com.apple.dt.Xcode.WatchProcessControl":3,"com.apple.dt.services.capabilities.vmtracking":1,"com.apple.instruments.server.services.ConditionInducer":1,"com.apple.instruments.server.services.activitytracetap":6,"com.apple.instruments.server.services.activitytracetap.deferred":1,"com.apple.instruments.server.services.activitytracetap.immediate":1,"com.apple.instruments.server.services.activitytracetap.windowed":1,"com.apple.instruments.server.services.assets":4,"com.apple.instruments.server.services.assets.response":2,"com.apple.instruments.server.services.coreprofilesessiontap":2,"com.apple.instruments.server.services.coreprofilesessiontap.deferred":1,"com.apple.instruments.server.services.coreprofilesessiontap.immediate":1,"com.apple.instruments.server.services.coreprofilesessiontap.multipleTimeTriggers":1,"com.apple.instruments.server.services.coreprofilesessiontap.pmc":1,"com.apple.instruments.server.services.coreprofilesessiontap.pmi":1,"com.apple.instruments.server.services.coreprofilesessiontap.windowed":1,"com.apple.instruments.server.services.coresampling":10,"com.apple.instruments.server.services.device.applictionListing":1,"com.apple.instruments.server.services.device.xpccontrol":2,"com.apple.instruments.server.services.deviceinfo":108,"com.apple.instruments.server.services.deviceinfo.app-life-cycle":1,"com.apple.instruments.server.services.deviceinfo.condition-inducer":1,"com.apple.instruments.server.services.deviceinfo.dyld-tracing":1,"com.apple.instruments.server.services.deviceinfo.energytracing.location":1,"com.apple.instruments.server.services.deviceinfo.gcd-perf":1,"com.apple.instruments.server.services.deviceinfo.gpu-allocation":1,"com.apple.instruments.server.services.deviceinfo.metal":1,"com.apple.instruments.server.services.deviceinfo.recordOptions":1,"com.apple.instruments.server.services.deviceinfo.scenekit-tracing":1,"com.apple.instruments.server.services.deviceinfo.systemversion":130102,"com.apple.instruments.server.services.filetransfer":1,"com.apple.instruments.server.services.filetransfer.debuginbox":1,"com.apple.instruments.server.services.fsusage":2,"com.apple.instruments.server.services.fsusage.deferred":1,"com.apple.instruments.server.services.fsusage.immediate":1,"com.apple.instruments.server.services.gpu":1,"com.apple.instruments.server.services.gpu.counters":2,"com.apple.instruments.server.services.gpu.deferred":1,"com.apple.instruments.server.services.gpu.immediate":1,"com.apple.instruments.server.services.graphics.coreanimation":1,"com.apple.instruments.server.services.graphics.coreanimation.deferred":1,"com.apple.instruments.server.services.graphics.coreanimation.immediate":1,"com.apple.instruments.server.services.graphics.opengl":1,"com.apple.instruments.server.services.graphics.opengl.deferred":1,"com.apple.instruments.server.services.graphics.opengl.immediate":1,"com.apple.instruments.server.services.graphics.openglesanalyzer":1,"com.apple.instruments.server.services.graphics.openglesanalyzer.deferred":1,"com.apple.instruments.server.services.graphics.openglesanalyzer.immediate":1,"com.apple.instruments.server.services.mobilenotifications":1,"com.apple.instruments.server.services.networking":2,"com.apple.instruments.server.services.networking.deferred":1,"com.apple.instruments.server.services.networking.immediate":1,"com.apple.instruments.server.services.objectalloc":4,"com.apple.instruments.server.services.objectalloc.deferred":1,"com.apple.instruments.server.services.objectalloc.immediate":1,"com.apple.instruments.server.services.objectalloc.zombies":1,"com.apple.instruments.server.services.power":1,"com.apple.instruments.server.services.power.deferred":1,"com.apple.instruments.server.services.power.immediate":1,"com.apple.instruments.server.services.processcontrol":107,"com.apple.instruments.server.services.processcontrol.capability.signal":1,"com.apple.instruments.server.services.processcontrol.feature.deviceio":103,"com.apple.instruments.server.services.processcontrolbydictionary":4,"com.apple.instruments.server.services.remoteleaks":6,"com.apple.instruments.server.services.remoteleaks.deferred":1,"com.apple.instruments.server.services.remoteleaks.immediate":1,"com.apple.instruments.server.services.sampling":11,"com.apple.instruments.server.services.sampling.deferred":1,"com.apple.instruments.server.services.sampling.immediate":1,"com.apple.instruments.server.services.screenshot":2,"com.apple.instruments.server.services.sysmontap":2,"com.apple.instruments.server.services.sysmontap.deferred":1,"com.apple.instruments.server.services.sysmontap.immediate":1,"com.apple.instruments.server.services.sysmontap.processes":1,"com.apple.instruments.server.services.sysmontap.system":1,"com.apple.instruments.server.services.sysmontap.windowed":1,"com.apple.instruments.server.services.ultraviolet.renderer":1,"com.apple.instruments.server.services.vmtracking":1,"com.apple.instruments.server.services.vmtracking.deferred":1,"com.apple.instruments.server.services.vmtracking.immediate":1,"com.apple.instruments.server.services.wireless":1,"com.apple.instruments.target.ios":130102,"com.apple.instruments.target.logical-cpus":2,"com.apple.instruments.target.mtb.denom":3,"com.apple.instruments.target.mtb.numer":125,"com.apple.instruments.target.physical-cpus":2,"com.apple.instruments.target.user-page-size":16384,"com.apple.private.DTXBlockCompression":2,"com.apple.private.DTXConnection":1,"com.apple.xcode.debug-gauge-data-providers.Energy":1,"com.apple.xcode.debug-gauge-data-providers.NetworkStatistics":1,"com.apple.xcode.debug-gauge-data-providers.SceneKit":1,"com.apple.xcode.debug-gauge-data-providers.SpriteKit":1,"com.apple.xcode.debug-gauge-data-providers.procinfo":1,"com.apple.xcode.debug-gauge-data-providers.resources":1,"com.apple.xcode.resource-control":1}},]
DEBU[0001] i5.1 c0 t:Ack mlen:16 aux_len0 paylen0
DEBU[0001] Channel open                                  channel_id=com.apple.instruments.server.services.processcontrol
DEBU[0001] adding extra env USE_PORT=8100
INFO[0001] Launching process                             bundleID=com.test.WebDriverAgentRunner.xctrunner channel_id=com.apple.instruments.server.services.processcontrol
INFO[0001] Process started successfully                  channel_id=com.apple.instruments.server.services.processcontrol pid=3115
DEBU[0001] Runner started with pid:3115, waiting for testBundleReady
DEBU[0001] Dispatching:outputReceived:fromProcess:atTime:
INFO[0001] 2021-11-22 21:00:21.297710-0500 WebDriverAgentRunner-Runner[3115:2987381] Running tests...
DEBU[0001] Dispatching:outputReceived:fromProcess:atTime:
INFO[0001] 2021-11-22 21:00:21.302611-0500 WebDriverAgentRunner-Runner[3115:2987381] Unable to load configuration data from specified path /; error: The file โ€œSystem@snap-1004721โ€ couldnโ€™t be opened because you donโ€™t have permission to view it.
2021-11-22 21:00:21.302695-0500 WebDriverAgentRunner-Runner[3115:2987381] XCTRunner Arguments: (
    "/var/containers/Bundle/Application/1C98CC47-614D-4417-B49B-E90EFD81AB08/WebDriverAgentRunner-Runner.app/WebDriverAgentRunner-Runner",
    "-NSTreatUnknownArgumentsAsOpen",
    NO,
    "-ApplePersistenceIgnoreState",
    YES
)
DEBU[0001] Dispatching:outputReceived:fromProcess:atTime:
INFO[0001] 2021-11-22 21:00:21.302848-0500 WebDriverAgentRunner-Runner[3115:2987381] XCTRunner Environment: {
    "CA_ASSERT_MAIN_THREAD_TRANSACTIONS" = 0;
    "CA_DEBUG_TRANSACTIONS" = 0;
    "CFFIXED_USER_HOME" = "/private/var/mobile/Containers/Data/Application/F1A5C776-6F69-491B-A8EA-9919FA904D6A";
    HOME = "/private/var/mobile/Containers/Data/Application/F1A5C776-6F69-491B-A8EA-9919FA904D6A";
    LOGNAME = mobile;
    "MTC_CRASH_ON_REPORT" = 1;
    NSUnbufferedIO = YES;
    "OS_ACTIVITY_DT_MODE" = YES;
    PATH = "/usr/bin:/bin:/usr/sbin:/sbin";
    SHELL = "/bin/sh";
    "SQLITE_ENABLE_THREAD_ASSERTIONS" = 1;
    TMPDIR = "/private/var/mobile/Containers/Data/Application/F1A5C776-6F69-491B-A8EA-9919FA904D6A/tmp/";
    USER = mobile;
    "USE_PORT" = 8100;
    XCTestBundlePath = "/private/var/containers/Bundle/Application/1C98CC47-614D-4417-B49B-E90EFD81AB08/WebDriverAgentRunner-Runner.app/PlugIns/WebDriverAgentRunner.xctest";
    XCTestConfigurationFilePath = "";
    XCTestSessionIdentifier = "8ab9cc4e-eae0-49dc-b47b-eaa4abcbac92";
    "XPC_FLAGS" = 0x0;
    "XPC_SERVICE_NAME" = "UIKitApplication:com.test.WebDriverAgentRunner.xctrunner[1ca3][rb-legacy]";
    "__CF_USER_TEXT_ENCODING" = "0x1F5:0:0";
}

This is where the process seems to get 'stuck'.

In a second terminal, I run iproxy 8100 8100 --udid 40xxxxxxxxxxx and afterwards perform a curl to http://localhost:8100, but get the following output:

curl: (56) Recv failure: Connection reset by peer

If I run appium and create a session with the same WebDriverAgent.xcproj that was used to generate the app that I trigger through runwda , appium starts fine and the webdriveragent starts up without issues and prints out WebDriverAgent is ready to accept commands with the ip of the device. So I believe the WebDriverAgent.ipa is not the culprit.

Not sure if running the Webdriveragent is supposed to be a supported use case for go-ios, but if anyone has any ideas, I'm all ears!
Cheers!

Add ios uninstall <bundleID>

Hello @danielpaulus, would you be interested in adding a new command ios uninstall?

It is currently supported by the old ideviceinstaller implementation so I thought that you might consider adding it.

It would be highly appreciated to be able to wipe devices when necessary.

Thank you for your hard work!

As you might now I am currently trying to substitute libimobiledevice with your go-ios in my own repo, so I would really like to be able to retain all of the current features.

Cannot pair supervised device

Describe the bug
Attempting to pair a supervised device is not working

To Reproduce

  1. Run ./ios pair --p12file=supervision.p12 --password=*********
  2. First time it shows the "Trust" popup on the device.
  3. I tap on "Trust" (although I don't think it should show in general?)
  4. Second attempt it presents the following error:
    {"err":"the response is missign the Error key: map[EscrowBag:[19 224 78 100 20 250 200 245 22 238 197 230 40 249 25 12 27 64 80 154 131 136 116 210 71 154 181 68 205 38 119 11] Request:Pair]","level":"fatal","msg":"Pairing failed","time":"2022-01-10T13:43:51+02:00"}

Expected behavior
Pairing a supervised device should not present "Trust" popup on device and should not return an error.

Desktop (please complete the following information):

  • OS: MacOS/Linux
  • Version v1.0.45

Smartphone (please complete the following information):

  • Device: iPhone SE 2019
  • OS: 15.0

Additional context
The device was supervised using Apple Configurator 2 and the supervision identity file was extracted from there.

Measure application performance

Is your feature request related to a problem? Please describe.
Appium provides the ability to record the performance of an application but this is not possible on different OS than MacOS because it is using tools that are not available on other OSs

Describe the solution you'd like
To be able to use go-ios to measure the performance of a running application(by bundleID) like CPU, Memory, Disk and Network usage. I suppose it will be fine if the information is provided each second and in an easy to parse format like JSON. Additionally it will be amazing if it is possible to start/stop the measurement with the intention to use that functionality directly through Go code and not using the cli and Ctrl+C to stop it.

Describe alternatives you've considered
'tidevice' provides such capability but it is only a CLI tool and is written in Python which makes integrating it a bit harder.

dproxy not work on instruments

I want to use "ios dproxy" to dump communication between instruments and my iphone12, but no message return. Does it work?

ios on windows install ipa files. error

=== RUN TestDeviceInstall
time="2021-12-20T14:14:17+08:00" level=info msg=installing appPath="D:\workspace\xxx.ipa" device=89ab5bbb40d90e29738be49f150f1c53ef54c972
time="2021-12-20T14:14:18+08:00" level=info msg=installing percentComplete=5 status=CreatingStagingDirectory
time="2021-12-20T14:14:18+08:00" level=info msg=installing percentComplete=15 status=ExtractingPackage
time="2021-12-20T14:14:18+08:00" level=info msg=installing percentComplete=20 status=InspectingPackage
time="2021-12-20T14:14:19+08:00" level=fatal msg="failed writing" err="failed installing: 'PackageInspectionFailed' errorDescription:'Failed to load Info.plist from bundle at path /var/installd/Library/Caches/com.apple.mobile.installd.staging/temp.1TG7lE/extracted/D:\workspace\xxx.ipa.app; Extra info about "/var/installd/Library/Caches/com.apple.mobile.installd.staging/temp.1TG7lE/extracted/D:\workspace\xxx.ipa.app/Info.plist": Couldn't stat /var/installd/Library/Caches/com.apple.mobile.installd.staging/temp.1TG7lE/extracted/D:\workspace\xxx.ipa.app/Info.plist: No such file or directory'"

runwda doesn't work on 14.7.1

Hi, thanks for the project. I have tried to run it on MacOS 11.5.2, but segfault popped up.

โžœ  /tmp ./ios runwda --bundleid=com.0x3c3e.WebDriverAgentRunner.xctrunner --testrunnerbundleid=com.0x3c3e.WebDriverAgentRunner.xctrunner --xctestconfig=WebDriverAgentRunner.xctest -t --nojson
INFO[0000] Set Trace mode
DEBU[0000] map[--arg:[] --basedir:<nil> --binary:false --bundleid:com.0x3c3e.WebDriverAgentRunner.xctrunner --details:false --env:[] --help:false --nojson:true --output:<nil> --p12file:<nil> --password:<nil> --path:<nil> --pid:<nil> --plist:false --process:<nil> --setlang:<nil> --setlocale:<nil> --stop-at-entry:false --system:false --testrunnerbundleid:com.0x3c3e.WebDriverAgentRunner.xctrunner --trace:true --udid:<nil> --verbose:false --version:false --xctestconfig:WebDriverAgentRunner.xctest <app_path>:<nil> <bundleID>:<nil> <hostPort>:<nil> <key>:[] <profileId>:<nil> <profileTypeId>:<nil> <targetPort>:<nil> apps:false auto:false ax:false date:false debug:false devicename:false devicestate:false diagnostics:false dproxy:false enable:false forward:false image:false info:false install:false kill:false lang:false launch:false list:false listen:false mobilegestalt:false mount:false pair:false pcap:false ps:false readpair:false reboot:false runtest:false runwda:true screenshot:false syslog:false uninstall:false version:false]
DEBU[0000] Looking for device ''
DEBU[0000] Opening connection:0xc00036a700
DEBU[0000] UsbMux sendios.ReadDevicesType on 0xc00000e9b0
DEBU[0000] UsbMux Receive on 0xc00000e9f8
DEBU[0000] no udid specified using default               udid=xx
DEBU[0000] Opening connection:0xc00036aa50
DEBU[0000] UsbMux sendios.ReadPair on 0xc00000f190
DEBU[0000] UsbMux Receive on 0xc00000f1d8
DEBU[0000] UsbMux sendios.connectMessage on 0xc00000f190
DEBU[0000] UsbMux Receive on 0xc00000f928
DEBU[0000] Lockdown sendios.startSessionRequest
DEBU[0000] enable session ssl on0xc000353480 and wrap with tlsConn0xc000331460
DEBU[0000] Lockdown sendios.startServiceRequest
DEBU[0000] Service started on device                     EnableServiceSSL=true Port=50391 Request=StartService Service=com.apple.mobile.diagnostics_relay
DEBU[0000] Lockdown sendios.stopSessionRequest
DEBU[0000] Closing connection:0xc000353480
DEBU[0000] Opening connection:0xc00036b3c0
DEBU[0000] UsbMux sendios.ReadPair on 0xc0003e42d8
DEBU[0000] UsbMux Receive on 0xc0003e4308
DEBU[0000] Opening connection:0xc00036b560
DEBU[0000] UsbMux sendios.connectMessage on 0xc0003e4a10
DEBU[0000] UsbMux Receive on 0xc0003e4a40
DEBU[0000] enable session ssl on0xc0003c9360 and wrap with tlsConn0xc000331480
INFO[0000] Running wda                                   bundleid=com.0x3c3e.WebDriverAgentRunner.xctrunner testbundleid=com.0x3c3e.WebDriverAgentRunner.xctrunner xctestconfig=WebDriverAgentRunner.xctest
DEBU[0000] Opening connection:0xc000110000
DEBU[0000] UsbMux sendios.ReadPair on 0xc000126020
DEBU[0000] UsbMux Receive on 0xc000126050
DEBU[0000] UsbMux sendios.connectMessage on 0xc000126020
DEBU[0000] UsbMux Receive on 0xc000126758
DEBU[0000] Lockdown sendios.startSessionRequest
DEBU[0000] enable session ssl on0xc00010e000 and wrap with tlsConn0xc000116018
DEBU[0000] Lockdown sendios.startServiceRequest
DEBU[0000] Service started on device                     EnableServiceSSL=true Port=50394 Request=StartService Service=com.apple.testmanagerd.lockdown.secure
DEBU[0000] Lockdown sendios.stopSessionRequest
DEBU[0000] Closing connection:0xc00010e000
DEBU[0000] Opening connection:0xc00042a1a0
DEBU[0000] UsbMux sendios.ReadPair on 0xc0004a2350
DEBU[0000] UsbMux Receive on 0xc0004a2380
DEBU[0000] Opening connection:0xc00042a340
DEBU[0000] UsbMux sendios.connectMessage on 0xc0004a2a88
DEBU[0000] UsbMux Receive on 0xc0004a2ab8
DEBU[0000] enable session ssl on0xc000080bc0 and wrap with tlsConn0xc000330010
DEBU[0000] Opening connection:0xc00042a410
DEBU[0000] UsbMux sendios.ReadPair on 0xc0004a2b18
DEBU[0000] UsbMux Receive on 0xc0004a2b48
DEBU[0000] UsbMux sendios.connectMessage on 0xc0004a2b18
DEBU[0000] UsbMux Receive on 0xc0004a3250
DEBU[0000] Lockdown sendios.startSessionRequest
DEBU[0000] Dispatching:_notifyOfPublishedCapabilities:
DEBU[0000] Global Dispatcher Received: [_notifyOfPublishedCapabilities:] [{t:binary, v:{"com.apple.private.DTXBlockCompression":2,"com.apple.private.DTXConnection":1}},]
DEBU[0000] enable session ssl on0xc000080c40 and wrap with tlsConn0xc0004c4040
DEBU[0000] Lockdown sendios.valueRequest
DEBU[0000] Lockdown sendios.stopSessionRequest
DEBU[0000] Closing connection:0xc000080c40
DEBU[0000] Opening connection:0xc00042b460
DEBU[0000] UsbMux sendios.ReadPair on 0xc0001c1d18
DEBU[0000] UsbMux Receive on 0xc0001c1d48
DEBU[0000] UsbMux sendios.connectMessage on 0xc0001c1d18
DEBU[0000] UsbMux Receive on 0xc000126a10
DEBU[0000] Lockdown sendios.startSessionRequest
DEBU[0000] enable session ssl on0xc0001cea40 and wrap with tlsConn0xc0004c4048
DEBU[0000] Lockdown sendios.startServiceRequest
DEBU[0000] Service started on device                     EnableServiceSSL=false Port=50398 Request=StartService Service=com.apple.mobile.installation_proxy
DEBU[0000] Lockdown sendios.stopSessionRequest
DEBU[0000] Closing connection:0xc0001cea40
DEBU[0000] Opening connection:0xc00036a530
DEBU[0000] UsbMux sendios.ReadPair on 0xc000126db8
DEBU[0000] UsbMux Receive on 0xc000126de8
DEBU[0000] Opening connection:0xc00036a6d0
DEBU[0000] UsbMux sendios.connectMessage on 0xc0001274f0
DEBU[0000] UsbMux Receive on 0xc000127520
DEBU[0000] Lockdown sendmap[string]interface {}
DEBU[0000] Opening connection:0xc0004aee40
DEBU[0000] UsbMux sendios.ReadPair on 0xc00000ec08
DEBU[0000] UsbMux Receive on 0xc00000ec38
DEBU[0000] UsbMux sendios.connectMessage on 0xc00000ec08
DEBU[0000] UsbMux Receive on 0xc0001e4890
DEBU[0000] Lockdown sendios.startSessionRequest
DEBU[0000] enable session ssl on0xc000353240 and wrap with tlsConn0xc0004c4058
DEBU[0000] Lockdown sendios.startServiceRequest
DEBU[0000] Service started on device                     EnableServiceSSL=true Port=50401 Request=StartService Service=com.apple.mobile.house_arrest
DEBU[0000] Lockdown sendios.stopSessionRequest
DEBU[0000] Closing connection:0xc000353240
DEBU[0000] Opening connection:0xc0004ae0c0
DEBU[0000] UsbMux sendios.ReadPair on 0xc0003e40e0
DEBU[0000] UsbMux Receive on 0xc0003e4110
DEBU[0000] Opening connection:0xc00042a2b0
DEBU[0000] UsbMux sendios.connectMessage on 0xc00000ebd8
DEBU[0000] UsbMux Receive on 0xc00000ec20
DEBU[0000] enable session ssl on0xc000352be0 and wrap with tlsConn0xc0004c4018
DEBU[0000] Lockdown sendmap[string]interface {}
DEBU[0000] Closing connection:0xc00010f780
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x135cafe]

goroutine 6 [running]:
github.com/danielpaulus/go-ios/ios/house_arrest.Connection.Close({{0x0, 0x0}, 0xc0000b5208})
	/Users/runner/work/go-ios/go-ios/ios/house_arrest/house_arrest.go:84 +0x1e
github.com/danielpaulus/go-ios/ios/testmanagerd.setupXcuiTest({0xf, {0xc00035f640, 0x8}, {0x1c9c3800, {0xc00035f710, 0x3}, 0xf, 0x14100000, 0x12a8, {0xc00002f7a0, ...}}}, ...)
	/Users/runner/work/go-ios/go-ios/ios/testmanagerd/xcuitestrunner.go:490 +0x88c
github.com/danielpaulus/go-ios/ios/testmanagerd.runXUITestWithBundleIdsXcode12({0x7ffeefbff9f8, 0x0}, {0x7ffeefbffa37, 0x29}, {0x7ffeefbffa70, 0x1b}, {0xf, {0xc00035f640, 0x8}, {0x1c9c3800, ...}}, ...)
	/Users/runner/work/go-ios/go-ios/ios/testmanagerd/xcuitestrunner.go:240 +0xde
github.com/danielpaulus/go-ios/ios/testmanagerd.RunXCUIWithBundleIds({0x7ffeefbff9f8, 0x29}, {0x7ffeefbffa37, 0x29}, {0x7ffeefbffa70, 0x1b}, {0xf, {0xc00035f640, 0x8}, {0x1c9c3800, ...}}, ...)
	/Users/runner/work/go-ios/go-ios/ios/testmanagerd/xcuitestrunner.go:310 +0x10fc
main.Main.func1()
	/Users/runner/work/go-ios/go-ios/main.go:438 +0xda
created by main.Main
	/Users/runner/work/go-ios/go-ios/main.go:437 +0x1ae5

phone: IPhone 6S on 14.7.1
go-ios version: v1.0.34
xcode version: 12.5.1

Does go-ios support the python version?

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

go-ios launch connection to destination device twice while only one connection from client

Describe the bug
go-ios launch connection to destination device twice while only one connection from client to go-ios

To Reproduce
Steps to reproduce the behavior:

  1. ios forward 29183 9100
  2. client app connect to 29183
  3. the program on iphone detect two connections from go-ios

Expected behavior
Only one socket connection should be established

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: MacOS Montreal

Smartphone (please complete the following information):

  • Device: iPhone7
  • OS: iOS14.2

Additional context
lsof -i:29183
COMMAND PID FD TYPE DEVICE SIZE/OFF NODE NAME
ffmpeg_de 44859 27u IPv6 0x540598970be3cf11 0t0 TCP localhost:63591->localhost:29183 (ESTABLISHED)
ffmpeg_de 44859 28u IPv6 0x540598970be3ba71 0t0 TCP localhost:63593->localhost:29183 (ESTABLISHED)
ios 44994 13u IPv6 0x540598970be3c831 0t0 TCP *:29183 (LISTEN)
ios 44994 25u IPv6 0x540598970be38a51 0t0 TCP localhost:29183->localhost:63591 (ESTABLISHED)
ios 44994 26u IPv6 0x540598970be39131 0t0 TCP [::127.0.0.1]:29183->[::127.0.0.1]:63592 (CLOSED)
ios 44994 29u IPv6 0x540598970be39ef1 0t0 TCP localhost:29183->localhost:63593 (ESTABLISHED)
ios 44994 30u IPv6 0x540598970be335d1 0t0 TCP [::127.0.0.1]:29183->[::127.0.0.1]:63594 (CLOSED)

To note on another Mac, everything goes well.
lsof -i:29185
COMMAND PID FD TYPE DEVICE SIZE/OFF NODE NAME
ffmpeg_de 43993 34u IPv4 0x27956e3f0c2e8e69 0t0 TCP localhost:50723->localhost:29185 (ESTABLISHED)
ffmpeg_de 43993 35u IPv4 0x27956e3f0c082891 0t0 TCP localhost:50724->localhost:29185 (ESTABLISHED)
ios 44742 19u IPv6 0x27956e3eec8cfc89 0t0 TCP *:29185 (LISTEN)
ios 44742 26u IPv6 0x27956e3f0a809629 0t0 TCP localhost:29185->localhost:50723 (ESTABLISHED)
ios 44742 28u IPv6 0x27956e3f0a809c89 0t0 TCP localhost:29185->localhost:50724 (ESTABLISHED)

Move pair command from branch go-ios-old

Hi @danielpaulus and thanks for this great project!

One of the many problems I've had with iOS devices is pairing. I've a setup where Xcode says my device is paired and the Safari webdriver says it is not, so I wanna try to pair my phone with go-ios but it seems that functionality isn't there yet:

 ./ios pair  
not yet copied from branch go-ios-old

If that's easy to fix it would be super to have it the current branch.

Best
Peter

Interaction should be better

If you make an interactive interface, and then visit all the practical functions on the software interface, it will be better to use, which can provide high efficiency.

bug: device appears twice for `ios list`

Testing env
macOS Monterey 12.0.1 (21A559)
CLI version: v1.0.32

What happened
When connecting a single device via USB I get the following result:

โžœ  /tmp ~/Downloads/ios list --details | jq
{
  "deviceList": [
    {
      "Udid": "<UDID>",
      "ProductName": "iPhone OS",
      "ProductType": "iPhone8,1",
      "ProductVersion": "14.2"
    },
    {
      "Udid": "<SAME UDID>",
      "ProductName": "iPhone OS",
      "ProductType": "iPhone8,1",
      "ProductVersion": "14.2"
    }
  ]
}

P.S.
I recommand using an issue template for an easier bug reporting process

curl post to JSON header

Hi,
We have deployed a number of devices using Device Farmer and MRX1203 repo for Apple Devices, but since the MRX1203 repo is not being supported anymore, we are trying to move to Control Floor for the Apple devices. With the MRX1203 repo we used the wda post to JSON_HEADER method and iproxy to control the screen for automated tests. For example

ps -ef | grep iproxy
501 46380 46365   0 Thu05PM ??         1:13.89 iproxy -s 0.0.0.0 -u 0000(8437645-000XXXXXXXXXXXXX 6127 8100

port_no=`ps -ef | grep iproxy | grep 0000(8437645-000XXXXXXXXXXXXX | grep 8100 | awk '{print $13}' | tail -1` 
echo $port_no
6127
 
JSON_HEADER='-H "Content-Type:application/json"'
DEVICE_URL=http://localhost:$port_no

# Return to home screen
curl -X POST $JSON_HEADER -d "" $DEVICE_URL/wda/homescreen

sleep 1

#GET session_id
SESSION_ID=`curl -X GET $JSON_HEADER $DEVICE_URL/status | grep sessionId`
SESSION_ID=`echo $SESSION_ID | awk '{print $3}'`
SESSION_ID=`echo $SESSION_ID | cut -d "\"" -f2`

sleep 1


# Open Messages screen
curl -X POST $JSON_HEADER -d "{\"desiredCapabilities\":{\"bundleId\":\"com.apple.MobileSMS\"}}" $DEVICE_URL/wda/apps/launchapp

#get and tap Edit
edit=`curl -X POST $JSON_HEADER -d "{\"using\":\"link text\",\"value\":\"label=Edit\"}" $DEVICE_URL/session/$SESSION_ID/elements | grep ELEMENT`
edit=`echo $edit | awk '{print $3}'`
edit=`echo $edit | cut -d "\"" -f2`
echo $edit
curl -X POST $JSON_HEADER -d "" $DEVICE_URL/session/$SESSION_ID/element/$edit/click

My question, is it possible to do this with for example go-ios forward or go-iso dproxy? If so, how could I do this please
PS Extremely helpful cli, thanks for developing this!

paired supervised device is not paired by `idevicepair` utility

During POC it was discovered that pairing via go-ios on Linux (16.04 - 21.10) for iOS device not detected by libimobiledevice utils.
We use appium for automation and this tool s still uses libimobiledevice utils to perate with iOS devices.

Steps:

  1. register new org in Apple Configurator 2
  2. supervise any iOS device (tested on iPhone 7, 8, 10, 11, 12 and 13)
  3. export org p12 with password
  4. pair device using ios pair [--p12file=<orgid>] [--password=<p12password>]
    -> device is paired and can be used by go-ios utility perfectly
  5. validate pairing using idevicepair validate -u <udid>
    -> device is not paired, i.e. we can't use Appium etc to operate with device. Unpairing etc doesn't help

At the same time if pair device without p12 then we can pair using native idevicepair utility and use device by both components.
Any recommendations etc?

latest v1.0.40 version is used.

Just in case after supervised pairing which suppose to click trust we see that idevicepair says that don't trust was clicked!

idevicepair pair -u udid
ERROR: Device udid said that the user denied the trust dialog.

EnableOpenSSL: false

Describe the bug
I use compile go-ios on Windows.
When I use ./go-ios list, I get right outputs.
But when I use ./go-ios list --detail, I get

{"level":"info","msg":"Handshake errorEOF","time":"2022-02-08T10:50:55+08:00"}
{"err":"StartSession failed: {EnableSessionSSL:false Request: SessionID:} error: EOF","level":"fatal","msg":"failed getting values","time":"2022-02-08T10:50:55+08:00"}

Start application or WDA with arguments

Greetings,

Is there a possibility to start an application or the WebDriverAgent with provided arguments? Asking about WDA in particular, is it possible to provide USE_PORT argument for example so it starts on a specific port?

Best regards,
Nikola

The version of the developer disk image does not match.

Describe the bug
Thank you for the great project.

I ran the command ios image auto. My device is on iOS 15.6.1, but the developer disk image downloaded iOS 15.4. If no matching version is found, an error should be returned.

Also, there are no versions 15.6, 15.6.1, or 16.0 on this haikieu's Github.

The following github is frequently updated.
https://github.com/mspvirajpatel/Xcode_Developer_Disk_Images

To Reproduce
Steps to reproduce the behavior:

  1. run ios image auto
  2. Version 15.4 will be downloaded.

Expected behavior
If no matching version is found, an error should be returned.

Screenshots
image

Desktop (please complete the following information):

  • OS: Windows10 20H2

Smartphone (please complete the following information):

  • Device: iPhone12 mini
  • OS: iOS 15.6.1

ios image auto is not working?

Describe the bug
ios image auto This command did not download the developer disk image.
I opened the direct download link and it downloaded successfully, so it does not appear to be a broken link.

To Reproduce
Steps to reproduce the behavior:

  1. Run command. ios image auto
  2. Error shown in screenshot. "failed downloading image: image not found"

Expected behavior
A developer disk image is downloaded.

Screenshots
image

Desktop:

  • OS: Windows10 20H2

Smartphone:

  • Device: iPhone6 and iPhone6S
  • OS: iOS 12.1.4 and 15.0.2

Failed running WDA

TRAC[0002] UsbMux send ios.connectMessage on 0xc0005165a8
TRAC[0002] UsbMux Receive on 0xc0005165d8
INFO[0003] Handshake errorEOF
FATA[0003] Failed running WDA

My device is iPad 13

Cannot disable device state

Describe the bug
I cannot disable active device state using 'control.Disable(pType)'

To Reproduce
Steps to reproduce the behavior:

  1. Enable a device state on a device using 'control.Enable(pType, profile)'
  2. Check the state - should be active
  3. Attempt to disable the active device state using 'control.Disable(pType)'
  4. Check the state - it is still active.

Expected behavior
'control.Disable(pType)' should disable the provided device state

Desktop (please complete the following information):

  • OS: Ubuntu 18.04 LTS
  • Version v1.0.46

Smartphone (please complete the following information):

  • Device: iPhone SE 2019
  • OS: 15.0

Additional context
I am trying to get a webserver to activate/deactivate a state on a device using a direct implementation of the go-ios code, not the CLI so SIGTERM can't be called.

remotely turning on iOS screen

Awesome library--thanks for making this!

I'm messing with some iPhones remotely and can't quite complete some WebDriverAgent initialization until the screen is on. I played with this a bit and found that I can turn the screen on with go-ios launch com.apple.Preferences (edit: or com.apple.Home, etc.). I hope that helps others. I'd prefer that the behavior be closer to the power button being pressed instead of launching something.

Assume pairing is complete, can you think of a better way to force the screen to come on with this library? It feels like a hack.

xctest bug on iOS13.6

When I started xctest in iOS 13.6, the code entered return. I think this is a bug, there may be such a method in iOS13.6 but there is no selector _IDE_initiateControlSessionWithCapabilities which causes xctest to not run normally

func RunXCUIWithBundleIds(bundleID string, testRunnerBundleID string, xctestConfigFileName string, device ios.DeviceEntry, wdaargs []string, wdaenv []string) error {

	conn, err := dtx.NewConnection(device, testmanagerdiOS14)
	if err == nil {
                // here
		return runXUITestWithBundleIdsXcode12(bundleID, testRunnerBundleID, xctestConfigFileName, device, conn, wdaargs, wdaenv)
	}
	log.Debugf("Failed connecting to %s with %v, trying %s", testmanagerdiOS14, err, testmanagerd)

dproxy TLS failure

When I attempt to use dproxy to monitor launching WDA through Xcode I get the following failure:

INFO[0011] Creating binary dump of all communication between MAC OS and debugproxy at: dump-2021.10.07-22.26.17.663/connection-#115-2021.10.07-22.26.29.101/bindump-hostservice-to-proxy.txt
INFO[0011] map[Label:xcodebuild ProtocolVersion:2 Request:QueryType]  ID="#115" direction=host2device id="#115"
INFO[0011] done sending to device                        id="#115"
INFO[0011] map[Request:QueryType Type:com.apple.mobile.lockdown]  ID="#115" direction=device2host id="#115"
INFO[0011] map[Key:ProductName Label:xcodebuild ProtocolVersion:2 Request:GetValue]  ID="#115" direction=host2device id="#115"
INFO[0011] done sending to device                        id="#115"
INFO[0011] map[Key:ProductName Request:GetValue Value:iPhone OS]  ID="#115" direction=device2host id="#115"
INFO[0011] Handshake errorwrite unix /var/run/usbmuxd->: write: broken pipe
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x24 pc=0x1255277]

goroutine 148 [running]:
crypto/tls.(*Conn).handshakeContext(0x0, {0x14b43d0, 0xc00001a098})
	/usr/local/go/src/crypto/tls/conn.go:1432 +0x1d7
crypto/tls.(*Conn).HandshakeContext(...)
	/usr/local/go/src/crypto/tls/conn.go:1395
crypto/tls.(*Conn).Handshake(...)
	/usr/local/go/src/crypto/tls/conn.go:1379
crypto/tls.(*Conn).Read(0x0, {0xc00009432c, 0x4, 0x104b072})
	/usr/local/go/src/crypto/tls/conn.go:1264 +0x65
io.ReadAtLeast({0x1f8a340, 0x0}, {0xc00009432c, 0x4, 0x4}, 0x4)
	/usr/local/go/src/io/io.go:328 +0x9a
io.ReadFull(...)
	/usr/local/go/src/io/io.go:347
encoding/binary.Read({0x1f8a340, 0x0}, {0x14b9320, 0x17688b8}, {0x139e980, 0xc0004fb200})
	/usr/local/go/src/encoding/binary/binary.go:166 +0xc8
github.com/danielpaulus/go-ios/ios.PlistCodec.Decode({}, {0x1f8a340, 0x0})
	/Users/user/git/go-ios/ios/plistcodec.go:48 +0x94
github.com/danielpaulus/go-ios/ios.(*LockDownConnection).ReadMessage(0x13ba160)
	/Users/user/git/go-ios/ios/lockdown.go:60 +0x27
github.com/danielpaulus/go-ios/ios/debugproxy.proxyLockDownConnection(0xc0000c4b40, 0xc00034b620, 0xc00034b648)
	/Users/user/git/go-ios/ios/debugproxy/lockdownhandler.go:14 +0x53
github.com/danielpaulus/go-ios/ios/debugproxy.handleConnectToLockdown({{0x23b, 0x1, 0x8, 0x17}, {0xc0001d6d80, 0x22b, 0x22b}}, 0x9, 0x0, 0xc000098f00, ...)
	/Users/user/git/go-ios/ios/debugproxy/muxhandler.go:121 +0x217
github.com/danielpaulus/go-ios/ios/debugproxy.handleConnect({{0x23b, 0x1, 0x8, 0x17}, {0xc0001d6d80, 0x22b, 0x22b}}, 0x3ed, 0xc0000c4b40, 0xc000098f00, ...)
	/Users/user/git/go-ios/ios/debugproxy/muxhandler.go:100 +0x18d
github.com/danielpaulus/go-ios/ios/debugproxy.proxyUsbMuxConnection(0xc0000c4b40, 0xc000098f00, 0xc000098f18)
	/Users/user/git/go-ios/ios/debugproxy/muxhandler.go:37 +0xe65
created by github.com/danielpaulus/go-ios/ios/debugproxy.startProxyConnection
	/Users/user/git/go-ios/ios/debugproxy/debugproxy.go:156 +0x6d6

incomplete deviceinfo

I tried this repo and compared the output of ios info with ideviceinfo and found that the results are different, many values can be got by ideviceinfo but not ios info, also, ios info is not able to query by the keys listed in ideviceinfo help.

Missing int64 primitive

When attempting to use dproxy I get an error out of unarchiver. It corresponds to the following chunk of code in unarchiver.go:

//if this crashes, I forgot a primitive type
nonPrimitiveObjectRef := objectRef.(map[string]interface{})

The line above in the error message indicates it was an int64.
I added the following to the isPrimitiveObject function and it seems to resolve it:

if v, ok := object.(int64); ok {
	return v, ok
}

runwda doesn't work on iOS 11

I have created a parsed / rendered dump of the message stream used by Xcode to start WDA on an iOS 11 device:
https://dryark.com/ios11.htm

This was created by:

  1. Creating a dtxproxy dump using go-ios ( I used an older machine where it still works )
  2. Run iosif ddf [folder of dump] > ios11.xml
  3. Run iosif/dump.pl ios11.xml > ios11.htm

How to get the CrashReport

I can see function idevicecrashreport in libimobiledevice. How could I get iphone crash report with go-ios.

1.Is it possible to install web_Driver agent with go-ios (without xcode)?

1.Is it possible to install web_Driver agent with go-ios (without xcode)?
2.Is there a way to have preinstalled web driver agent on the device(without mac and xcode)?
3.I'm trying to follow the steps but when I try to build the docker but when i come to this step ./run.sh ios-appium-on-linux I'm getting this
{"level":"info","msg":"Start listening on port 7777 forwarding to port 8100 on device","time":"2021-11-09T11:47:17Z"}
/startAppium.sh: line 11: /root/.nvm/versions/node/v14.16.0/bin/appium: No such file or directory

Thank you in advance!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.