Advertisement
Guest User

Untitled

a guest
Jul 31st, 2016
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.27 KB | None | 0 0
  1. #!/usr/bin/python -tt
  2. __author__ = 'Zack Smith @acidprime'
  3. __version__ = '0.1'
  4. import sys
  5. import getopt
  6. from Cocoa import NSMutableDictionary
  7.  
  8. global debugEnabled
  9. debugEnabled = True
  10.  
  11. def main():
  12. if(debugEnabled): print 'Processing Arguments: ', sys.argv[1:]
  13. options, remainder = getopt.getopt(sys.argv[1:], 'w:u:p:', ['username=',
  14. 'password=',
  15. 'write=',
  16. ])
  17. for opt, arg in options:
  18. if opt in ('-u', '--username'):
  19. userName = arg
  20. elif opt in ('-p', '--password'):
  21. userPass = arg
  22. elif opt in ('-w', '--write'):
  23. saveFile = arg
  24.  
  25. # Hardcoded values for the moment
  26. orgName = 'somecompany'
  27. networkName = 'somenetwork'
  28. mdmHost = 'com.apple.mdm.mute.wallcity.org'
  29. payloadUUID = '81f55323-c1a2-47fd-aee3-7b8a93d31472'
  30. _payloadUUID = '52f7d163-f2bb-4972-8a26-411355229cc5'
  31.  
  32. # Generate the profile
  33. genLionProfile(userName,
  34. userPass,
  35. payloadUUID,
  36. _payloadUUID,
  37. networkName,
  38. mdmHost,
  39. orgName,
  40. saveFile)
  41.  
  42. # Need to clean this up with defaults or a dict
  43. def genLionProfile(userName,
  44. userPass,
  45. payloadUUID,
  46. _payloadUUID,
  47. networkName,
  48. mdmHost,
  49. orgName,
  50. saveFile):
  51. plist = NSMutableDictionary.alloc().init()
  52.  
  53. # EAPClientConfiguration
  54. AcceptEAPTypes = []
  55. _AcceptEAPTypes = 25
  56. AcceptEAPTypes = [_AcceptEAPTypes]
  57.  
  58. tlsTrustedServerNames = []
  59.  
  60. EAPClientConfiguration = {}
  61. EAPClientConfiguration['AcceptEAPTypes'] = AcceptEAPTypes
  62. EAPClientConfiguration['TTLSInnerAuthentication'] = 'MSCHAPv2'
  63. EAPClientConfiguration['UserName'] = userName
  64. EAPClientConfiguration['UserPassword'] = userPass
  65. EAPClientConfiguration['tlsTrustedServerNames'] = tlsTrustedServerNames
  66.  
  67. # PayloadContent
  68. PayloadContent = []
  69. _PayloadContent = {}
  70. _PayloadContent['AuthenticationMethod'] = ''
  71. _PayloadContent['EAPClientConfiguration'] = EAPClientConfiguration
  72. _PayloadContent['EncryptionType'] = 'WPA'
  73. _PayloadContent['HIDDEN_NETWORK'] = False
  74. _PayloadContent['Interface'] = 'BuiltInWireless'
  75. _PayloadContent['PayloadDisplayName'] = '%s-%s' % (networkName,userName)
  76. _PayloadContent['PayloadEnabled'] = True
  77. _PayloadContent['PayloadIdentifier'] = '%s.%s.alacarte.interfaces.%s' % (mdmHost,payloadUUID,_payloadUUID)
  78. _PayloadContent['PayloadType'] = 'com.apple.wifi.managed'
  79. _PayloadContent['PayloadUUID'] = _payloadUUID
  80. _PayloadContent['PayloadVersion'] = 1
  81. _PayloadContent['SSID_STR'] = networkName
  82. PayloadContent = [_PayloadContent]
  83.  
  84. plist['PayloadContent'] = PayloadContent
  85. plist['PayloadDisplayName'] = 'WPA2'
  86. plist['PayloadIdentifier'] = '%s.%s.alacarte' % (mdmHost,payloadUUID)
  87. plist['PayloadOrganization'] = orgName
  88. plist['PayloadRemovalDisallowed'] = False
  89. plist['PayloadScope'] = 'User'
  90. plist['PayloadType'] = 'Configuration'
  91. plist['PayloadUUID'] = payloadUUID
  92. plist['PayloadVersion'] = 1
  93. print plist
  94. exportFile = saveFile
  95. plist.writeToFile_atomically_(exportFile,True)
  96. return exportFile
  97.  
  98. if __name__ == "__main__":
  99. sys.exit(main())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement