Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/chbrown/plist-utils
Tools for manipulating files/streams in Apple's "property list" format
https://github.com/chbrown/plist-utils
apple macos plist xml
Last synced: 10 days ago
JSON representation
Tools for manipulating files/streams in Apple's "property list" format
- Host: GitHub
- URL: https://github.com/chbrown/plist-utils
- Owner: chbrown
- Created: 2018-03-20T20:00:46.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2020-09-23T17:17:32.000Z (over 4 years ago)
- Last Synced: 2024-11-08T09:32:38.576Z (2 months ago)
- Topics: apple, macos, plist, xml
- Language: Shell
- Homepage:
- Size: 7.81 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# plist-utils
Install with [GNU Stow](https://www.gnu.org/software/stow/):
git clone https://github.com/chbrown/plist-utils
cd plist-utils
stow -t /usr/local/bin bin### `plprint`
Convert a file in Apple's "property list format" into XML (whether binary or already XML),
then pretty print with `xmllint`.
The plist file can be supplied as a single argument, or on `/dev/stdin`.plprint Config.plist
### `pljson`
Simplify the XML of the given plist file with XMLStarlet,
replacing `` and `` elements with `` elements,
and convert to JSON.pljson Config.plist
### `plxml`
Convert each of the specified Apple Property List files to `XML` in-place,
preserving file timestamps and permissions.plxml settings.bin.plist
## Recipes
The macOS `airport` utility has a scan option, `-s`,
but by default, the output is unstructured and difficult to manipulate.
The `-x` option produces XML that contains a _lot_ more information in structured (if verbose) `plist` format.Using `pljson` and a few other commands,
we can sort the available networks with strongest (largest RSSI) connections first:airport -s -x \
| iconv -f macroman -t UTF-8 \
| pljson \
| jq -c '.[] | {SSID_STR,BSSID,RSSI,CHANNEL,CHANNEL_FLAGS,CAPABILITIES}' \
| mlr --ijson --opprint sort -nr RSSIPipeline components:
1. `airport -s -x`:
Run a network scan and produce XML output.
2. `iconv`:
Convert encoding from Mac-Roman to UTF-8.
Sometimes networks advertise names that are not UTF-8, which `airport` doesn't convert,
despite clearly denoting the encoding as `UTF-8` in the XML declaration.
3. [`pljson`](#pljson):
Convert property list format to JSON.
4. [`jq`](https://stedolan.github.io/jq/):
Flatten the top-level array and select just a few fields from each network dictionary.
5. [`mlr`](https://johnkerl.org/miller/doc/):
Read in JSON and output whitespace-aligned tabular output, sorted by descending RSSI.
RSSI ranges from -100 (weakest) to 0 (strongest).| RSSI | Description |
|-----:|:------------------|
| 0 | impossibly strong |
| -30 | amazing |
| -70 | average |
| -90 | unusable |## License
Copyright 2017-2018 Christopher Brown.
[MIT Licensed](https://chbrown.github.io/licenses/MIT/#2017-2018).