Skip to content

Instantly share code, notes, and snippets.

@drewdiver
Last active October 18, 2019 08:47
Show Gist options
  • Save drewdiver/9ca7ae96a51829f37fd808667644cabf to your computer and use it in GitHub Desktop.
Save drewdiver/9ca7ae96a51829f37fd808667644cabf to your computer and use it in GitHub Desktop.
A game of roulette, Cupertino style. Don't get shot...
#!/usr/bin/python
#
# Written by Drew Diver 2019
# Create a policy in Jamf to run the following script from Self Service.
#
# Inspired by https://twitter.com/lapcatsoftware/status/1182350562123227136?s=20
# Named by Armen Briegel
import random
import subprocess
from SystemConfiguration import SCDynamicStoreCopyConsoleUser
CURRENT_USER = (SCDynamicStoreCopyConsoleUser(None, None, None) or [None])[0]
chamber = [0,0,0,0,0,1]
random.shuffle(chamber)
if random.choice(chamber):
subprocess.call(['sudo', '-u', CURRENT_USER, 'tccutil', 'reset', 'All'])
@marcosiebecke
Copy link

== 1 should not be necessary :]

@drewdiver
Copy link
Author

== 1 should not be necessary :]

Good find!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment