zoukankan      html  css  js  c++  java
  • MacOS 登录密码设置文件 kcpassword 的加解密算法

    加密分析

    使用了一组魔数 125, 137, 82, 35, 210, 188, 221, 234, 163, 185, 31

    登录密码明文按位依次循环与魔数进行异或,最后加上 35 181 122 180 153 242 70 85 145 160 十个字节做标识

    解密脚本

    #!/usr/bin/python3
    import struct
    import sys
    
    # Function to decrypt the kcpassword
    def decrypt_kcpassword():
        key = [125, 137, 82, 35, 210, 188, 221, 234, 163, 185, 31]
        length = len(key)
        f = open(sys.argv[1], "rb")
        byte = list(f.read())
        f.close()
        
        end = False
        kcpassword = []
        for i in range(len(byte)):
            if byte[i]^key[i%length] == 0 :
                end = True
    
            if end == False :
                kcpassword.append(str(chr(byte[i]^key[i%length])))
                
        print(''.join(map(str,kcpassword)))
    
    # Function main
    def main():
        if len(sys.argv) < 2 :
            print('usage : ./decode-kcpassword.py KCPASSWORD_PATH')
            exit()
        decrypt_kcpassword()
    
    # Call to main
    if __name__ == '__main__':
        main()
    

    macOS 自动登录配置文件: /Library/Preferences/com.apple.loginwindow.plist

    macOS 自动登录密码设置文件: /etc/kcpassword

    macOS 版本号存储文件: /System/Library/CoreServices/SystemVersion.plist

  • 相关阅读:
    i3wm菜单
    开始写博客拉
    xterm配置
    Linux Tips
    docker下运行labview2010
    oracle连接字符串解析
    C# 域登录实现
    解决Winform程序在不同分辨率系统下界面混乱
    FTP设置:FTP隔离用户
    sqlserver 启动不了sqlserver服务,提示特定服务错误代码10048
  • 原文地址:https://www.cnblogs.com/zhwer/p/15263277.html
Copyright © 2011-2022 走看看