-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #47 from palantir/import
added scripts migrated from internal repo for public use
- Loading branch information
Showing
9 changed files
with
352 additions
and
7 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/bin/sh | ||
|
||
### | ||
# | ||
# Name: Charger Wattage.sh | ||
# Description: Reports the wattage of the power adapter (if connected). | ||
# Created: 2022-10-05 | ||
# Last Modified: 2024-11-15 | ||
# Version: 1.0.2 | ||
# | ||
# | ||
# Copyright 2022 Palantir Technologies, Inc. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
# | ||
### | ||
|
||
|
||
|
||
########## main process ########## | ||
|
||
|
||
|
||
# Report results. | ||
echo "<result>$(/usr/sbin/system_profiler SPPowerDataType | /usr/bin/awk '/Wattage/ {print $NF}')</result>" | ||
|
||
|
||
|
||
exit 0 |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/bin/sh | ||
|
||
### | ||
# | ||
# Name: Remote Login.sh | ||
# Description: Reports whether Remote Login is On or Off. | ||
# Created: 2021-08-02 | ||
# Last Modified: 2024-11-15 | ||
# Version: 1.0.1 | ||
# | ||
# | ||
# Copyright 2021 Palantir Technologies, Inc. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
# | ||
### | ||
|
||
|
||
|
||
########## main process ########## | ||
|
||
|
||
|
||
# Report result. | ||
echo "<result>$(/usr/sbin/systemsetup -getremotelogin | /usr/bin/awk '{print $NF}')</result>" | ||
|
||
|
||
|
||
exit 0 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/bin/sh | ||
|
||
### | ||
# | ||
# Name: Startup Volume.sh | ||
# Description: Reports the name of the startup volume. | ||
# Created: 2024-02-27 | ||
# Last Modified: 2024-11-15 | ||
# Version: 1.0.1 | ||
# | ||
# | ||
# Copyright 2024 Palantir Technologies, Inc. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
# | ||
### | ||
|
||
|
||
|
||
########## main process ########## | ||
|
||
|
||
|
||
echo "<result>$(/usr/sbin/diskutil info -plist "$(bless --getBoot)" | /usr/bin/plutil -extract VolumeName raw -- -)</result>" | ||
|
||
|
||
|
||
exit 0 |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#!/bin/sh | ||
|
||
### | ||
# | ||
# Name: VirtualBox Extension Packs.sh | ||
# Description: Reports whether any VirtualBox extension packs are installed. | ||
# Created: 2019-12-17 | ||
# Last Modified: 2024-11-15 | ||
# Version: 1.0.3 | ||
# | ||
# | ||
# Copyright 2019 Palantir Technologies, Inc. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
# | ||
### | ||
|
||
|
||
|
||
########## variable-ing ########## | ||
|
||
|
||
|
||
VBoxManagePath="/Applications/VirtualBox.app/Contents/MacOS/VBoxManage" | ||
extpackCheck="" | ||
|
||
|
||
|
||
########## main process ########## | ||
|
||
|
||
|
||
if [ -e "$VBoxManagePath" ]; then | ||
if [ "$("$VBoxManagePath" list extpacks | /usr/bin/awk '/Extension Packs/ {print $NF}')" -gt 0 ]; then | ||
extpackCheck="installed" | ||
fi | ||
fi | ||
|
||
|
||
|
||
|
||
echo "<result>${extpackCheck}</result>" | ||
|
||
|
||
|
||
exit 0 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/bin/sh | ||
|
||
### | ||
# | ||
# Name: Wi-Fi Network.sh | ||
# Description: Displays the current Wi-Fi network for the default network adapter (en0). | ||
# Created: 2024-10-17 | ||
# Last Modified: 2024-11-15 | ||
# Version: 1.0.1 | ||
# | ||
# | ||
# Copyright 2024 Palantir Technologies, Inc. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
# | ||
### | ||
|
||
|
||
|
||
########## main process ########## | ||
|
||
|
||
|
||
# Report results. | ||
echo "<result>$(/usr/sbin/networksetup -getairportnetwork en0 2>"/dev/null" | /usr/bin/awk -F 'Current Wi-Fi Network: ' '{print $2}')</result>" | ||
|
||
|
||
|
||
exit 0 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
#!/bin/sh | ||
|
||
### | ||
# | ||
# Name: dotnet Runtime Versions.sh | ||
# Description: Reports versions of all .NET runtimes installed. | ||
# Created: 2021-08-04 | ||
# Last Modified: 2024-11-15 | ||
# Version: 1.1.2 | ||
# | ||
# | ||
# Copyright 2021 Palantir Technologies, Inc. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
# | ||
### | ||
|
||
|
||
|
||
########## variable-ing ########## | ||
|
||
|
||
|
||
loggedInUser=$(/usr/bin/stat -f%Su "/dev/console") | ||
version="" | ||
|
||
|
||
|
||
########## function-ing ########## | ||
|
||
|
||
|
||
# Exits if root is the currently logged-in user, or no logged-in user is detected. | ||
check_logged_in_user () { | ||
if [ "$loggedInUser" = "root" ] || [ -z "$loggedInUser" ]; then | ||
echo "Nobody is logged in, no action required." | ||
exit 0 | ||
fi | ||
} | ||
|
||
|
||
|
||
########## main process ########## | ||
|
||
|
||
|
||
# Check script prerequisites. | ||
check_logged_in_user | ||
|
||
|
||
# List .NET runtimes and get version strings. | ||
if [ -e "/usr/local/share/dotnet/dotnet" ]; then | ||
version=$(sudo -u "$loggedInUser" /usr/local/share/dotnet/dotnet --list-runtimes | /usr/bin/awk '/.NETCore.App/ {print $2}') | ||
fi | ||
|
||
|
||
# Report results. | ||
echo "<result>${version}</result>" | ||
|
||
|
||
|
||
exit 0 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#!/bin/sh | ||
|
||
### | ||
# | ||
# Name: Reset Osquery Database.sh | ||
# Description: Runs osqueryctl clean to reset the local database, then restarts the service. | ||
# Created: 2020-08-19 | ||
# Last Modified: 2024-11-15 | ||
# Version: 1.0.1 | ||
# | ||
# | ||
# Copyright 2020 Palantir Technologies, Inc. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
# | ||
### | ||
|
||
|
||
|
||
########## variable-ing ########## | ||
|
||
|
||
|
||
binaryPath="/usr/local/bin/osqueryctl" | ||
|
||
|
||
|
||
########## main process ########## | ||
|
||
|
||
|
||
# Reset Osquery database. | ||
if [ -e "$binaryPath" ]; then | ||
"$binaryPath" stop | ||
"$binaryPath" clean | ||
"$binaryPath" start | ||
echo "Ran osqueryctl clean to reset the local database and restarted the service." | ||
else | ||
echo "❌ ERROR: osqueryctl binary not found at ${binaryPath}, unable to proceed." | ||
exit 1 | ||
fi | ||
|
||
|
||
|
||
exit 0 |