• Apple,  Programming,  SQL

    Simple sqlite3 Fuzzer

    One of my favorite ways to find escape defects in code is to employ a generic fuzzer. I typically have 5-10 laptops running fuzzers for various projects at a time. I was recently doing some research on sqlite3 and so started to fuzz the implementation built into macOS. The fuzzer generates random SQL statements and executes them against a SQLite database file. If any errors are encountered, they will be printed to the console: There’s not much logic here. Add more complex tests to improve it. Like SQL grammar to generate valid SQL statements, or a genetic algorithm to evolve SQL statements that are more likely to find bugs. Use…

  • iPhone,  Mac OS X Server,  Mass Deployment

    Talking A Look Under Apple Configurator's Hood

    Apple Configurator has now been in my grubby hands long enough for me to start looking at it a little deeper than I did in the introductory article I did awhile back. Architecturally, Apple Configurator keeps its data in ~/Library/Application Support/com.apple.configurator. Here, you’ll find a directory called IPSWs, another called Resources, file called AppleConfigurator.storedata and another called Users.storedata. The IPSWs directory is where operating system versions, per model of iOS are stored. These look something like iPad2,1_5.1_9B176_Restore.ipsw, which is iOS 5.1 for a standard iPad 2. iPad 1, the retina display iPad, as well as each iPod Touch and iPhone 4 each have their own entry as well. The IPSWs…

  • iPhone,  Mac OS X Server,  Mac Security,  Mass Deployment,  SQL

    Working with Postgres from the Command Line in Lion Server

    Mac OS X Server 10.7, Lion Server, comes with a few substantial back-end changes. One of these is the move from SQLite3 to PostgreSQL for many of the back-end databases, including Wiki and Podcast Producer (collab), Webmail (roundcubemail), iCal Server and Address Book Server (caldav) and as the back-end to the newest service in Lion Server, Profile Manager (device_management). As such, it’s now important to be able to use PostgreSQL the way we once used SQLite3, when trying to augment the data that these databases contains, as there currently aren’t a lot of options for editing this data (aside from manually of course). Postgres has a number of commands that…

  • Mac OS X,  Mac OS X Server,  Mass Deployment

    Scripting Launchpad

    LaunchPad is the OS X Lion version of the old Launcher, or the iOS home screen, according to how you look at these things. A few notes on issues I’ve seen with LaunchPad. First, I’ve had to nuke LaunchPad and have it rebuild. To do so, delete the database. rm ~/Library/Application Support/Dock/*.db You might also need to kill the dock: killall Dock In a deployment scenario, I’ve started doing both as post flight tasks. Getting to the point where you’re granularly adding and removing items is done by editing the .db file in ~/Library/Application Support/Dock. In here is a generatedID followed by .db that makes up a SQLite database. This database…

  • iPhone,  Mac Security

    Finding iOS Device PINs

    Each time you sync an iOS based device, a backup is made (unless you disable the option). These are stored in ~/Library/Application Support/MobileSync/Backup. Here you will find a number of folders, each beginning with the UDID of the iPhone, iPad or iPod Touch that has been backed up. The contents of these folders can be used to restore a device in the event that the device falls outside your control. Within the folders are a bunch of files with alphanumeric names that look garbled, even though some can be viewed using a standard text or property list editor (while others are binary). But there are also a bunch of other…

  • Mac OS X Server

    Deleting a Podcast in Podcast Producer

    In an earlier post I looked at querying feeds and removing objects from Podcast Producer in a somewhat broad manner. To delete a single podcast (not a feed), you need to first find the ID for the podcast, then delete the corresponding podcast bundle (pdb). Removing assets is one of the only processes with regards to Podcast Producer that isn’t intuitive, and it’s just waiting for someone to wrap these steps into a nice pretty GUI… To find the ID of the podcast, first let’s query the sql database for the title: sqlite3 /Volumes/pcp/PodcastProducer/Server/db.sqlite3 'SELECT * FROM episodes' | grep "TITLE" Note the date and the ID (the big long…

  • Mac OS X Server

    Scrubbing Assets from Podcast Producer

    At some point, you may find that you would like to remove all episodes from Podcast Producer that were brought in using a specific workflow, or based on a specific keyword, a string in the title, a date, or the user that created the episodes. All of these attributes are trapped in the db.sqlite3 database for Podcast Producer. This database is stored in the Server directory of your shared library. Within this database there is a table called episodes. Using that table you can locate all episodes that match the given pattern. To query, you will use the sqlite3 command and identify the database path. A very basic incantation of…

  • Mac OS X

    Address Book File Locations

    Address Book.app stores its preferences in the following property list files in ~/Library/Preferences: com.apple.AddressBook.abd.plist com.apple.AddressBook.plist The Address Book data itself is stored in ~/Library/Application Support/AddressBook, Here you will find: The SQL Lite database (*.abcddb). Any images associated with addresses are located in the Images folder in that directory Any contacts synchronized (ie – from Address Book services of Mac OS X Server to the local computer are synchronized into the Sources directory (into the .abcddb file located there) Any metadata associated with the contacts in the Metadata directory The MailRecents-v4 file, which contains a cache of the most recently used email addresses A Configuration.plist property list that has the settings for…