Current version: 1.0.19 1.0.15 (as of 2018-12-10)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python | |
| # Requires passlib: pip install passlib | |
| from passlib.hash import pbkdf2_sha512 | |
| from passlib.util import ab64_decode | |
| from biplist import * | |
| # Checksum size must be 128 bytes for use as OS X password hash! | |
| pbkdf2_sha512.checksum_size = 128 | |
| hash = pbkdf2_sha512.encrypt("password", rounds=38000, salt_size=32) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ''' | |
| This is an example of the server-side logic to handle slash commands in | |
| Python with Flask. | |
| Detailed documentation of Slack slash commands: | |
| https://api.slack.com/slash-commands | |
| Slash commands style guide: | |
| https://medium.com/slack-developer-blog/slash-commands-style-guide-4e91272aa43a#.6zmti394c | |
| ''' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import struct, objc | |
| from Foundation import NSBundle | |
| from Cocoa import NSAppleEventDescriptor | |
| def OSType(s): | |
| # Convert 4 character code into 4 byte integer | |
| return struct.unpack('>I', s)[0] | |
| # Create an opaque pointer type to mask the raw AEDesc pointers we'll throw around | |
| AEDescRef = objc.createOpaquePointerType('AEDescRef', '^{AEDesc=I^^{OpaqueAEDataStorageType}}') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import objc | |
| # Set up opaque types for undefined signatures so we don't have | |
| # to deal with "PyObjCPointer created:" errors | |
| ODNode = objc.createOpaquePointerType("ODNode", b"^{_ODNode=}", None) | |
| ODRecord = objc.createOpaquePointerType("ODRecord", b"^{_ODRecord=}", None) | |
| from OpenDirectory import ODNodeCreateWithNodeType, ODNodeCopyRecord, ODRecordVerifyPassword, kODNodeTypeAuthentication, kODRecordTypeUsers | |
| directory_service, err = ODNodeCreateWithNodeType(None, None, kODNodeTypeAuthentication, None) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import objc | |
| from Foundation import NSBundle | |
| IOKit_bundle = NSBundle.bundleWithIdentifier_('com.apple.framework.IOKit') | |
| functions = [("IOServiceGetMatchingService", b"II@"), | |
| ("IOServiceMatching", b"@*"), | |
| ("IORegistryEntryCreateCFProperty", b"@I@@I"), | |
| ] |
| Country | ISO 3166 | Region |
|---|---|---|
| Afghanistan | AF | EMEA |
| Åland Islands | AX | EMEA |
| Albania | AL | EMEA |
| Algeria | DZ | EMEA |
| American Samoa | AS | APAC |
| Andorra | AD | EMEA |
| Angola | AO | EMEA |
| Anguilla | AI | AMER |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # This file parses this file: | |
| # https://github.com/Piker-Alpha/macosxbootloader/blob/El-Capitan/src/boot/NetBootImages.h | |
| # and this one: | |
| # https://github.com/Piker-Alpha/macosxbootloader/blob/El-Capitan/src/boot/AppleLogoData.h | |
| from ctypes import CDLL, create_string_buffer, c_size_t, c_void_p | |
| import re | |
| CPK = CDLL('/System/Library/PrivateFrameworks/PackageKit.framework/Versions/Current/PackageKit') | |
| lzvn_decode = CPK.lzvn_decode |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python | |
| # (Note that we must use system Python on a Mac.) | |
| #### | |
| # Quick script to get the computer's serial number. | |
| # | |
| # Written for @john.e.lamb on the MacAdmins Slack team. | |
| import objc | |
| import CoreFoundation |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from ctypes import CDLL, c_uint, byref, create_string_buffer | |
| from ctypes.util import find_library | |
| libc = CDLL(find_library("c")) | |
| def sysctl(name, isString=True): | |
| size = c_uint(0) | |
| # Find out how big our buffer will be | |
| libc.sysctlbyname(name, None, byref(size), None, 0) | |
| # Make the buffer | |
| buf = create_string_buffer(size.value) |