MAC 命令行 查看Mac硬件信息 usb设备信息 iOS信息

最近有需求需要通过MAC程序查看通过usb链接的硬件设备的信息,比如通过Mac系统查看手机的uuid,串号,五码,基带等信息,类似沙漏助手,爱思助手等,现在网上有一个著名的开源库,libimobiledevice,感觉和安卓的ADB有一拼,感谢前辈们的付出,但是这次我们不仅仅讲这个库的使用,我一个前同事(**杰同学)告诉我一个他们做mac程序时,查看硬件设备的一个终端命令,汇总来说,一共2个可以在命令行使用的工具,在此记录一下,方便自己以后学习使用,

libimobiledevice

安装方式:

brew install --HEAD libimobiledevice   //brew的默认已经安装,如没有安装,自行查找安装方式 带参数HEAD安装最新版
brew install --HEAD ideviceinstaller    //这个是安装ipa的一个库,可以顺便安装上, 

常见用法:
附带官方使用介绍
查看当前的移动设备列表

idevice_id -l   // 显示当前所连接的设备信息,包括 usb、WiFi 连接

安装ipa应用到iphone上

ideviceinstaller -u [udid] -i [xxx.ipa]  #xxx.ipa:安装文件路径

重启设备

idevicediagnostics restart   //设备重启

查看设备信息

ideviceinfo -u UDID

信息大概如下:

deviceinfo -u 3d92bfe127fd1e75f07ecb4cddb5732650b212fc
ActivationState: Activated
ActivationStateAcknowledged: true
BasebandActivationTicketVersion: V2
BasebandCertId: 2315222105
BasebandChipID: 9781473
BasebandKeyHashInformation:
 AKeyStatus: 2
 SKeyHash: u+/tcCwvaQ+1Y9t40I4yegCEmB28mALlaROhaIVGBWo=
 SKeyStatus: 0
BasebandMasterKeyHash: 8CB15EE4C8002199070D9500BB8FB183B02713A5CA2A6B92DB5E75CE15536182
BasebandRegionSKU: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==
BasebandSerialNumber: M8D5eQ==
BasebandStatus: BBInfoAvailable
BasebandVersion: 5.30.00
BluetoothAddress: cc:08:8d:e0:ef:e1
BoardId: 8
BrickState: false
BuildVersion: 16D57
CPUArchitecture: arm64
CarrierBundleInfoArray[1]:
 0:
  CFBundleIdentifier: com.apple.ChinaTelecom_USIM_cn
  CFBundleVersion: 35.0.1
  IntegratedCircuitCardIdentity: 89860316740103990298
  InternationalMobileSubscriberIdentity: 460110015269713
  MCC: 460
  MNC: 11
  MobileEquipmentIdentifier: 359168*****781
  Slot: kOne
  kCTPostponementInfoAvailable: SIMCarrierInfo
CertID: 2315222105
ChipID: 32784
ChipSerialNo: M8D5eQ==
DeviceClass: iPhone
DeviceColor: 2
DeviceName:11的iPhone
DieID: 7394096112599098
EthernetAddress: cc:08:8d:e0:ef:e2
FirmwareVersion: iBoot-4513.230.10
FusingStatus: 3
HardwareModel: D10AP
HardwarePlatform: t8010
HasSiDP: true
HostAttached: true
IntegratedCircuitCardIdentity: 89860316740103990298
InternationalMobileEquipmentIdentity: 359168073637813
InternationalMobileSubscriberIdentity: 460110015269713
InternationalMobileSubscriberIdentityOverride: false
MLBSerialNumber: F3X63250F6***6TFA
MobileEquipmentIdentifier: 35916***363781
MobileSubscriberCountryCode:
MobileSubscriberNetworkCode: 11
ModelNumber: MNGW2
NonVolatileRAM:
 auto-boot: dHJ1ZQ==
 backlight-level: MTUxMA==
 boot-args:
 com.apple.System.tz0-size: MHhDMDAwMDA=
 oblit-begins: T2JsaXRUeXBlOiBPYmxpdGVyYXRlRGF0YVBhcnRpdGlvbi4gUmVhc29uOiB1bmtub3du
 obliteration: aGFuZGxlX21lc3NhZ2U6IE9ibGl0ZXJhdGlvbiBDb21wbGV0ZQo=
PRIVersion_Major: 0
PRIVersion_Minor: 1
PRIVersion_ReleaseNo: 191
PartitionType: GUID_partition_scheme
PasswordProtected: false
PhoneNumber: +86 181 **** 5772
PkHash: if98WU1oTt+jcaZlvUC9AOG/rlbJxZpIN+cg7Rv1bCY=
ProductName: iPhone OS
ProductType: iPhone9,1
ProductVersion: 12.1.4
ProductionSOC: true
ProtocolVersion: 2
ProximitySensorCalibration: f3oABTIAHgD5oNhBpb34QQAAyEKoNbtBUVrEQQAAFkOoNbtBUVrEQQAAFkOmWz5DzF3qQMNls0RxxbNEcS20RCkEtETKshlCSBAaQvT9G0IHzh5CAAAgQv60H0NpLz9CAABIQuAJ9EOTSPNDB2EbRotsl0PvgF0dAh0IEn31pUUvjcJDrtOvRQIAAAAAAAAT
RegionInfo: CH/A
SIMStatus: kCTSIMSupportSIMStatusReady
SIMTrayStatus: kCTSIMSupportSIMTrayInsertedWithSIM
SerialNumber: DNQS70TQHG70
SoftwareBehavior: QQEAAAAAAAAAAAAAAAAAAA==
SoftwareBundleVersion:
SupportedDeviceFamilies[1]:
 0: 1
TelephonyCapability: true
TimeIntervalSince1970: 1582305212.829859
TimeZone: Asia/Shanghai
TimeZoneOffsetFromUTC: 28800.000000
TrustedHostAttached: true
UniqueChipID: 7394096112599098
UniqueDeviceID: 3d92bfe127fd1b4cddb5732650b212fc
UseRaptorCerts: true
Uses24HourClock: false
WiFiAddress: cc:08:8d:e0:ef:e0
WirelessBoardSerialNumber: 6714B8F011C
kCTPostponementInfoPRIVersion: 0.1.191
kCTPostponementInfoPRLName: 301
kCTPostponementInfoServiceProvisioningState: true
kCTPostponementStatus: kCTPostponementStatusActivated

查看系统日志log

idevicesyslog 
//ERROR: Could not start service com.apple.syslog_relay.
//Could not start logger for udid 3d92bfe127fd1e75f07ecb4cddb5732650b212fc
//如果遇到上面的错误,终端执行命令 sudo chmod -R 777 /var/db/lockdown

如果遇到错误 ERROR: Could not connect to lockdownd, error code -3
那只能卸载重装了

brew update

brew uninstall --ignore-dependencies libimobiledevice

brew uninstall --ignore-dependencies usbmuxd

brew install --HEAD usbmuxd

brew unlink usbmuxd

brew link usbmuxd

brew install --HEAD libimobiledevice

brew install ideviceinstaller


system_profiler

这个命令更适用于查看Mac上的硬件信息,移动设备,usb设备比较少
常见用法:
附带官方使用方法地址

Usage: system_profiler [-listDataTypes]
       system_profiler [-xml] [-timeout n] [-detailLevel n]
       system_profiler [-xml] [-timeout n] [dataType1 ... dataTypeN]

  -detailLevel n    specifies the level of detail for the report
                      mini = short report (contains no identifying or personal information)
                      basic = basic hardware and network information
                      full = all available information

  -listDataTypes    lists all the available datatypes

  -xml              generates xml output instead of plain text
                    if redirected to a file with the extension ".spx"
                    the file can be opened in System Profiler.app

  -timeout          specifies the maximum time to spend gathering information
                    the default is 180 seconds, 0 means no timeout

  Redirect stderr to /dev/null to suppress progress and error messages.

Examples:

  system_profiler
     Generates a text report with the standard detail level.

  system_profiler -detailLevel mini
     Generates a short report without identifying/personal information.

  system_profiler -listDataTypes
     Shows a list of the available data types.

  system_profiler SPSoftwareDataType SPNetworkDataType
     Generates a text report containing only software and network data.

  system_profiler -xml >MySystem.spx
     Creates a XML file which can be opened by System Profiler.app

常用的命令:
查看一下当前USB设备连接的Iphone的UDID,

system_profiler SPUSBDataType | grep "Serial Number:.*" | sed s#".*Serial Number: "##'

生成完整的设备信息报告到桌面

system_profiler -detailLevel   >~/Desktop/info.txt

生成的电脑上的信息特别完整,稍微截图一点,我尝试生成完整信息到桌面的文件,导出的txt文档大概3.2M,包括所有的硬件软件信息,有兴趣的同学可以尝试,也可以查看当前USB设备的信息可见数据源,稍微截图一些看一下


image.png

也可以查看Mac电脑上App的签名信息


image.png

如上,记录一下,之后再补充libimobiledevice相关的,向爱思助手等工具学习

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 219,869评论 6 508
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 93,716评论 3 396
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 166,223评论 0 357
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 59,047评论 1 295
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 68,089评论 6 395
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 51,839评论 1 308
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 40,516评论 3 420
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 39,410评论 0 276
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 45,920评论 1 319
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 38,052评论 3 340
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 40,179评论 1 352
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 35,868评论 5 346
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 41,522评论 3 331
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 32,070评论 0 22
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 33,186评论 1 272
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 48,487评论 3 375
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 45,162评论 2 356

推荐阅读更多精彩内容