微软输入法自学习取证

admin 2025年1月6日08:28:33评论6 views字数 1992阅读6分38秒阅读模式
C:Users用户名AppDataRoamingMicrosoftInputMethodChs%USERPROFILE%AppDataRoamingMicrosoftInputMethodChs是 Windows 系统中用于存储微软拼音输入法相关数据的文件夹
根据这个路径可以得到几个该用户下的dat数据
微软输入法自学习取证
微软输入法自学习取证

两个是ChsPinyinIH.dat和ChsPinyinUDL.dat

ChsPinyinIH.dat

该文件通常存储微软拼音输入法的

输入历史记录

它记录了用户输入过的词汇、短语等信息,以便输入法能够根据用户习惯提供更准确的联想和预测

ChsPinyinUDL.dat

该文件通常存储微软拼音输入法的

用户自定义词典

这两个是用户下的两个dat,这里面会记录用户长期输入的文字,需要通过代码编写进行解码,尝试使用 GBK 或 UTF-16 解码

因为要显示中文,所以这是我们需要的

通过读取后,我们得到这里面的常用词汇,成果如下

微软输入法自学习取证

还有更多,甚至你长期敲的字都在这里面,需要把ChsPinyinUDL.dat给解密出来,这里解密的肯定不多,只有几个汉字

所以还要配合着ChsPinyinIH.dat来配合查看

我们找了一位长期使用微软输入法的人进行测试(常见的在windows server上都是默认微软输入法)

发现解密出9.4k大小的东西

微软输入法自学习取证

像他常用的云服务器厂商观星云

微软输入法自学习取证

玩偶姐姐?

微软输入法自学习取证

还有一些人名地名事件等等

解密代码如下:

import sysimport osimport platformimport pypinyindefstr2sysstr(strout):    sysstr = platform.system()if (sysstr == "Windows"):return strout.encode("gbk")else:return strout.encode("utf-8")if __name__ == '__main__':iflen(sys.argv) == 2:        user_word_file = sys.argv[1]else:        user_word_file = os.environ['USERPROFILE'] + "AppDataRoamingMicrosoftInputMethodChsChsPinyinUDL.dat"ifnot os.path.exists(user_word_file):print("file:", user_word_file, "not existnn")print("use example")print("user_word_exporter.exe")print(" : paser %USERPROFILE%AppDataRoamingMicrosoftInputMethodChsChsPinyinUDL.dat")print("user_word_exporter.exe dat_file_name")print(" : paser dat_file_name")        sys.exit(1)    fp = open(user_word_file, "rb")    userword = open("user_word_microsoft_pinyin.txt""at")    data = fp.read()    cnt = int.from_bytes(data[12:16], byteorder='little', signed=False)    user_word_base = 0x2400for i inrange(cnt):        cur_idx = user_word_base + i * 60        word_len = int.from_bytes(data[cur_idx + 10:cur_idx + 11], byteorder='little', signed=False)        word = data[cur_idx + 12: cur_idx + 12 + word_len * 2].decode("utf-16")        pinyin_str = 't'        pinyin_list = pypinyin.pinyin(word, style=pypinyin.NORMAL)for i, py inenumerate(pinyin_list):            pinyin_str += py[0]if i + 1 != word_len:                pinyin_str += ' '        one_line = word + pinyin_str + 't1'print(word + pinyin_str + 't1')        userword.write(one_line + "n")    fp.close()    userword.close()
直接运行即可

原文始发于微信公众号(秋风的安全之路):微软输入法自学习取证

免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2025年1月6日08:28:33
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   微软输入法自学习取证https://cn-sec.com/archives/3594408.html
                  免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉.

发表评论

匿名网友 填写信息