-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathFIndAndUploadAirdropFiles
More file actions
20 lines (15 loc) · 1000 Bytes
/
FIndAndUploadAirdropFiles
File metadata and controls
20 lines (15 loc) · 1000 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/bash
########Variables#########
jUNPW="username:password"
basicAuth=$(echo -n $jUNPW | base64)
jURL="https://YourJamfProHere.jamfcloud.com"
macSerial=$(system_profiler SPHardwareDataType | awk '/Serial Number/{print $4}')
pathToFile="/tmp/RecentAirdropfiles.txt"
######Get bearer token############
#Get Bearer Token with Basic Auth
bToken=$(curl -sk -X POST "$jURL/api/v1/auth/token" -H "accept: application/json" -H "Authorization: Basic $basicAuth" | awk '/token/{print $3}' | tr -d '"'',')
######Find Airdrop Files############
mdfind 'kMDItemUserSharedReceivedTransport == "*com.apple.AirDrop*"' > "$pathToFile"
######Send files############
compID=$(curl -sk -H "Authorization: Bearer $bToken" -H "accept: application/xml" "$jURL/JSSResource/computers/serialnumber/$macSerial" | xmllint --xpath '/computer/general/id/text()' -)
curl -sk -H "Authorization: Bearer $bToken" -H "accept: application/xml" "$jURL/JSSResource/fileuploads/computers/id/$compID" -F name=@"$pathToFile" -X POST