本文整理汇总了Python中mac_alias.Alias类的典型用法代码示例。如果您正苦于以下问题:Python Alias类的具体用法?Python Alias怎么用?Python Alias使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Alias类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: BLOBParser_raw
def BLOBParser_raw(blob):
if args.blob_parse_raw == True:
print "----------------------------------------------------------------------------"
try:
b = Bookmark.from_bytes(blob)
print "Raw Parsed Bookmark BLOB:"
print b
except:
pass
try:
a = Alias.from_bytes(blob)
print "Raw Parsed Alias BLOB:"
print a.version
print a.target
print a.volume
print a.extra
print a.appinfo
print a.AppleShareInfo.server
print a.AppleShareInfo.user
print a.AppleShareInfo.zone
except:
pass
print "----------------------------------------------------------------------------"
示例2:
'textSize': 12.0,
'viewOptionsVersion': 1,
'backgroundImageAlias': b'\x00\x00\x00\x00\x02\x1e\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xd1\x94\\\xb0H+\x00\x05\x00\x00\x00\x98\x0fbackground.tiff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x99\xd19\xb0\xf8\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\x00\x00\r\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0b.background\x00\x00\x10\x00\x08\x00\x00\xd1\x94\\\xb0\x00\x00\x00\x11\x00\x08\x00\x00\xd19\xb0\xf8\x00\x00\x00\x01\x00\x04\x00\x00\x00\x98\x00\x0e\x00 \x00\x0f\x00b\x00a\x00c\x00k\x00g\x00r\x00o\x00u\x00n\x00d\x00.\x00t\x00i\x00f\x00f\x00\x0f\x00\x02\x00\x00\x00\x12\x00\x1c/.background/background.tiff\x00\x14\x01\x06\x00\x00\x00\x00\x01\x06\x00\x02\x00\x00\x0cMacintosh HD\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xce\x97\xab\xc3H+\x00\x00\x01\x88[\x88\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02u\xab\x8d\xd1\x94\\\xb0devrddsk\xff\xff\xff\xff\x00\x00\t \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x07syscoin\x00\x00\x10\x00\x08\x00\x00\xce\x97\xab\xc3\x00\x00\x00\x11\x00\x08\x00\x00\xd1\x94\\\xb0\x00\x00\x00\x01\x00\x14\x01\x88[\x88\x00\x16\xa9\t\x00\x08\xfaR\x00\x08\xfaQ\x00\x02d\x8e\x00\x0e\x00\x02\x00\x00\x00\x0f\x00\x1a\x00\x0c\x00M\x00a\x00c\x00i\x00n\x00t\x00o\x00s\x00h\x00 \x00H\x00D\x00\x13\x00\x01/\x00\x00\x15\x00\x02\x00\x14\xff\xff\x00\x00\xff\xff\x00\x00',
'backgroundColorBlue': 1.0,
'iconSize': 96.0,
'backgroundColorGreen': 1.0,
'arrangeBy': 'none',
'showIconPreview': True,
'gridSpacing': 100.0,
'gridOffsetY': 0.0,
'showItemInfo': False,
'labelOnBottom': True,
'backgroundType': 2,
'backgroundColorRed': 1.0
}
alias = Alias.from_bytes(icvp['backgroundImageAlias'])
alias.volume.name = package_name_ns
alias.volume.posix_path = '/Volumes/' + package_name_ns
alias.volume.disk_image_alias.target.filename = package_name_ns + '.temp.dmg'
alias.volume.disk_image_alias.target.carbon_path = 'Macintosh HD:Users:\x00syscoinuser:\x00Documents:\x00syscoin:\x00syscoin:\x00' + package_name_ns + '.temp.dmg'
alias.volume.disk_image_alias.target.posix_path = 'Users/syscoinuser/Documents/syscoin/syscoin/' + package_name_ns + '.temp.dmg'
alias.target.carbon_path = package_name_ns + ':.background:\x00background.tiff'
icvp['backgroundImageAlias'] = biplist.Data(alias.to_bytes())
ds['.']['icvp'] = icvp
ds['.']['vSrn'] = ('long', 1)
ds['Applications']['Iloc'] = (370, 156)
ds['Bitcoin-Qt.app']['Iloc'] = (128, 156)
ds.flush()
示例3: BLOBParser_human
def BLOBParser_human(blob):
#As described in:
#http://mac-alias.readthedocs.io/en/latest/bookmark_fmt.html
#http://mac-alias.readthedocs.io/en/latest/alias_fmt.html
if args.blob_parse_human == True:
print "----------------------------------------------------------------------------"
print "Human Readable Parsed BLOB:"
try:
b = Bookmark.from_bytes(blob)
print "\tBookmark BLOB: Volume Name [0x2010]: \t\t" + b.get(0x2010,default=None)
print "\tBookmark BLOB: Volume Path [0x2002]: \t\t" + str(b.get(0x2002,default=None))
print "\tBookmark BLOB: Volume Flags [0x2020]: \t\t" + str(b.get(0x2020,default=None))
print "\tBookmark BLOB: Volume is Root FS [0x2030]: \t" + str(b.get(0x2030,default=None))
print "\tBookmark BLOB: Volume UUID [0x2011]: \t\t" + str(b.get(0x2011,default=None))
print "\tBookmark BLOB: Volume Size [0x2012]: \t\t" + str(b.get(0x2012,default=None))
print "\tBookmark BLOB: Volume Creation Date [0x2013]: \t" + str(b.get(0x2013,default=None))
print "\tBookmark BLOB: Volume URL [0x2005]: \t\t" + str(b.get(0x2005,default=None))
print "\tBookmark BLOB: Volume Bookmark [0x2040]: \t" + str(b.get(0x2040,default=None))
print "\tBookmark BLOB: Volume Mount Point [0x2050]: \t" + str(b.get(0x2050,default=None))
print "\tBookmark BLOB: Security Extension [0xf080]: \t" + str(b.get(0xf080,default=None))
print "\tBookmark BLOB: Security Extension [0xf081]: \t" + str(b.get(0xf081,default=None))
print ""
print "\tBookmark BLOB: Target Path [0x1004]: \t\t" + str(b.get(0x1004,default=None))
print "\tBookmark BLOB: Target CNID Path [0x1005]: \t" + str(b.get(0x1005,default=None))
print "\tBookmark BLOB: Containing Folder Index [0xc001]:" + str(b.get(0xc001,default=None))
print "\tBookmark BLOB: Target Creation Date [0x1040]: \t" + str(b.get(0x1040,default=None))
print "\tBookmark BLOB: Target Flags [0x1010]: \t\t" + str(b.get(0x1010,default=None))
print "\tBookmark BLOB: Target Filename [0x1020]: \t" + str(b.get(0x1020,default=None))
print ""
print "\tBookmark BLOB: Creator Username [0xc011]: \t" + str(b.get(0xc011,default=None))
print "\tBookmark BLOB: Creator UID [0xc012]: \t\t" + str(b.get(0xc012,default=None))
print ""
print "\tBookmark BLOB: Unknown [0x1003]: \t\t" + str(b.get(0x1003,default=None))
print "\tBookmark BLOB: Unknown [0x1054]: \t\t" + str(b.get(0x1054,default=None))
print "\tBookmark BLOB: Unknown [0x1055]: \t\t" + str(b.get(0x1055,default=None))
print "\tBookmark BLOB: Unknown [0x1056]: \t\t" + str(b.get(0x1056,default=None))
print "\tBookmark BLOB: Unknown [0x1101]: \t\t" + str(b.get(0x1101,default=None))
print "\tBookmark BLOB: Unknown [0x1102]: \t\t" + str(b.get(0x1102,default=None))
print "\tBookmark BLOB: TOC Path [0x2000]: \t\t" + str(b.get(0x2000,default=None))
print "\tBookmark BLOB: Unknown [0x2070]: \t\t" + str(b.get(0x2070,default=None))
print "\tBookmark BLOB: File Reference Flag [0xd001]: \t" + str(b.get(0xd001,default=None))
print "\tBookmark BLOB: Creation Options [0xd010]: \t" + str(b.get(0xd010,default=None))
print "\tBookmark BLOB: URL Length Array [0xe003]: \t" + str(b.get(0xe003,default=None))
print "\tBookmark BLOB: Localized Name (?) [0xf017]: \t" + str(b.get(0xf017,default=None))
print "\tBookmark BLOB: Unknown [0xf022]: \t\t" + str(b.get(0xf022,default=None))
if b.get(0xf020,default=None):
icon_uuid = uuid.uuid4()
print icon_uuid
filename = "ICNS_file_" + str(icon_uuid) + ".icns"
saveICNS = open(filename,'w')
saveICNS.write(b.get(0xf020,default=None).bytes)
saveICNS.close()
print "\tBookmark BLOB: ICNS (Icon) File [0xf020]: \tICNS File Saved in: " + filename
except:
pass
try:
a = Alias.from_bytes(blob)
print "\tAlias BLOB: Alias Version: \t\t" + str(a.version)
print "\tAlias BLOB: Target Filename: \t\t" + a.target.filename
print "\tAlias BLOB: Target File CNID: \t\t" + str(a.target.cnid)
print "\tAlias BLOB: Target Carbon Path: \t" + a.target.carbon_path
print "\tAlias BLOB: Target POSIX Path: \t\t" + a.target.posix_path
print "\tAlias BLOB: Target Creation Date: \t" + str(a.target.creation_date)
print "\tAlias BLOB: Target Creator Code: \t" + a.target.creator_code
print "\tAlias BLOB: Target Type Code: \t\t" + a.target.type_code
print "\tAlias BLOB: Target Folder Name: \t" + a.target.folder_name
print "\tAlias BLOB: Target Folder CNID: \t" + str(a.target.folder_cnid)
if a.target.kind == 0:
print "\tAlias BLOB: Target Kind: \t\tFile"
elif a.target.kind == 1:
print "\tAlias BLOB: Target Kind: \t\tFolder"
print ""
print "\tAlias BLOB: Levels From: \t\t" + str(a.target.levels_from)
print "\tAlias BLOB: Levels To: \t\t\t" + str(a.target.levels_to)
print "\tAlias BLOB: User Home Prefix Length: \t" + str(a.target.user_home_prefix_len)
print ""
print "\tAlias BLOB: Volume Name: \t\t" + a.volume.name
print "\tAlias BLOB: Volume Creation Date: \t" + str(a.volume.creation_date)
print "\tAlias BLOB: Volume Filesystem Type: \t" + a.volume.fs_type
print "\tAlias BLOB: Volume Disk Type: \t\t" + str(a.volume.disk_type)
print "\tAlias BLOB: Volume Attribute Flags: \t" + str(a.volume.attribute_flags)
print "\tAlias BLOB: Volume Filesystem ID: \t" + str(a.volume.fs_id)
print ""
print "\tAlias BLOB: Volume AppleShare Information: \t" + a.volume.appleshare_info
print "\tAlias BLOB: Volume Driver Name: \t" + str(a.volume.driver_name)
print "\tAlias BLOB: Volume POSIX Path: \t" + str(a.volume.posix_path)
print "\tAlias BLOB: Volume Disk Image Alias: \t" + a.volume.disk_image_alias
print "\tAlias BLOB: Volume Creation Date: \t" + str(a.volume.creation_date)
print "\tAlias BLOB: Volume Dialup Information: \t" + str(a.volume.dialup_info)
print "\tAlias BLOB: Volume Network Mount Information: \t" + str(a.volume.network_mount_info)
print ""
#.........这里部分代码省略.........