我现在正在努力使用 ubuntu 并希望得到一些帮助。
所以现在我在 Windows 7 不知何故离开后从 USB 闪存驱动器运行 ubuntu。
如何从 Ubuntu 中获取我的笔记本电脑硬盘上某处的 Windows 产品密钥?
Mar*_*rby 55
sudo apt install --reinstall ubuntu-desktop
Run Code Online (Sandbox Code Playgroud)
这个答案不是我写的,而是Thomas在Superuser上写的,如果你在这里投票,请在那里投票,谢谢
Linux 有一个很棒的工具,叫做 chntpw。您可以通过以下方式在 Debian/Ubuntu 上轻松获得它:
sudo apt install chntpw要查看相关的注册表文件,请安装 Windows 磁盘并像这样打开它:
chntpw -e /path/to/windisk/Windows/System32/config/SOFTWARE现在要获取解码的 DigitalProductId 输入以下命令:
dpi \Microsoft\Windows NT\CurrentVersion\DigitalProductId
下面的评论说
相关注册表文件的路径是/path/to/windisk/Windows/System32/config/RegBack/SOFTWARE
小智 8
所以对于任何想知道这实际上是如何工作的人来说。
本质上,您必须获取注册表项的内容
HKLM\Software\Microsoft\Windows NT\CurrentVersion\DigitalProductId
Run Code Online (Sandbox Code Playgroud)
这是一个所谓的REG_BINARY. 这意味着它只是一个字节的集合。您可以通过转储它们chntpw或手动复制它们。
让我们看看我们必须如何处理这些字节,以便在一些伪代码的帮助下获得我们的产品密钥。
一旦将它们放入数组中,就需要提取对产品 ID 进行编码的字节子集。特别是:52 和 (52 + 14) 之间的范围。这给了你 15 个字节。
EncodedId = DigitalProductId.Range(52, 52+14)
Run Code Online (Sandbox Code Playgroud)
这仍然是一堆字节,根本不像产品密钥。所以让我们解码它。
为此,您需要收集可以构成产品密钥的所有字符:
Characters = "BCDFGHJKMPQRTVWXY2346789"
Run Code Online (Sandbox Code Playgroud)
是的,这不是整个字母表。事实证明,Windows 产品密钥并不使用所有字母数字符号。
现在让我们进行解码。我们需要:
ProductKey = ""
FOR i = 0 TO 24
c = 0
FOR j = 14 TO 0 STEP -1
# Shift the current contents of c to the left by 1 byte
# and xor it with the next byte of our id
c = (c * 256) XOR EncodedId[j]
# Put the result of the divison back into the array
EncodedId[j] = FLOOR(c / 24)
# Calculate remainder of c
c = c MOD 24
LOOP
# Take character at position c and prepend it to the ProductKey
ProductKey = Characters[c] + ProductKey
LOOP
Run Code Online (Sandbox Code Playgroud)
最后,我们在字符串的适当位置插入“-”字符。
FOR i = 4 TO 1 STEP -1
ProductKey = ProductKey.Insert(i * 5, "-")
LOOP
Run Code Online (Sandbox Code Playgroud)
我们完成了!
... 几乎:
PRINT(ProductKey)
Run Code Online (Sandbox Code Playgroud)
现在!
我们的伪代码的能力
$array.Range($from, $to)获取的内容$array来自$from于$to$array.Insert($where, $what)插入$what在$whereFOR $var = $start TO $stop [STEP $step]循环变量$var从$start到$stop施加$step在每次迭代$a XOR $b计算按位异或对数字$a和$b$a MOD $b计算出的余数$a和$b$array[$i]仅从$i数组中取出位置处的元素#bla bla 是评论,将被忽略你可以在Super User 上看到 3 个在 C#、PowerShell 和 Python 中的实际实现
| 归档时间: |
|
| 查看次数: |
64441 次 |
| 最近记录: |