krypted.com

Tiny Deathstars of Foulness

Just some little one-liners to grab the version of a few common Apple services/built-in apps you might need the version of for another project I’m working on kinda’:
  • cups: cups-config –version
  • Finder: mdls -name kMDItemVersion /System/Library/CoreServices/Finder.app | cut -d ‘”‘ -f2
  • Help Viewer: mdls -name kMDItemVersion /System/Library/CoreServices/HelpViewer.app | cut -d ‘”‘ -f2
  • iBooks Author: mdls -name kMDItemVersion /Application/iTunes\ Author.app | cut -d ‘”‘ -f2
  • ical/Calendar: mdls -name kMDItemVersion /Applications/Calendar.app/ | cut -d ‘”‘ -f2
  • ichat/Messages: mdls -name kMDItemVersion /Applications/Calendar.app/ | cut -d ‘”‘ -f2
  • iMovie: mdls -name kMDItemVersion /Applications/iMovie.app | cut -d ‘”‘ -f2
  • installer: /usr/sbin/installer -vers
  • Photos/iPhoto: mdls -name kMDItemVersion /Applications/Photos.app | cut -d ‘”‘ -f2 
  • iTunes: mdls -name kMDItemVersion /Applications/iTunes.app | cut -d ‘”‘ -f2 
  • Java: /usr/bin/java -version
  • Keynote: mdls -name kMDItemVersion /Applications/Keynote.app | cut -d ‘”‘ -f2
  • macOS: sw_vers -productVersion
  • macOS Server: mdls -name kMDItemVersion /Applications/Server.app | cut -d ‘”‘ -f2
  • Mail: mdls -name kMDItemVersion /Applications/Mail.app | cut -d ‘”‘ -f2
  • mdnsresponder
  • Motion: mdls -name kMDItemVersion /Applications/Motion.app | cut -d ‘”‘ -f2
  • Numbers: mdls -name kMDItemVersion /Applications/Numbers.app | cut -d ‘”‘ -f2
  • Pages Required mdls -name kMDItemVersion /Applications/Pages.app | cut -d ‘”‘ -f2
  • Preview: mdls -name kMDItemVersion /Applications/Preview.app | cut -d ‘”‘ -f2
  • Quicktime: mdls -name kMDItemVersion /Applications/Quicktime\ Player.app | cut -d ‘”‘ -f2 quicktime_broadcaster No (Darwin Stream Server deprecated) N/A quicktime_darwin_mp3_broadcaster No (deprecated service) N/A quicktime_pictureviewer No (for QuickTime for Windows) N/A quicktime_streaming_server No (deprecated service) N/A
  • Remote Desktop: defaults read /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/version.plist CFBundleShortVersionString
  • Safari: mdls -name kMDItemVersion /Applications/Safari.app | cut -d ‘”‘ -f2 server_manager No (deprecated in 2006ish) N/A software_update tcp_ip_configuration_utility No (Laserwriter vuln from 2002) N/A terminal Required mdls -name kMDItemVersion /Applications/Utilities/Terminal.app | cut -d ‘”‘ -f2
  • Textedit Required mdls -name kMDItemVersion /Applications/TextEdit.app | cut -d ‘”‘ -f2
  • Transporter: /Applications/Xcode.app/Contents/Applications/Application Loader.app/Contents/itms/bin/itsmtransporter
  • Xcode: mdls -name kMDItemVersion /Applications/Xcode.app | cut -d ‘”‘ -f2
  • Xsan: /usr/sbin/cvversions
  • openSSL: openssl -version
  • Apache: httpd -v
If you notice, a lot of the built-in apps can be scanned with the same mdls command. There are certainly better ways for some, but when it comes to runtime cost, spotlight can respond quicker than a lot of other tools (other than purpose-built open source tools of course, who already have a smaller amount of data specific to the task). 3rd party software can be checked the same way. Let’s take Microsoft Outlook as an example:

mdls -name kMDItemVersion /Applications/Microsoft\ Outlook.app | cut -d ‘”‘ -f2

Additionally, Frameworks work a little differently. If I wanted to get the WebKit Framework version programmatically, I will need the system_profiler command along with the SPFrameworksDataType option. This will show me the version of WebKit, but strictly piping the output into grep won’t find the WebKit version. Instead I actually need to use an option I don’t use often with grep. Note that -A will allow you to define a number of lines to output following the pattern in question, so here I’m saying constrain my output to what you find that’s WebKit + the next ten lines, then constrain further for just the version number. 

system_profiler SPFrameworksDataType | grep -A10 WebKit: | grep Version

Anyway, more on all this soon.

September 13th, 2018

Posted In: Mac OS X, Mac Security

Tags: , , , , , ,

One Comment

The avconvert command is a new addition in OS X Lion that allows administrators to quickly and easily convert video from one format to another using presets for video conversion. The presets are mostly common Apple formats tuned to specific devices. In its simplest form, avconvert uses a preset, a source and then an output to convert the source to the output using the preset to define the format to use for conversion. A useful preset is the 640×480 one. To convert this using this idea: /usr/bin/avconvert --preset Preset640x480 --source /Convert/test.mov --output Converted/test.mov While some of the presets are pretty self explanatory, I haven’t gone through them all to see their specific outputs. Simply regressioning through each and then doing a get-info on the resultant QuickTime should net such a result. You can also use avconvert to extract audio or video only, to change data rates, track height and width, convert codecs, change frame rates and event o frame reordering. You can also specify a closed caption track, thumbnail tracks and all kinds of other cool stuff. While avconvert is the latest addition to video augmentation commands, the pcastaction command has also received some new features. I had previously written up a list of verbs for pcastaction at http://krypted.com/mac-os-x-server/pcastaction-verbs. This list is further enhanced in Lion. New verbs include:
  • addchapter – adds a chapter at a specified time
  • addtracks – add tracks using an optional offset and layers
  • deletetracks – deletes audio, video or audio_and_video tracks
  • extracttracks – outputs audio, video or audio_and_video tracks
  • flatten – flattens .mov, .m4v, .m4a and .m4b movies
  • join – joins two input files into an output file with an optional gap
  • qtimport – prepares QuickTime files with optional chapterizing
  • qtinfo – obtains keys from QuickTime files
  • sharewithpodcastlibrary – option for submitting a file to another Podcast Producer library
  • split – splits a QuickTime movie and outputs two files that are split at the time specified in the –time option
  • trim – specify start and end and remove the rest of the file
The podcast command, used to run Podcast Producer workflows is also still around and can be very useful. While there isn’t new stuff, it is worth mentioning that –addacl becomes –addaccess, –make explicit becomes –makefeedexplicit and –makenonexplicit becomes –makefeednonexplicit. There’s also the long, long awaited option for –removeepisode. This last option allows administrators to remove episodes from the Podcast Producer library based on the UUID of the episode. In my testing, you still need to remove the entry from the blog if you are also exporting episodes to the a blog, but this is basically what we were doing in the Deleting a Podcast post I did some time ago at http://krypted.com/mac-os-x-server/deleting-a-podcast-in-podcast-producer, just they wrap the three commands into one option of the podcast command. Still look to the asset removal article I did for actually scrubbing files (http://krypted.com/mac-os-x-server/scrubbing-assets-from-podcast-producer) . Feed removal is also still manual: http://krypted.com/mac-os-x-server/removing-feeds-from-podcast-producer. ACL management remains about the same (http://krypted.com/mac-os-x-server/podcast-producer-workflow-acls). While I never got around to writing up how to programatically manage ACLs in Podcast Producer, it is worth mentioning that podcast’s –addacl option and –enableacl will allow you to do so. They, along with other options in podcast and pcastaction are much better documented in the man pages in lion, so the things I couldn’t get to work in 10.6 should be sorted out somewhere in 10.7. Finally, while nothing new, the work I did on image file automation ( http://krypted.com/mac-os-x/automating-image-file-changes) with sips I now have hooking into podcast workflows. I hope to publish an article on this at some point in the future, but the idea is a workflow where you drop an image and a video into a folder (or use an upload dialog) and it watermarks the video with a compressed-down version of the image… Also, avconvert offers a perfect compliment to podcast workflows. I’ve had a number of instances where people were trying to feed pcastaction formats that were unsupported, video that was too large or other problematic inputs and so avconvert allows us to sanitize the inputs for pcastaction or podcast prior to managing our workflows. With launchdaemons watching directories this provides some of what Final Cut Server was able to provide, only without the database of assets, easy way to tag them, etc, etc, etc, etc. Overall, a very nice incremental update to Podcast Producer and en masse video management in Lion. Nothing jaw dropping or massive, but some nice new features, better documentation and in my testing so far, more overall stability.

July 25th, 2011

Posted In: Final Cut Server, Mac OS X Server, Xsan

Tags: , , , , , , , , , , , , , , , , ,

OK, so you don’t necessarily call rtsp on Ubuntu QuickTime Streaming Server. Instead, you call it Darwin Streaming Server (DSS). But the end result is basically what you have exposed in Mac OS X Server, but running on Linux. You don’t have the same functionality in Server Admin, but it does work. And the key to what it does is use the rtsp protocol to stream supported files from the server to clients. It is a little tougher than just clicking on the start button, but too much tougher provided you follow these directions (thanks to the good folks of the DSS list that I’ve been a member of for a few years for taking such good notes, making this much simpler to write when I just have to move from Ubuntu 7 to 10.04). To get started (most all of this is going to need sudo or su), let’s use wget to download all the files that we’re going to need (except 1):
wget http://static.macosforge.org/dss/downloads/DarwinStreamingSrvr6.0.3-Source.tar wget http://dss.macosforge.org/trac/raw-attachment/ticket/6/dss-6.0.3.patch wget http://dss.macosforge.org/trac/raw-attachment/ticket/6/dss-hh-20080728-1.patch
Now let’s extract the tar file:
tar -xvf DarwinStreamingSrvr6.0.3-Source.tar
Now let’s create our qtss user and group:
addgroup –system qtss adduser –system –no-create-home –ingroup qtss qtss
We’re going to need the build-essential package from apt-get, so let’s install that before moving on:
apt-get install build-essential
The base 6.0.3 installer was only built for Mac OS X, so let’s apply the patches we used wget to pull down:
patch -p0 < dss-6.0.3.patch patch -p0 < dss-hh-20080728-1.patch
Now let’s cd into the actual dss installer directory and then grab a patched installer file, get rid of the old Install script and then grab a new one:
cd DarwinStreamingSrvr6.0.3-Source mv Install Install.old wget http://dss.macosforge.org/trac/raw-attachment/ticket/6/Install
Then we’ll make the Install script executable and run the Buildit (no, not Configure) then Install scripts:
chmod +x Install ./Buildit ./Install
Finally, fire up the DSS:
/usr/local/sbin/DarwinStreamingServer
Now you should be able to go to a standard Mac OS X client and run a port scan of the rtsp port, 554 using stroke (swap the 192.168.210.254 IP here with whatever IP or hostname that you’re using):
/Applications/Utilities/Network Utility.app/Contents/Resources/stroke 192.168.210.254 554 554
DSS installs some sample movies into /usr/local/movies. Provided that the port is open, let’s open Safari and provide the following link to see if one of the stock sample movies will open:
rtsp://192.168.210.254/sample_h264_300kbit.mp4
Provided that you see the sample movie from Apple then you can move the sample movies elsewhere and drop your own in here. You’ve now got a fully functional DSS. The DSS will stream .mov, .mp4 and .3gp files. If you enable the QTSSHttpFileModule you can also stream mp3 files. If you go into the /etc/streaming folder you will see a number of files that look similar to what you have been working with on Mac OS X Server (assuming you’ve been working with Mac OS X Server). In here, you’ll find the qtusers and qtgroups files for managing users and groups in rtsp as well as the streamingserver.xml file, which is where the modules are loaded and unloaded. In /var/streaming you’ll also find a directory called logs, which is interestingly enough where the logs reside and another directory called playlists, which is where you will drop playlists in the event that you decide to make your own radio station. My music tastes are bad enough where I’ve never really considered this, but feel free to get all WKRP in Cincinnati if you so choose, I promise not to judge (or maybe just a little)… You’ll also end up likely looking to embed these rtsp streams (that seems to be what everyone does). If so, get to know the XML structure:
<?xml version=”1.0″?> <?quicktime type=”application/x-quicktime-media-link”?> <embed src=”rtsp://192.168.210.254/sample_h264_300kbit.mp4″ autoplay=”true” />
Ultimately, building and using QuickTime Streaming on Mac OS X Server is far superior in a number of ways to doing so in Linux. For starters, the steps here are all done by clicking on a Start button in Mac OS X Server. But even further than that, updates are even more rare to DSS. If you’re in the rack density game, a number of Mac mini servers in the right sized rack might just get you more bang for your square inch!

November 20th, 2010

Posted In: Mac OS X Server, Ubuntu, Unix

Tags: , , , , , , , , , , ,

And the best part about QuickTime 10 is… Screen recording. Long a task that required 3rd party products, recording events from your screen in Mac OS X is now built in with QuickTime 10. Simply open up QuickTime, click on File and then select New Screen Recording. From there, a screen will appear with a red button to start recording. Don’t worry as that screen will not appear in your recording. Instead you will be able to use the Command-Control-Escape keystroke to stop recording. At the Screen Recording screen you will also be able to perform a few settings changes. Here, use the disclosure triangle to switch between microphones, change quality and even change the default location that recorded movies are saved to. The third party applications that can do screen recording in Mac OS X are still a bit more mature, but if you need to do basic screen recording, QuickTime itself now seems poised to become the de-facto standard.

November 18th, 2009

Posted In: Mac OS X, Mac OS X Server

Tags: , , ,