• Stars
    star
    213
  • Rank 184,366 (Top 4 %)
  • Language
    Python
  • License
    MIT License
  • Created about 6 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A utility to sniff preferences changes to macOS plist files

Prefsniff

Author: Zachary Cutlip, uid000 at gmail

prefsniff is a utility to watch macOS plist files for changes, and then autogenerate the defaults command to apply those changes. Its intended use is to have prefsniff watch a plist file while setting a system or application preference. The resulting defaults command can then be added to a shell script or incorporated into a configuration management system such as Ansible.

Installing

If you're here to simply use prefsniff and not to hack on it, there's no need to clone the git repo. You may simply install from PyPI via pip:

$ pip3 install prefsniff

Using

prefsniff has two modes of operation; directory mode and file mode.

  • Directory mode: watch a directory (non-recursively) for plist files that are unlinked and replaced in order to observe what file backs a particular configuration setting.
  • File mode: watch a plist file in order to represent its changes as one or more defaults command.

Directory mode example:

$ prefsniff ~/Library/Preferences
PREFSNIFF version 0.1.0b3
Watching directory: /Users/zach/Library/Preferences
Detected change: [deleted] /Users/zach/Library/Preferences/com.apple.dock.plist
Detected change: [created] /Users/zach/Library/Preferences/com.apple.dock.plist

File mode example:

$ prefsniff ~/Library/Preferences/com.apple.dock.plist
PREFSNIFF version 0.1.0b3
Watching prefs file: /Users/zach/Library/Preferences/com.apple.dock.plist
*****************************

defaults write com.apple.dock orientation -string right

*****************************

Additional Reading

Advanced defaults(1) Usage

An introduction to plist files and the defaults(1) command. Includes detailed explanation of each plist type and how to manipulate them with defaults.

Defaults Non-obvious Locations

An explanation of various defaults domains and where their corresponding plist files can be found on disk.

Autogenerating defaults(1) Commands

An introduction to this tool, prefsniff, and how to use it to autogenerate defaults commands.

TODO

  • Implement data and date plist types
  • Clean up output so that it can be redirected to a shell script or similar
  • Add additional output options (such as the name of a shell script to create)
  • Split utility & API
    • Make prefsniff into a python module that exports API
    • Make a separate prefsniff command-line utility that uses the API

More Repositories

1

nvram-faker

A simple library to intercept calls to libnvram when running embedded linux applications in emulated environments.
C
216
star
2

bowcaster

Python
138
star
3

exploit-poc

Proof-of-Concept code for exploits
Python
81
star
4

gdbinit-mips

A gdbinit file that makes gdb much more usable for MIPS debugging.
39
star
5

crossbow

Crossbow is a lightweight, cross platform exploit development framework implemented in Python. Currently, Crossbow's focus is on MIPS Linux systems.
Python
32
star
6

pyonepassword

A python API to query a 1Password account using the 'op' command-line tool
Python
32
star
7

broken_abandoned

Example code for following along with my "Broken, Abandoned, and Forgotten Code" blog series
Python
25
star
8

dropbear-hacks

A fork of the dropbear SSH server with special hacks for running on minimal embedded systems.
C
19
star
9

py-dwarf-parser

A Python module to parse DWARF debugging data
Python
6
star
10

exploit-tools

Exploit development tools
Python
6
star
11

firmware-parsing

Modules to support parsing of firmware headers, etc.
Python
4
star
12

make_c_program

A utility to create a simple C source file with a `main()` and open it in an editor.
Python
3
star
13

py-singleton-metaclasses

A package of python metclasses for implementing singleton and related patterns.
Shell
3
star
14

py-object-file

Parsers for executable and library object files
Python
2
star
15

mock-cli-framework

A framework that can be called from a short Python console script to simulate the responses of an actual command-line tool.
Python
1
star
16

basic-data-structures

C library for basic data structures
C
1
star
17

rpi-fan-control

A python fan control utility for Linux on RPi
Python
1
star
18

py-obj-file-util

Python
1
star
19

video-encoding

Wrapper for Don Melton's video transcoding project, to automate batch encoding videos
Python
1
star
20

MouseCenter

Hammerspoon spoon for re-centering your mouse pointer
Lua
1
star
21

resume

1
star
22

rwl

Technical reading I wish I had time for.
Python
1
star
23

configure-with-sudo

A Python module to handle executing system commands using sudo
Python
1
star
24

easy-html-table

Python
1
star
25

ScreenLock

A Mac app to lock your screen on demand
Objective-C
1
star
26

mtdwriter

Utility from OpenWRT to write a flat image to a /dev/mtd flash memory device.
C
1
star