Skip to content

Instantly share code, notes, and snippets.

@smaddock
smaddock / fileKiller.sh
Last active July 10, 2018 23:03 — forked from bwmorales/fileKiller.sh
List files that you want to assasinate in every user's home directory, as well as some system files, on macOS.
#!/bin/bash
SYSTEM_FILES=(
'/Applications/Google Chrome.app'
)
USER_FILES=(
'~/Library/Application Support/Google/Chrome'
'~/Library/Caches/Google/Chrome'
)
@smaddock
smaddock / SSH4Admins.sh
Created August 9, 2018 16:07
Enable Remote Login for Administrators group - macOS
#!/bin/bash
if sudo systemsetup -getremotelogin | grep -q Off; then
sudo systemsetup -setremotelogin on;
fi
if ! dseditgroup com.apple.access_ssh &> /dev/null ; then
dseditgroup -o create -q com.apple.access_ssh;
fi
sudo dseditgroup -o edit -a admin -t group com.apple.access_ssh

Between Shawn Maddock

And [customer name].

Summary:

I will always do my best to fulfill your needs and meet your expectations, but it is important to have things written down so that we both know what’s what, who should do what and when, and what will happen if something goes wrong. In this contract you will not find any complicated legal terms or long passages of unreadable text. I have no desire to trick you into signing something that you might later regret. What I do want is what is best for both parties, now and in the future.

So in short;

@smaddock
smaddock / NoSoftwareUpdateBadges.mobileconfig
Created October 7, 2019 23:05
Disable the badges in the Apple Menu, on System Preferences and on the Software Update Preference Pane related to available updates
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PayloadContent</key>
<array>
<dict>
<key>AttentionPrefBundleIDs</key>
<dict>
<key>com.apple.preferences.softwareupdate</key>
#!/bin/bash
### IMPORTANT NOTICE ###
### BEFORE USING THE SCRIPT MAKE SURE THAT YOU HAVE YOUR OWN APPLE PUSH CERTIFICATE AND MDM PROFILE SET UP IN YOUR ADDIGY ENVIRONMENT ###
# Best practice is to use this Script for devices that are in a Policy with the MDM Profile configured correctly
# This script is made with the intention of streamlining the migration from an expired APN/Apple Push Certificate to a new one
MDMProfileIdentifier="com.github.addigy.mdm.mdm"
majorVersion=$(sw_vers -productVersion | awk -F. '{print $2}')
minorVersion=$(sw_vers -productVersion | awk -F. '{print $3}')
#!/usr/local/autopkg/python
"""See docstring for MunkiImporterSlacker class
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
@smaddock
smaddock / udp.php
Created April 13, 2016 23:46
send basic UDP messages from PHP
<?php
$serverIP = '192.168.0.1';
$serverPort = 5000;
if ($_REQUEST['cmd']) {
$socket = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
if (!$socket) {
error_log("Could not open socket");
} else {
socket_sendto($socket, $_REQUEST['cmd'], strlen($_REQUEST['cmd']), 0, $serverIP, $serverPort);
socket_close($socket);
@smaddock
smaddock / electron-patches.sh
Created September 28, 2023 15:56
Identify macOS applications with unpatched Electron Framework versions as relates to CVE-2023-4863
#!/bin/bash
set -e
# original script (requires DevTools):
# find /Applications -type f -name "*Electron Framework*" -exec \
# sh -c "echo \"{}\" && strings \"{}\" | grep '^Chrome/[0-9.]* Electron/[0-9]' | head -n1 && echo " \;
# source: https://infosec.exchange/@TomSellers/111126339492371432
# osquery version:
# WITH _e AS(