-
Notifications
You must be signed in to change notification settings - Fork 0
/
sanitise.py
38 lines (33 loc) · 1.11 KB
/
sanitise.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#
# sanitise a JSS by replacing any corporate data with random
# data
#
import jss_tools as tools
import random
surnames = []
for line in open('/Users/u398570/dev/bits/surnames.txt', 'r'):
surnames.append(line.strip())
firsts = []
for line in open('/Users/u398570/dev/bits/first.txt', 'r'):
firsts.append(line.strip())
jss = tools.Jopen(True)
for entry in jss.Computer():
computer = entry.retrieve()
info = tools.c_info(computer)
surname = random.choice(surnames)
first = random.choice(firsts)
serial = info['serial']
new_serial = ''.join(random.sample(serial, len(serial)))
info['AD'] = 'int.corp.example'
info['email'] = first + "." + surname.upper() + "@example.com"
if 'MacBook' in info['model']:
info['machine_name'] = "MB" + new_serial
else:
info['machine_name'] = "MD" + new_serial
info['name'] = surname.upper() + ", " + first
info['serial'] = new_serial
info['user'] = first + surname[0]
info['managed'] = True
tools.c_remote(computer, 'jamf015', 'jamf1234')
tools.c_info_write(info, computer)
print info['id'], " ", info['name']