BlueZ map-client and iOS 8.x device - ios

I am attempting to use the supplied map-client in BlueZ 5.30 to read the SMS inbox from an iPhone running iOS 8.3
When I run the map-client with the phone's address I can use calls such as -l to see the directory listings and through repeated -c calls I've worked out that the messages should be in /telecom/msg/inbox.
However, I can never see any messages in this folder when called -L despite there being lots in the phones Message app. I've also tried sending a message to the phone and asking for the folder, but nothing appears - I always get an empty python list:
{}
Has anyone else managed to use BlueZ map-client to read an iOS device's messages?

To view messages in the inbox, first we have to change the directory to the standard path /telecom/msg/inbox.
so ./map-client -d BD_ADDRS -c /telecom/msg/inbox -L LS_MSG
similarly for outbox, sent, draft, deleted

I just ran into the same problem and wound up here so I'll post for the benefit of anyone else who does the same:
The LS_MSG argument to -L is treated as the folder to read, so to read the inbox the command would be:
./map-client -d BD_ADDRS -c /telecom/msg -L inbox
This wasn't at all clear to me from the ./map-client --help output, so I ended up reading the source code to figure it out.

Related

iOS app logging somewhere other than Xcode console

There's an app I've started working on, that regularly logs to the console a lot of stuff, and it's really not convenient to use the console for additional debug logs. I don't want to erase these logs, because there are a few people that are maintaining these logs, and it might be important to them.
So I actually need to to write my debug stuff to a different place. one option is to write it to a file and watch it in Terminal using tail command, but an iOS app can only write inside its folder which, when using a simulator, is always changing each time I run the app. and I don't want to change the path int the tail command every time - I want a fast process.
Does anyone have an idea for such external log place that I can use easily?
Here's how to make it easier to find and tail your log file when running in Simulator (I use this myself):
1) Add the following code to your home directory's .bashrc then log out and back in again.
xcodelog()
{
find . -name xcode.log -type f -print0 | xargs -0 stat -f "%m %N" | sort -rn | head -1 | cut -f2- -d" "
}
2) Start your app in Xcode's simulator, such that at least something gets logged to your file. Oh, and the file your app is logging to needs to be named "xcode.log" unless you want to change the filename in the above code.
3) Open terminal and switch to your ~/Library/Developer/CoreSimulator directory. Then perform the following command (it displays the last 100 lines of it along with anything new you dump to it).
tail -n 100 -f $(xcodelog)
So the above command hunts for that file among all your simulator devices and their apps, hunting down the most recent "xcode.log" file you've written to (among all apps and devices in entire CoreSimulator subdirectory system).
To clear the most recent xcode.log file, you can do this command:
cat /dev/null > $(xcodelog)
I switched to this approach for all my logging when Xcode 8 lost support for plugins, along with the very fine XcodeColors plugin that would do ANSI color logging into Xcode's console. So I changed my log system to output colors that terminal would support when doing a tail of a file. So I can spot errors in red, warnings in orange, user step logging in yellow, and various degrees of important other info in progressive shades of gray. :)

Can you use macOS "log stream" or "log show" to get messages from connected iOS devices?

With the introduction of "Unified Logging" in macOS 10.12 Sierra, one can use the log command to view system log messages in a terminal. For example
sudo log stream
or
sudo log stream --process `pgrep -f /usr/local/bin/myprogram` --info --debug
or
log show --predicate 'process == "myprogram"' --last 1h --info --debug
Using the new "unified" Console.app, one can view system messages and can also view messages from connected iOS devices.
Is there any way to use the log command or any other command-line interface to view iOS device messages in Terminal, or to send them to a file? Or is Console.app the only way?
tl;dr: log collect —device
log collect --device lets you retrieve log archives that can be passed into log show --archive system_logs.logarchive with all the options you're familiar with.
Use log collect --device to automatically guess the device you're referring to.
log collect device-name="Maxs iPhone" or log collect device-udid=abcdefg to collect from a particular device.
log collect --output /your/path will save it to your specified file name or directory. If --output is not given, your output will be in the current directory as system_logs.logarchive.
Note: I occasionally get errors about log: failed to create archive: Device not configured (6) or log: failed to create archive: Connection reset by peer (54) but if I just rerun the command it'll sometimes work 🤷🏾‍♀️
You can, using third-party OSS tools.
https://libimobiledevice.org
These are available using homebrew. brew install libimobiledevice
You can discover available devices using idevice_id and then start streaming logs using idevicesyslog -n -u <duid>

VBS printer script executing error

I have some trouble executing/using vbs scripts linked to printers. They are located in %windir%/System32/Printing_Admin_Scripts
The objective is to plan a weekly print task to preserve ink cartridge
Looking at the scripts, everything was available for me to create this task
The main script to use is prnqctl.vbs
Before to create my task, I have tried to test the script and this is what I got (sorry for the french version, I will try to update the screenshot in english later):
There is obviously something wrong.
I have tried to google the error code, nothing conclusive.
I have tried to run my script in admin mode and also under admin session, same problem
I have made some research on CIMWin32, it seems to be a dll and I can find it in some locations of my filesystem
My OS is W8.1.
If anybody has a suggestion or solution, I'm interested in
==>cscript C:\Windows\System32\Printing_Admin_Scripts\en-US\prnqctl.vbs -e
Unable to get printer instance. Error 0x80041002 Not found
Operation GetObject
Provider CIMWin32
Description
Win32 error code
The error culprit is clear: you should provide a valid -p argument. It's a mandatory parameter in case of -e operation:
==>cscript C:\Windows\System32\Printing_Admin_Scripts\en-US\prnqctl.vbs -e -p "Fax"
Success Print Test Page Printer Fax
==>

Send command to launch app in iOS device using command line tool

I have been through stackOverFlow and google search's but didn't find out a proper answer to my query. I want to send a command to launch app in iOS device(connected via USB port) using command line tool (from mac system). Please don't copy paste link's in comment or in your post as I been through a lot of site's. I'm looking forward to a proper way along with understanding if anyone could provide.
I have seen ios-deploy, libimobiledevice and all but explanation is not given on how to install and use, i.e., test it whether it's working or not. If anyone have then please provide the same with bit of explanation.
Thanks in advance.
Try instruments from command line, replace DEVICE_UDID, XCODE_PATH, APP_PATH, APP_NAME, TRACE_DIR and STARTING_POINT with your variables:
instruments -w DEVICE_UDID \
-t /Applications/XCODE_PATH.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate \
APP_PATH/APP_NAME.app \
-e UIASCRIPT STARTING_POINT.js \
-e UIARESULTSPATH TRACE_DIR \
-d TRACE_DIR
What I have in STARTING_POINT.js:
var target = UIATarget.localTarget();
This example simply launches app on device and then app exit. Note that the app needs proper signing.

Getting error in writing a background process for iPhone

For my app i want to make a background process so i did.
But now when try to load the process by script in postinst like this
/Library/LaunchDaemons/com.dev.app.
i am getting error msg:
Could not open job overrides database at: /private/var/db/launchd.db/com.apple.launchd/overrides.plist: 2: No such file or directory
can anyone please help me to get rid of this?
Edit:
Debian postinst script:
chown root:wheel /Library/LaunchDaemons/com.dev.app.plist
launchctl load /Library/LaunchDaemons/com.dev.app.plist
I see this error message, too.
If you look on your phone's filesystem (e.g. login with ssh), I bet you don't have a folder at /private/var/db/launchd.db.
Just because iOS can't find that database file doesn't mean your daemon isn't loaded (or unloaded). Use the ps -Aef command at the command line (logged into the phone) to check whether your daemon process is running or not.
Inside your daemon's plist file (e.g. /System/Library/LaunchDaemons/com.mycompany.mydaemon.plist), you can set a Disabled flag (but, you probably won't). The overrides.plist file can override the Disabled setting from your daemon's plist file.
My guess is that this is primarily an OS X feature, and not commonly used by iOS, which shares much of the same codebase.
Edit:
If you really feel the need to get rid of the message, it looks like simply creating that directory will get rid of it. So, you could add something like this in your postinst script, before calling launchctl:
mkdir -p /var/db/launchd.db/com.apple.launchd

Resources