Skip to content

Instantly share code, notes, and snippets.

import requests # Needs to be installed
import json
import smtplib
from email.mime.text import MIMEText
import os
FILENAME = 'aws_ips.json' # local storage for comparison
SMTP_SERVER = 'smtp.potato.local'
SEND_FROM = 'from@example.com'
SEND_TO = 'to@example.com'
@bradschm
bradschm / selective-caspershare-sync.sh
Created October 12, 2016 18:18
Use rsync to sync Casper distribution points and restrict packages to specific subnets.
#!/bin/bash
##########################################
### Script to rsync Caspershare points
### Name site based packages SB-###-Package name
### All pacakges with SB-* will be ignored and SB-<matching octet>-filename will be synced
### Author B. Schmidt 12-31-2012
##########################################
# Get IP Subnet
ipsub=$(ifconfig | grep 10. | grep inet | cut -f2 -d " " | cut -f2 -d "." | head -1)
@bradschm
bradschm / guestNetworkNotice.sh
Last active March 7, 2017 05:50
Guest Network Notifier and Remover
#!/bin/bash
# Authored by Brad Schmidt on 3-31-2016
# Detect and warn if on a specific SSID, remove the SSID from preferred list
# Script checks to see that they are getting the external guest IP, on the SSID, and have a 10.99 address.
# Check out the checks section to turn off any of the three checks that make sure the device is on the guest network.
# You will need jamfHelper for the script to work, you could easily swap for your preferred notification method
## VARIABLES ##
# SSID of Network, Will be used to check that they are on the network at time of notification and used to remove the network from the preferred list
@bradschm
bradschm / CasperCheck-manualoverride
Last active January 8, 2016 19:12
Add a manual override to CasperCheck. Find CasperCheck at: https://github.com/rtrouton/CasperCheck. If something goes wrong you can change a text file hosted on a web server and the script will exit before reenrolling itself. This will also allow for an upgrade of the script.
# Authored by Brad Schmidt - 1-6-2016 for CasperCheck https://github.com/rtrouton/CasperCheck
#### DESCRIPTION and INSTRUCTIONS ####
# This manual override will go out and check if we should run the caspercheck script or not.
# This code will check for a text file, if it says OK, the script will continue to run.
#
# If you set it to NO it will cause the script to exit
#
# If you set it to UPGRADE the function will download a new copy of this script
#### NOTE: if you do upgrade this script be sure to include new values for where the script checks and downloads the next update from
@bradschm
bradschm / add_text_to_image.sh
Created December 2, 2015 17:36
Need imagemagick command line tools. Adds text to an image.
convert input.png -font Arial -pointsize 20 -draw "gravity north fill white text 5,80 '$YOURTEXTVARIABLE' " output.png
@bradschm
bradschm / wallpaper_jssapi_example.py
Created December 2, 2015 17:30
JSS API Wallpaper Mobile Device Command Example.
# Example API Command to post a Base64 image to a wallpaper command
# Authored by Brad Schmidt with the help of Mike Paul and Freddie Cox on 2015-12-1
# Description, use case and a warning
# You could use the osx command line to take an image and convert it to base64 to help automate the process. Futhermore, if you wanted to add custom text, say from another API call, you could use Imagemagick.
# The main idea was to set an initial wallpaper for student devices that would be the same image but would have their name on the lock screen.
# Note: This does create an image in the database each time your run it so your DB could increase dramatically in size depending how this is used. There is not an API call to remove file uploads.
# Setup the variables for your JSS
jss_host = "https://yourjss.com" # Be sure to include https:// or http://