ipad ip address using command line tools - ios

I have an iOS device (iPhone or iPad) hooked up to my mac laptop. Obviously, you can get the IP address of the iOS device from settings, but is there a way to do this using command line tools (without rooting the iOS device)? I need to be able to do this for some test automation.

brew install open ssl
brew install --HEAD libimobiledevice
brew install arp-scan
macaddr=$(ideviceinfo -u <UUID OF DEVICE> -k WiFiAddress)
arp-scan --interface=<eth interface connected to same wifi> --localnet | grep $mac_addr"
This is flaky, because you need to force the devices to see each other on the LAN. I work around it turning wifi on and off on the device.
This is the best solution I have found. I generally cache this info since getting it dynamically is unreliable. arp-scan also requires you be root to access the network device.

You can use this web service to know your IP Address , the web service returns you an XML with your ip-address ...
http://www.domaintools.com/research/my-ip/myip.xml

Related

Unable to use objection with corellium device

I am trying to use objection with my Corellium iOS device but I am getting the following error.
Using USB device `iPhone`
Unable to connect to the frida server: unable to communicate with remote frida-server; please ensure that major versions match and that the remote Frida has the feature you are trying to use
Corellium iOS Device Details: (iPhone 7 Plus | 14.3 | Jailbroken)
iOS Device Frida Version: 16.0.1
MacOS Frida Version: 16.0.1
For connecting to my virtual device I am using Tunnelblick and USBFlux. The connection is successful because I can SSH to my device and use frida-ps and frida-ls-devices without any issues.
However, when I issue the objection command, I encounter an error.
ubaidahmed#Ubaids-MacBook-Pro ~ % frida-ps -Ua
PID Name Identifier
3 ------- ---------------------------------
593 Cydia com.saurik.Cydia
546 DVIA-v2 com.highaltitudehacks.DVIAswiftv2
ubaidahmed#Ubaids-MacBook-Pro ~ % objection -g 546 explore
Using USB device `iPhone`
Unable to connect to the frida server: unable to communicate with remote frida-server; please ensure that major versions match and that the remote Frida has the feature you are trying to use
I even tried to upgrade the frida version to the latest 16.0.8 on my virtual iOS device but again faced the following error in cydia.
Steps followed for updating frida version:
Go to Sources
Edit > Add > https://build.frida.re - Add Source
Select the added entry - build.frida.re > All Packages
Select Frida (it shows latest Frida version) and click on Install
Installation fails
Edited: Also, I have tried to use objection with network option but still no success.
I have tried to provide as much information as possible related to the issue. Please help me out in resolving this strange issue.
If the connection via virtual USB doesn't work you can switch to a direct TCP connection. Execute frida -H IP:port and e.g. use port forwarding to get the frida server port to your local system.
The default frida-server port is 27042.
frida_16.0.8 in Cydia
The recent versions of the Debian package of frida-server don't work (see this issue). Keep your existing version or if you need to install it manually download the deb package of frida_16.0.7_iphoneos-arm.deb (do not use the 16.0.8 version, it is defect use at least 16.0.7 or older) from frida release page.
Download the deb package and install it manually by executing dpkg -i <frida...iphoneos-arm.deb>.

No iOS device found, is it plugged in? in ideviceinstaller/ideviceinfo

I am getting the following error when I run ideviceinstaller/ideviceinfo commands:
No iOS device found, is it plugged in?
My iPhone is certainly plugged is and visible in lsusb.
Restart the usbmuxd service and your device will show up normally:
systemctl restart usbmuxd.service
Your iPhone will vibrate if it connected successfully.
there is a file 'lockdownd' and it might have 0700 permissions with the owner as root. You should try chmod 0705 lockdownd. restart was not necessary for me. You might also run ideviceinstaller/ideviceinfo as root or with sudo. You might not have a recent version or you might have multiple versions installed. There is an xcode version-ish and there is a brew.
UPDATE there are a lot of details missing here, however, I gt this error when I had installed libimodiledevices with brew and allowed or told brew to clean the other dynlinks. That disabled ideviceinfo etc because of a missing dynlib. For example flutter prepackages these tools and brew breaks it.

Can I somehow read the iOS device logs before the phone is unlocked

After a hard reset (holding power+home) I would like to be able to see the iOS System logs after the phone boots. Using Xcode I can open the "Devices" tool, but unless I unlock the phone I cannot attach to the device to see the logs.
Is there a way to see the iPhone device logs while the phone is booting? Either in real-time or as a log file that I can examine afterwards.
I have also tried using the "View device logs" button in the Devices Tool, but all that I can see in there are crash logs.
Yes, it is possible, there are few options out there, one of my favorites is idevicesyslog, do the following:
Install brew on your mac:
http://coolestguidesontheplanet.com/installing-homebrew-os-x-yosemite-10-10-package-manager-unix-apps/
Using brew, install libimobiledevice
brew install libimobiledevice
Once done, connect idevice to mac and type in terminal
idevicesyslog
Note: if there is more than 1 device connected to the mac, you will need to specify the device udid you wish to work with. In order to get the device udid, run the following command:
idevice_id -l
Then run idevicesyslog, but this time specify the udid:
idevicesyslog -u <device udid>

Uninstalling app from iOS Device thru command line

I'm running test on an app using UIAutomation, but I need a way to uninstall the app in a device (iPhone, iPad, iPod) without using jailbreak.
Currently I´m using fruitstrap to upload the app to a cable connected device using the device UID.
Is there a way thru a command line (yes it MUST be command line) to delete the app from the device?
Use the fantastic mobiledevice tool!
mobiledevice repo on GitHub
It compiles in seconds and it let you interact with the connected iOS devices very easily.
Use ideviceinstaller
To install app: ideviceinstaller -i testApp.ipa
To uninstall app: If you don't know bundle id, first get bundle id
ideviceinstaller -l then
ideviceinstaller -U com.testPackage.testApp
New Kid on the block - ios-deploy MobileDevice was a good tool, however not being actively developed. ios-deploy works great.
Here is the command -
ios-deploy --id <device_id> --uninstall_only --bundle_id com.app.testapp
(ios-deploy is forked from fruitstrap only)
Via command line: uninstall [-i/--id device_id] -b/--bundle bundle.app
Removed the specified bundle identifier (eg com.foo.MyApp) from the specified device, or all attached devices if none are specified.
Used this repository
Note: works with SDK 6.1.3 but not with SDK 6.1.4
For those who still get here by google:
You can installe the ruby gem ios_app_installer (which is a "light" version of ios-deploy) and after installing it use the command
ios_app_installer -b <bundle id> -u
(The device may have to be connected via USB)

iOS (iPhone, iPad, iPodTouch) view real-time console log terminal

Is there a way to view the real-time console log to view NSLog and other debug messages in a real-time manner, such as adb logcat?
The solution documented by Apple in Technical Q&A QA1747 Debugging Deployed iOS Apps for Xcode 6 is:
Choose Window -> Devices from the Xcode menu.
Choose the device in the left column.
Click the up-triangle at the bottom left of the right hand panel to show the device console.
Two options:
libimobiledevice is installable via homebrew and works great. Its idevicesyslog tool works similarly to deviceconsole (below), and it supports wirelessly viewing your device's syslog (!)
I've written more about that on Tumblr tl;dr:
brew install libimobiledevice
idevice_id --list // list available device UDIDs
idevicesyslog -u <device udid>
with the device connected via USB or available on the local wireless network.
(Keeping for the historical record, from 2013:) deviceconsole from rpetrich is a much less wacked-out solution than ideviceconsole above. My fork of it builds and runs in Xcode 5 out of the box, and the Build action will install the binary to /usr/local/bin for ease of use.
As an additional helpful bit of info, I use it in the following style which makes it easy to find the device I want in my shell history and removes unnecessary > lines that deviceconsole prints out.
deviceconsole -d -u <device UDID> | uniq -u && echo "<device name>"
EDIT: Please use #cbowns solution - deviceconsole is compatible with iOS9 and much easier to use.
This is a open-source program that displays the iDevice's system log in Terminal (in a manner similar to tail -F). No jailbreak is required, and the output is fully grep'able so you can filter to see output from your program only. What's particularly good about this solution is you can view the log whether or not the app was launched in debug mode from XCode.
Here's how:
Grab the libimobiledevice binary for Mac OS X from my github account at
https://github.com/benvium/libimobiledevice-macosx/zipball/master
Follow the install instructions here:
https://github.com/benvium/libimobiledevice-macosx/blob/master/README.md
Connect your device, open up Terminal.app and type:
idevicesyslog
Up pops a real-time display of the device's system log.
With it being a console app, you can filter the log using unix commands, such as grep
For instance, see all log messages from a particular app:
idevicesyslog | grep myappname
Taken from my blog at http://pervasivecode.blogspot.co.uk/2012/06/view-log-output-of-any-app-on-iphone-or.html
Just open the Application Console.app on mac osX.
You can find it under Applications > Utilities > Console.
On the left side of the application all your connected devices are listed.
Try the freeware iOS Console. Just download, launch, connect your device -- et voila!
This might be what you're looking for: Xcode Organizer
device > terminal output is on iPhone configuration app
here: http://support.apple.com/kb/DL1465
You have three options:
Xcode Organizer
Jailbroken device with syslogd + openSSH
Use dup2 to redirect all STDERR and STDOUT to a file and then "tail -f" that file (this last one is more a simulator thing, since you are stuck with the same problem of tailing a file on the device).
So, to get the 2º one you just need to install syslogd and OpenSSH from Cydia, restart required after to get syslogd going; now just open a ssh session to your device (via terminal or putty on windows), and type "tail -f /var/log/syslog". And there you go, wireless real time system log.
If you would like to try the 3º just search for "dup2" online, it's a system call.
To view your iOS device's console in Safari on your Mac (Mac only apparently):
On your iOS device, go to Settings > Safari > Advanced and switch on Web Inspector
On your iOS device, load your web page in Safari
Connect your device directly to your Mac
On your Mac, if you've not already got Safari's Developer menu activated, go to Preferences > Advanced, and select "Show Develop menu in menu bar"
On your Mac, go to Develop > [your iOS device name] > [your web page]
Safari's Inspector will appear showing a console for your iOS device.
As an alternative, you can use an on-screen logging tool like ticker-log to view logs without having (convenient) access to the console.

Resources