Executing libimobiledevice commands over wifi - ios

I am trying to recreate the trustjacking attack presented by Symantec at RSA 2018 but I have been unable to execute libimobiledevice commands remotely through iTunes wifi sync.
When I have a physical USB connection between my ios device and the computer all the commands work perfectly but when I enable itunes wifi sync and disconnect the cable I can no longer contact to the device.
However, when I run idevice_id -l over wifi it displays the uuid of my ios device but any other commands just display errors such as ERROR: Could not connect to device or No device found, is it plugged in?.
Any suggestions on how I can resolve this problem?

Its turns out that my version of libimobiledevice was corrupt as well as the dependencies. I fixed this by completely reinstalling libimobiledevice and its dependencies as well as removing all previous data stored by libimobiledevice.

I had a similar problem and I had to uninstall the libmobiledevice completely and re-install it again. I found this Github issue here for complete instructions and hence I am sharing the commands here as well for convenience for the future developers.
brew uninstall --ignore-dependencies libimobiledevice
brew uninstall --ignore-dependencies ideviceinstaller
brew uninstall --ignore-dependencies usbmuxd
sudo rm /var/db/lockdown/*
brew install --HEAD usbmuxd
brew unlink usbmuxd
brew link usbmuxd
brew install --HEAD libimobiledevice
brew install --HEAD ideviceinstaller
If you do not have brew installed in your machine, please follow the instruction from this website.

Related

How to install legacy telepresence version on mac os

I installed the newest release of telepresence by
brew install datawire/blackbird/telepresence
However my scripts are using some legacy telepresence commands that are no longer supported -
The following flags used don't have a direct translation to Telepresence: --serviceaccount --also-proxy --also-proxy --also-proxy --also-proxy
I have not been able to find a way to install an old version of telepresence on mac os.
My preference would to be to use brew but this does not look possible.
brew install telepresence-legacy
brew unlink telepresence
wget https://raw.githubusercontent.com/datawire/homebrew-blackbird/1797069a468a4b056edbfcaf63e9ac665470cdaf/Formula/telepresence.rb
brew install ./telepresence.rb
I found this here
installing-old-version-telepresence-macos/

How to install Firefox Developer edition via Homebrew?

This is how to install Firefox via Homebrew:
brew install --cask firefox
But how to install the 'Firefox Developer edition'?
Everything I tried fails with 'Error: Cask '...' is unavailable: No Cask with this name exists.'
brew install --cask firefox-developer-edition
brew install --cask firefox-nightly
What's the correct command?
I've finally found a solution.
A lot of commands on the internet were outdated.
These 2 commands worked for me in 2022:
brew tap homebrew/cask-versions
brew install --cask firefox-developer-edition
Homebrew Structure Files
If we go to homebrew repo in our Mac: /usr/local/Homebrew/Library/Taps/homebrew we see some folder like homebrew-core, homebrew-cask, homebrew-cask-fonts these files are what we get when we run :
brew search [formula or cask name]
When we do brew tap homebrew/cask-versions the casks files are cloned to our Homebrew repo. Since that, you may install an alternate cask that was not found before.
For more information, you may found it here.

iOS real device Unknown device or simulator UDID

Appium was giving me the error
The 'idevice_id' program is not installed. If you are running a real device test it is necessary. Install with 'brew install libimobiledevice --HEAD.
Then I followed the steps below.
brew uninstall ideviceinstaller
brew uninstall --ignore-dependencies libimobiledevice
brew install --HEAD libimobiledevice
brew unlink libimobiledevice && brew link libimobiledevice
brew install --HEAD ideviceinstaller
brew unlink ideviceinstaller && brew link ideviceinstaller
NOW I am getting this error:
Encountered internal error running command: Error: Unknown device or simulator UDID: ‘G9F8D9FS9DFDF76159347C6GD09FDF’
When I type the
idevice_id --list
command, my UDID shows up. I do not understand why Appium would not recognize it.
I am using Appium 1.14.1 on an iPhone X with iOS version 12.4.
It is a real device.

Flutter get error when run on the real device

im using flutter when to run on the real iphone device i get bellow error
when i run bellow mentioned commands i get the same error
brew uninstall --ignore-dependencies libimobiledevice
brew install --HEAD libimobiledevice
brew install ideviceinstaller
[!] iOS toolchain - develop for iOS devices (Xcode 10.0)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 10.0, Build version 10A255
✗ Verify that all connected devices have been paired with this computer in Xcode.
If all devices have been paired, libimobiledevice and ideviceinstaller may require updating.
To update, run:
brew uninstall --ignore-dependencies libimobiledevice
brew install --HEAD libimobiledevice
brew install ideviceinstaller
• ios-deploy 2.0.0
• CocoaPods version 1.5.3
You're probably hitting the issue described at https://github.com/flutter/flutter/issues/22595.
Can you try to make sure you update usbmuxd as well? You should be able to run:
brew update
brew uninstall libimobiledevice
brew uninstall usbmuxd
brew install --HEAD usbmuxd
brew install --HEAD libimobiledevice

ideviceinstaller fails with "Could not connect to lockdownd. Exiting."

When I try to use ideviceinstaller, the command fails with the following error message:
"Could not connect to lockdownd. Exiting."
Example commands:
ideviceinstaller -l
ideviceinstaller -i Something.ipa
I have googled more than an hour to find the solution, however nothing worked for me:
Reinstall ideviceinstaller
Reinstall libimobiledevice
Reinstall brew and reinstall again both ideviceinstaller, libimobiledevice
It works only if I use sudo but it's unfortunately not acceptable in my case.
System paramereters:
MacBookPro with 10.11.5 OSX El Capitan
Target devices: iPhone 5, iPad 2
Note:
I have installed both Xcode 7.3.1 and Xcode 8 beta 3 on my computer. And used these commands to switch between them:
sudo xcode-select -switch /Applications/Xcode-beta.app/
sudo xcode-select -switch /Applications/Xcode.app/
Meanwhile I found the answer. This command will add durable privileges to use ideviceinstaller:
sudo chmod -R 777 /var/db/lockdown/
Just FYI: updates to macOS, iTunes, and probably other Apple software will (correctly) reset the permissions on /var/db/lockdown.
The best solution here is to get the latest libimobiledevice, which has a fix for this particular issue:
brew uninstall ideviceinstaller
brew uninstall libimobiledevice
brew install --HEAD libimobiledevice
brew link --overwrite libimobiledevice
brew install ideviceinstaller
brew link --overwrite ideviceinstaller
I had many problems with ideviceinstaller too, so at least I have started to use cfgutil.
It's a CLI tool of Apple Configurator 2, always up-to-date and reliable, works well with iOS beta versions.
Just download the free app from the App Store: https://itunes.apple.com/hu/app/apple-configurator-2/id1037126344
Start the app then select "Apple Configurator 2 > Install Automation Tools" from the upper left menu.
To install/uninstall apps:
cfgutil --ecid $ECID remove-app $BUNDLE_ID_OF_INSTALLED_APP;
cfgutil --ecid $ECID install-app $PATH_TO_IPA_OR_APP_FOLDER;
To get ECID, connect an iOS device and run the following command:
cfgutil list
Here are the available functions: https://pastebin.com/ZzeueLK2
When you try this command:
ideviceinstaller -d -i Something.ipa
you will get a detailed error. In my case the error is:
lockdown.c:218 lockdown_check_result(): ERROR: PairingDialogResponsePending
11:28:09 lockdown.c:1012 lockdownd_do_pair(): Pair failure
Could not connect to lockdownd.
Exiting.
On further searching for this error no. 2 I found that there was a trust issue in the Iphone connected, so I opened the Iphone and gave trust device, then the issue got resolved.
To fix this, try first:
usbmuxd --force-exit
sudo usbmuxd -f -v
Then
ideviceinstaller -d -i Something.ipa
bellow commands solved my problem
brew uninstall ideviceinstaller
brew uninstall libimobiledevice
brew install --HEAD libimobiledevice
brew unlink libimobiledevice && brew link libimobiledevice
brew install --HEAD ideviceinstaller
brew unlink ideviceinstaller && brew link ideviceinstaller
sudo chmod -R 777 /var/db/lockdown/
If you are getting this error while brew install --HEAD libimobiledevice
:
"configure: error: Package requirements (libusbmuxd >= 1.1.0) were not met:
Requested 'libusbmuxd >= 1.1.0' but version of libusbmuxd is 1.0.10"
Below commands will solve the issue:
brew update
brew uninstall --ignore-dependencies libimobiledevice
brew uninstall --ignore-dependencies usbmuxd
brew install --HEAD usbmuxd
brew unlink usbmuxd
brew link usbmuxd
brew install --HEAD libimobiledevice
brew install ideviceinstaller
use above mentioned command ->sudo chmod -R 777 /var/db/lockdown/
if the above command does not work then, remove files from lockdown folder
-> cd /var/db/lockdown/
-> rm -rf *
then try ->ideviceinstaller -l
In my case, the steps doesn't work.
Finally, I find a way to resolve:
DISCONNECT your device!
run cmd in sequence:
brew uninstall ideviceinstaller
brew uninstall libimobiledevice
brew install --HEAD libimobiledevice
brew install ideviceinstaller
sudo chmod -R 777 /var/db/lockdown
that works for me.

Resources