Skip to content

Instantly share code, notes, and snippets.

View slack - :lock: Security Health Status.sh
# This is the script content of a Jamf Pro Extension Attribute called
# "slack - :lock: Security Health Status"
# Because it has "slack -" in its title, our /jamf Slack app will display the output of its results in each Mac's health summary report.
# It checks to see if the Mac has SIP and FV enabled and is running the required 3rd party AV agent
# Based on the results, it displays the appropriate emoji and also provides appropriate links to relevant kb articles or Jamf Self Service policies.
# Author: @taniacomputer
# Last modified: 4/12/2019
#!/bin/bash
View slackapp_idSearch.py
# slackapp_idSearch.py
# This function is invoked by an SNS topic
# and runs a Jamf Pro equivalent of a computer id search,
# formatting the results and sending them back to Slack
# Author: @taniacomputer
# Last modified: 20/11/2019
import json
import boto3
from botocore.vendored import requests
View slackapp_buttonClicked.py
# slackapp_buttonClicked.py
# This function responds to the More Info button click
# It verifies that the request is from slack and publishes to the SNS topic
# that will trigger the lambda function to provide the user their requested More Info summary
# Author: @taniacomputer
# Last modified: 20/11/2019
import json
import hashlib
import hmac
View slackapp_run_matchSearch.py
# slackapp_run_matchSearch.py
# This function is invoked by an SNS topic
# and runs a Jamf Pro equivalent of an advanced search
# formatting the results and sending them back to Slack
# Author: @taniacomputer
# Last modified: 20/11/2019
import json
from botocore.vendored import requests
import boto3
View slackapp_initial_slash_command_invoked.py
# slackapp_initial_slash_command_invoked.py
# This function is invoked from a Slack slash command
# It verifies the request, responds to it, and invokes the SNS topic for the
# second lambda function, if required.
# Author: @taniacomputer
# Last modified: 20/11/2019
import json
import hashlib
import hmac
View slash_command_button-clicked.py
import json
from urllib import parse as urlparse
import urllib.parse
def lambda_handler(event, context):
request_body = event["body"]
decodedBody = event["body"].replace('payload=','', 1)
decodedBody = urllib.parse.unquote(decodedBody)
decodedBody = json.loads(decodedBody.replace("\\",""))
View slash_command_invoked.py
import json
from urllib import parse as urlparse
def lambda_handler(event, context):
message_from_slack = dict(urlparse.parse_qsl(event["body"]))
response_url = message_from_slack["response_url"]
message_for_slack = "*Request received from Slack slash command:*\n" + str(event) + "\n\n*Request body _before_ decoding:*\n" + event["body"] + "\n\n*Request body _after_ decoding:*\n" + str(message_from_slack)
response_json = {
View menubartrigger example
#!/bin/bash
# MenuBarTrigger Example
function create_webviews() {
echo "
html,
body {
overflow: hidden;
width: 270px;
View summary_slack_post.sh
#!/bin/bash
WEBHOOK_URL=<SLACK WEBHOOK URL>
IMAGE=<EXTERNALLY HOSTED IMAGE>
JSS=<JSS ADDRESS>
# API Account that has read access to Jamf Pro Server Objects > Computers
API_USER=<API USERNAME>
API_PW=<API PASSWORD>
UDID=$(system_profiler SPHardwareDataType | grep "UUID" | sed s/"Hardware UUID: "/''/g | sed 's/^ *//')
View gist:cab6f6ea487204237ca2b9ddeeb63886
SLACK_WEBHOOK="https://hooks.slack.com/services/A123456"
IMAGE="https://<s3bucket>/MBPJamf.png"
SSID="acme-wifi"
danger=0
computer_name=$(scutil --get ComputerName)
primary_user=$(cat /etc/.seek)
title="SEEK Setup Completed for *$computer_name*"
text="*JSS ID:* $JSS_ID\n*Primary User:*"