HimbeersaftLP / ios-safari-remote-debug-kit

Remotely debugging iOS Safari on Windows and Linux
GNU General Public License v3.0
210 stars 17 forks source link

Unable to attach inspector / iOS 16 issues? #13

Closed Gandalf1783 closed 9 months ago

Gandalf1783 commented 2 years ago

I get this in the 2nd CMD Window thats opening:

Listing devices on :9221
Could not start com.apple.webinspector!: No error
Unable to attach 00008120-001E250C110B401E inspector

While the powershell window instructs me to open the localhost:8080 stuff, it does not show errors:

====================================================================================
Will try to launch a web server on http://localhost:8080
You can then open http://localhost:8080/Main.html?ws=localhost:9222/devtools/page/1
in a Chromium or WebKit based browser to start debugging.
Press Ctrl+C to exit.
====================================================================================

Searching web server
Found Python 3, using it to serve the WebInspector

Using an iPhone 14, with iOS 16.0.3 on it. Could not get any debuggin software to start yet.

HimbeersaftLP commented 2 years ago

Appears to be related to #4 and #7.

Make sure iTunes is installed and your PC is "trusted" by your iOS device. (Check if you can transfer music with iTunes)

Gandalf1783 commented 2 years ago

Itunes is installed and up-to-date.

I didnt sync any music yet, but I have access to all the files through the app manager. I can only assume it is trusted because I did not get any popup for trusting.

HimbeersaftLP commented 2 years ago

Hmm, did you also double-check if the Web Inspector is enabled in Safari settings and you are using Safari and not another browser?

Gandalf1783 commented 2 years ago

Pretty sure, I was able to debug in Safari using another non-free Software just fine.

HimbeersaftLP commented 2 years ago

Can you try adding --debug to the argument list here: https://github.com/HimbeersaftLP/ios-safari-remote-debug-kit/blob/9e86469f1a140f4ea88762f1888875fa5d515de6/src/start.ps1#L72

$debugProxyProc = Start-Process $debugProxyExe -ArgumentList "--no-frontend --debug" -PassThru

and then sending the output again

Gandalf1783 commented 1 year ago

Sure, I will try when I'm home again.

cativo commented 1 year ago

could it be related to this : https://github.com/google/ios-webkit-debug-proxy/issues/61#issuecomment-200089042?

Gandalf1783 commented 1 year ago

I finally had time to try this out.

The Log insinde the extra window that pops up is this:

ss.add_server_fd(444)
Listing devices on :9221
ss.add_fd(448)
ss.add_server_fd(644)
ss.remove_server_fd(644)
ss.recv fd=448 len=960
ss.add_server_fd(664)
Could not start com.apple.webinspector!: No error
ss.remove_server_fd(664)
Unable to attach 00008120-001E250C110B401E inspector
ss.accept server=444 new_client=696
ss.add_fd(696)
varndellwagglebee commented 1 year ago

I'm having the same issue. Here is what I get with the debug

ss.add_server_fd(452)
Listing devices on :9221
ss.add_fd(460)
ss.add_server_fd(656)
ss.remove_server_fd(656)
ss.recv fd=460 len=958
ss.add_server_fd(660)
Could not start com.apple.webinspector!: No error
ss.remove_server_fd(660)
Unable to attach 00008110-000E35020A31801E inspector
HimbeersaftLP commented 1 year ago

@Gandalf1783 @cativo @varndellwagglebee It looks like this is a known issue of ios-webkit-debug-proxy as it is listed in their README: https://github.com/google/ios-webkit-debug-proxy#could-not-start-comapplewebinspector-success Though it looks like they only have advice for Linux.

Gandalf1783 commented 1 year ago

Is it known which part exactly fails? If it is just a USB-Lib Call from Windows, maybe we have to adjust the parameters.

I was able to get a debug-session up using some proprietary/paid software, which worked just fine.

I therefore assume that its possible to fix this.

HimbeersaftLP commented 1 year ago

@Gandalf1783 The error comes from this call to the libimobiledevice library: https://github.com/google/ios-webkit-debug-proxy/blob/12d5cd12e8d1803f7e5b64d8c4637db698de3d6a/src/webinspector.c#L157

Personally, I can't really debug the issue since I don't run into it.

FanningHau commented 1 year ago

Same issue here on Windows10 ,the test device is iPhone 14 Pro ,OS version is 16.2

artygus commented 1 year ago

did you try clearing up lockdown directory? C:\ProgramData\Apple\Lockdown? also make sure you have latest iTunes installed, version 12.12.7.1 atm

HermanCodesAtWork commented 1 year ago

Having the same problem tried on 2 different iPhones, one on V16.0 and one on V16.4.1 both have the same output

laurenceks commented 1 year ago

Also experiencing this issue - any news on whether this can/will be fixed or of a workaround?

17 commented 1 year ago

Windows11 ,the test device is iPhone 13 Ios16.4 , I don't run into it.

c-eugenio commented 1 year ago

Hey guys, i fixed it.

just update the link of the start.ps1 script to the latest ios-webkit-debug-proxy release.

line 19:

$debugProxyUrl = "https://github.com/google/ios-webkit-debug-proxy/releases/download/v1.9.0/ios-webkit-debug-proxy-1.9.0-win64-bin.zip"

PS: make sure to delete the folder ios-webkit-debug-proxy before re-running start.ps1

laurenceks commented 1 year ago

Hey guys, i fixed it.

just update the link of the start.ps1 script to the latest ios-webkit-debug-proxy release.

line 19:


$debugProxyUrl = "https://github.com/google/ios-webkit-debug-proxy/releases/download/v1.9.0/ios-webkit-debug-proxy-1.9.0-win64-bin.zip"

PS: make sure to delete the folder ios-webkit-debug-proxy before re-running start.ps1

This worked for me, thanks!

Gandalf1783 commented 1 year ago

This was too easy :)

Thanks, will try out later!

HimbeersaftLP commented 1 year ago

I just pushed a new commit that will automatically update the version of ios-webkit-debug-proxy https://github.com/HimbeersaftLP/ios-safari-remote-debug-kit/commit/0e7321f0530ced2cba22726a31e1eeed4375b84f

HimbeersaftLP commented 1 year ago

@Gandalf1783 @cativo @varndellwagglebee @FanningHau @HermanCodesAtWork @laurenceks @17 @arnoclr @superlucker Can you check if this works for you?

Gandalf1783 commented 1 year ago

Now checking...

Gandalf1783 commented 1 year ago

Since I moved from Windows to Linux in the meantime, I cant reliably check the current state of it working/not working. I tried passing the device into a windows 10 vm.

My iPhone is recognized and the driver was installed by windows update. However, in my case after running start.sh (even as admin) it exits out after "Running ios-webkit-debug-proxy". This could be an issue with qemu, but currently I dont have any Windows-System near me to test it on direct hardware. image

(EDIT: For a short time, the CMD opens with "Listening on " followed by some port (9221 I think?), and it immidiately closes again.)

(EDIT 2: I of course used the latest commit and did a fresh git clone on the repo, executed the generate.ps1 script and ran start.ps1)

HimbeersaftLP commented 1 year ago

@Gandalf1783 Thanks for taking the extra effort! Does the VM have iTunes installed?

Gandalf1783 commented 1 year ago

No, completely missed that point 🙃 Will try after school with iTunes installed :)

Gandalf1783 commented 1 year ago

Finally, I installed iTunes 12.10.11 (64 Bit) via exe, not via MS Store. While my iPhone connected, I was not able to enter the http://localhost:8080/ link, it refused the connection. Also, with 127.0.0.1:8080/ it did not want to connect to the debugger. (Not the websocket fails, but the port 8080 does not seem to be open).

EDIT: I will try rebooting the windows machine and then try again, incase of some itunes/idevice drivers needing to load.

Gandalf1783 commented 1 year ago

Nope, a reboot did not fix it. The edge://inspect site lists a tab I actually opened on safari on my phone, but its not the current one and I also cannot click on "start debugging" -> nothing happens.

No errors in the powershell/cmd consoles:

image

laurenceks commented 1 year ago

Nope, a reboot did not fix it. The edge://inspect site lists a tab I actually opened on safari on my phone, but its not the current one and I also cannot click on "start debugging" -> nothing happens.

No errors in the powershell/cmd consoles:

image

If it helps I deleted the generated folders and re-ran generate, I also disabled python and used node

HimbeersaftLP commented 1 year ago

@Gandalf1783 Thanks for testing again! As Lauren said, I think you're now running into the other known issue, which is the Python detection failing due to the Microsoft Store shortcut (#16)

c-eugenio commented 1 year ago

If it helps, I did not use Python for the server.

HimbeersaftLP commented 1 year ago

I fixed the Python issue in commit https://github.com/HimbeersaftLP/ios-safari-remote-debug-kit/commit/77620eb0e1bbbb12590a071bcc4bf9ce02916e27 btw

HimbeersaftLP commented 9 months ago

I'm going to assume this is fixed now. Thanks for reporting, feel free to reopen if anyone still experiences this issue.