This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#Joel Bruner | |
#BTSharingStateas - report bluetooth sharing states from system_profiler using jpt to parse output | |
#if jpt is not installed locally, embed function from jpt.min into this script: https://github.com/brunerd/jpt | |
#get all the data once | |
SPBluetooth=$(system_profiler -json SPBluetoothDataType 2>/dev/null) | |
#get the paths related to service state | |
statePaths=$(jpt -jd '$..service_state' <<< "${SPBluetooth}") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Joel Bruner - EA Grabber: Surreptitiously grabs Jamf Extension Attributes (EAs) during recon | |
#touch file for debug | |
[ -f /tmp/debug ] && set -x | |
############# | |
# VARIABLES # | |
############# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#fixJSON-TrailersComments - fix JSON with trailing commas and comments (JS, Shell and * style) | |
: <<-LICENSE_BLOCK | |
Copyright (c) 2020 Joel Bruner (https://github.com/brunerd) | |
Licensed under the MIT License | |
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HO |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# hash comments from: shell, Perl, PHP, Python, R, Ruby, MySQL | |
// Line comments from: Javascript, Java, Swift, C(99) | |
/* single line block comment: C, Java, Javascript, Swift */ | |
/* | |
multi-line block comment | |
can be either whole line or in-line | |
from: C, Java, Javascript, Swift |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#jsonReport-macOS (c) Joel Bruner 2020, MIT License | |
#this will crawl mostly system areas of macOS and attempt to parse JSON found | |
#it will produce a CSV as well as echo out to the console the result | |
############# | |
# VARIABLES # | |
############# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#malformed JSON (according to json_pp) by macOS version | |
#jpt (https://github.com/brunerd/jpt) can parse all of these now | |
## NOTES on the Files ## | |
# USD generated JSON contains # comments | |
# /private/var/db/ionodecache.json - has a single *** COMMENT *** line at the top | |
# /System/Library/PrivateFrameworks/CoreAnalytics.framework/Versions/A/Resources/defaultConfig.json i - is "JSON Lines" aka "concatenated JSON" | |
# Most of the others have trailing commas after the final member of arrays and objects | |
## SPECIAL Note ## |
We can make this file beautiful and searchable if this error is corrected: It looks like row 6 should actually have 4 columns, instead of 3 in line 5.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Status,Issue Notes,Path,Error Output | |
ERROR,"""JSON Lines""/Concatenated",/System/Library/PrivateFrameworks/CoreAnalytics.framework/Versions/A/Resources/defaultConfig.json,"garbage after JSON object, at character offset 143 (before """"addTransform"":{""uui..."") at /usr/bin/json_pp5.18 line 45." | |
ERROR,Trailing Comma,/Library/Developer/CommandLineTools/usr/lib/swift/migrator/overlay4.json,"malformed JSON string, neither array, object, number, string or atom, at character offset 41290 (before ""]\n"") at /usr/bin/json_pp5.18 line 45." | |
ERROR,Trailing Comma,/Library/Developer/CommandLineTools/usr/lib/swift/migrator/overlay42.json,"malformed JSON string, neither array, object, number, string or atom, at character offset 608 (before ""]\n"") at /usr/bin/json_pp5.18 line 45." | |
ERROR,*** Comment ***,/private/var/db/ionodecache.json,"malformed JSON string, neither array, object, number, string or atom, at character offset 0 (before ""*** Device Tree ***\n..."") at /usr/bin/json_pp5.18 line 45." | |
ERROR,Trailing Commas,/S |
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 5.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Status,Issue Notes,Path,Error Output | |
ERROR,"""JSON Lines""/Concatenated",/System/Library/PrivateFrameworks/CoreAnalytics.framework/Versions/A/Resources/defaultConfig.json,"garbage after JSON object, at character offset 143 (before """"addTransform"":{""uui..."") at /usr/bin/json_pp5.28 line 44." | |
ERROR,*** Comment ***,/private/var/db/ionodecache.json,"malformed JSON string, neither array, object, number, string or atom, at character offset 0 (before ""*** Device Tree ***\n..."") at /usr/bin/json_pp5.28 line 44." | |
ERROR,# comment,/System/Library/CoreServices/Pass Viewer.app/Contents/Library/SharedWebCredentials/wallet.apple.com.json,"malformed JSON string, neither array, object, number, string or atom, at character offset 210 (before ""]\n }]\n }..."") at /usr/bin/json_pp5.28 line 44." | |
ERROR,# comment,/System/Library/Frameworks/GameController.framework/Versions/A/Resources/XboxHapticCapabilityGraph.json,"unexpected end of string while parsing JSON string, at character offset 500 (before "",\n {\ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# csv2csv.function.min | |
# csv2csv by Lorance Stinson, 2007 | |
# This file is in the public domain. | |
# For more information email [email protected]. | |
# Or see http://lorance.freeshell.org/csvutils/ | |
# Additions by Joel Bruner, 2020 (https://github.com/brunerd) | |
#csv2csv function minified | |
function csv2csv { IFS=$' \t\n'; local NL=$'\n'; local TAB=$'\t';local CSV_ESCAPE=${CSV_ESCAPE:='"'}; local CSV_SEPARATOR=${CSV_SEPARATOR:=","}; local CSV_QUOTE=${CSV_QUOTE:='"'}; local OCSV_ESCAPE=${CSV_ESCAPE:='"'}; local OCSV_SEPARATOR=${CSV_SEPARATOR:=","}; local OCSV_QUOTE=${CSV_QUOTE:='"'}; local FILE="-"; local NL_TEXT=""; local NUM_COLS=""; local OUTPUT=""; local QUOTE_LEVEL="0"; local SKIP_ROWS="0"; local TAB_TEXT=""; while [ "$#" -gt 0 ] ; do case "$1" in -c) [ "$2" ] && local COL_LIST="$2" || usage="$1 requires an argument."; shift 2;; -e) [ "$2" ] && CSV_ESCAPE="$2" || usage="$1 requires an argument."; shift 2;; -E) [ "$2" ] && OCSV_ESCAPE="$2" || usage="$1 requires an argument."; shift 2;; -h) usage= |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# csv2csv.function.min.no_help | |
# csv2csv by Lorance Stinson, 2007 | |
# This file is in the public domain. | |
# For more information email [email protected]. | |
# Or see http://lorance.freeshell.org/csvutils/ | |
# Additions by Joel Bruner, 2020 (https://github.com/brunerd) | |
#csv2csv function minified | |
function csv2csv { IFS=$' \t\n'; local NL=$'\n'; local TAB=$'\t';local CSV_ESCAPE=${CSV_ESCAPE:='"'}; local CSV_SEPARATOR=${CSV_SEPARATOR:=","}; local CSV_QUOTE=${CSV_QUOTE:='"'}; local OCSV_ESCAPE=${CSV_ESCAPE:='"'}; local OCSV_SEPARATOR=${CSV_SEPARATOR:=","}; local OCSV_QUOTE=${CSV_QUOTE:='"'}; local FILE="-"; local NL_TEXT=""; local NUM_COLS=""; local OUTPUT=""; local QUOTE_LEVEL="0"; local SKIP_ROWS="0"; local TAB_TEXT=""; while [ "$#" -gt 0 ] ; do case "$1" in -c) [ "$2" ] && local COL_LIST="$2" || usage="$1 requires an argument."; shift 2;; -e) [ "$2" ] && CSV_ESCAPE="$2" || usage="$1 requires an argument."; shift 2;; -E) [ "$2" ] && OCSV_ESCAPE="$2" || usage="$1 requires an argument."; shift 2;; -h |