是否有任何已知的算法、开源程序或白皮书可以在给定密码的已知部分的情况下破解密码?

发布于 2024-12-07 05:56:30 字数 3049 浏览 0 评论 0原文

本质上,我的一个朋友将自己锁在他创建的加密容器之外。他一定是在输入密码时输入了错误,因为他无法访问该容器。我们知道它应该是什么,并且实际的密码肯定是它的变体和/或与之非常相似。我正在寻找代码或白皮书来处理“模糊”密码破解的概念(给定密码的已知部分或密码遵循的已知模式)。语言并不重要。我已经开发了一种暴力破解密码提示的方法,我需要的是开发一种算法,让我可以智能地尝试破解它,这样我就不必尝试每种可能的组合。然而,我认为其他人已经这样做了。我在一定程度上理解这背后的概念,但我正在寻找代码或白皮书,其中有人可能已经解决了这个问题。

更新 因此,我使用密码短语中可能存在的字符构建了一个字典(Python,但可以随意发送任何语言的示例)。需要考虑的因素是标准 QWERTY 键盘上的击键接近度、1337 种语言等效项以及每个字母的意外“/”字符,因为它靠近 Shift 键。从那里提供示例密码短语,并尝试每个字母。这是以下示例: http://code.activestate.com/recipes/535171-虚构

import os
from commands import getoutput

known = {
    '_': ('_', ' ', '-', '.', '/'),
    'b': ('b', 'B', '3', '8', '*', 'v', 'V', 'n', 'N', 'g', 'G', 'h', 'H', ' ', '/'),
    'g': ('g', 'G', '6', '^', 'f', 'F', 'h', 'H', 'b', 'B', 'v', 'V', 't', 'T', '/'),
    'l': ('l', 'L', '1', '!', ';', ':', 'k', 'K', 'o', 'O', '.', '>', ',', '<', 'p', 'P', '/'),
    'e': ('e', 'E', '3', '#', '4', '$', 'r', 'R', 'w', 'W', 'd', 'D', '/'),
    'h': ('h', 'H', '4', '$', 'g', 'G', 'j', 'J', 'y', 'Y', 'b', 'B', 'n', 'N', '/'),
    'i': ('i', 'I', '1', '|', '!', '\\', 'u', 'U', 'o', 'O', 'k', 'K', '8', '*', '9', '(', '/'),
    't': ('t', 'T', '7', '&', '+', 'r', 'R', 'y', 'Y', 'g', 'G', '4', '5', '%', '6', '^', '/'),
    'r': ('r', 'R', 'e', 'E', 't', 'T', 'f', 'F', '4', '$', '5', '%', '/'),
}

command = 'open-sesame %s' # hey, use your imagination ;)
# I obviously supplied only needed letters for this example, I can't tip you 
# off to the real pass phrase ;) This conveys the general idea....
passwdBasic = 'Big_Leg_Hitter'

def main():
    arrays = [known[ltr] for ltr in passwdBasic]
    start = [ltrs[0] for ltrs in arrays]
    end = [ltrs[-1] for ltrs in arrays]
    indexes = [0] * len(arrays)
    maxes = [len(ltrs)-1 for ltrs in arrays]
    chrs = [ltrs[i] for ltrs, i in zip(arrays, indexes)]
    while chrs != end:
        passx = ''.join(chrs)
        open('tries.txt', 'a+').write(passx + '\n')
        out = getoutput(command)
        if 'wrong password' not in out:
            print 'GOT IT!', passx
            return
        # Next letter
        for i in range(len(indexes)-1, -1, -1):
            if indexes[i] <= maxes[i]-1:
                indexes[i] += 1
                break
            else:
                indexes[i] = 0
        # Make up the chrs
        chrs = [ltrs[i] for ltrs, i in zip(arrays, indexes)]


if __name__ == '__main__':
    main()

的“open-sesame”是一个修改过的实用程序,用于安装这种特定类型的加密卷,它不是用 python 编写的,而是已制成命令行工具,以便该脚本可以与之交互。

几个挑战/研究方向:

  • 如果不小心按下了“/”字符而不是 Shift 键,这实际上会在密码短语中添加一个字符,因此可能会出现在任何字母之前。这需要在解决方案中考虑到。
  • 最好将其与 @rrenaud 提出的拼写检查实用程序集成: http://norvig.com/spell - Correct.html
  • 我对概率统计贝叶斯定理的应用很着迷,它被用来解决拼写检查问题;我想知道是否有任何关于错误击键以及在键入某些单词和/或短语时击中某些键而不是其他键的概率的研究。这种逻辑可以以与拼写检查实用程序大致相同的方式应用于密码破解,该实用程序受益于已知的常见拼写错误列表。我没有用于“训练”神经网络实用程序的错误击键数据。

我感谢所有的巨大帮助,我只是想分享我到目前为止的情况,以造福每个人。

Essentially a a friend of mine locked himself out of an encrypted container he created. He must have made a typo when entering his password, because he cannot access the container. We know what it is supposed to be, and the actual password is sure to be a variation of this and/or very similar to it. I'm looking for code or a white paper dealing with this notion of "fuzzy" password cracking given a known portion of the password or known pattern that the password follows. The language is unimportant. I've already developed a way to brute force the password prompt, what I need is to develop an algorithm that will let me intelligently attempt to crack it so I don't have to try every possible combination. I would think someone else has already done this, however. I understand the concepts behind this to an extent, but am looking for code or a white paper where someone might have already solved this issue.

UPDATE
So I've constructed a dictionary (Python, but feel free to send examples in any language) using characters that might be in the passphrase. Considerations were keystroke proximity on a standard QWERTY keyboard, 1337 speak equivalents, and an accidental '/' character for each letter since it is near the shift key. From there the sample pass phrase is supplied, and each letter is tried. This is following this example: http://code.activestate.com/recipes/535171-password-cracker/

import os
from commands import getoutput

known = {
    '_': ('_', ' ', '-', '.', '/'),
    'b': ('b', 'B', '3', '8', '*', 'v', 'V', 'n', 'N', 'g', 'G', 'h', 'H', ' ', '/'),
    'g': ('g', 'G', '6', '^', 'f', 'F', 'h', 'H', 'b', 'B', 'v', 'V', 't', 'T', '/'),
    'l': ('l', 'L', '1', '!', ';', ':', 'k', 'K', 'o', 'O', '.', '>', ',', '<', 'p', 'P', '/'),
    'e': ('e', 'E', '3', '#', '4', '

The fictitious 'open-sesame' is a modified utility that mounts this particular type of encrypted volume, it was not written in python but has been made into a command line tool so that this script can interact with it.

A couple of challenges / research directions:

  • If the '/' character was accidentally hit instead of the shift key, this would actually add a character to the pass phrase and thus could appear before any of the letters. This needs to be accounted for in the solution.
  • It would be nice to integrate this with the spellchecker utility proposed by @rrenaud: http://norvig.com/spell-correct.html
  • I'm fascinated by the application of Baye's Theorum of probability statistics which was applied to solve the spellcheck problem; I'm wondering if any research is available on erroneous keystrokes and the probability of hitting certain keys over others when typing certain words and/or phrases. This logic could be applied to password cracking in much the same fashion as the spellcheck utility, which benefits from known lists of common misspellings. I have no erroneous keystroke data with which to "train" a neural net utility.

I appreciate all the great help, I just wanted to share where I'm at so far for everyone's benefit.

, 'r', 'R', 'w', 'W', 'd', 'D', '/'), 'h': ('h', 'H', '4', '

The fictitious 'open-sesame' is a modified utility that mounts this particular type of encrypted volume, it was not written in python but has been made into a command line tool so that this script can interact with it.

A couple of challenges / research directions:

  • If the '/' character was accidentally hit instead of the shift key, this would actually add a character to the pass phrase and thus could appear before any of the letters. This needs to be accounted for in the solution.
  • It would be nice to integrate this with the spellchecker utility proposed by @rrenaud: http://norvig.com/spell-correct.html
  • I'm fascinated by the application of Baye's Theorum of probability statistics which was applied to solve the spellcheck problem; I'm wondering if any research is available on erroneous keystrokes and the probability of hitting certain keys over others when typing certain words and/or phrases. This logic could be applied to password cracking in much the same fashion as the spellcheck utility, which benefits from known lists of common misspellings. I have no erroneous keystroke data with which to "train" a neural net utility.

I appreciate all the great help, I just wanted to share where I'm at so far for everyone's benefit.

, 'g', 'G', 'j', 'J', 'y', 'Y', 'b', 'B', 'n', 'N', '/'), 'i': ('i', 'I', '1', '|', '!', '\\', 'u', 'U', 'o', 'O', 'k', 'K', '8', '*', '9', '(', '/'), 't': ('t', 'T', '7', '&', '+', 'r', 'R', 'y', 'Y', 'g', 'G', '4', '5', '%', '6', '^', '/'), 'r': ('r', 'R', 'e', 'E', 't', 'T', 'f', 'F', '4', '

The fictitious 'open-sesame' is a modified utility that mounts this particular type of encrypted volume, it was not written in python but has been made into a command line tool so that this script can interact with it.

A couple of challenges / research directions:

  • If the '/' character was accidentally hit instead of the shift key, this would actually add a character to the pass phrase and thus could appear before any of the letters. This needs to be accounted for in the solution.
  • It would be nice to integrate this with the spellchecker utility proposed by @rrenaud: http://norvig.com/spell-correct.html
  • I'm fascinated by the application of Baye's Theorum of probability statistics which was applied to solve the spellcheck problem; I'm wondering if any research is available on erroneous keystrokes and the probability of hitting certain keys over others when typing certain words and/or phrases. This logic could be applied to password cracking in much the same fashion as the spellcheck utility, which benefits from known lists of common misspellings. I have no erroneous keystroke data with which to "train" a neural net utility.

I appreciate all the great help, I just wanted to share where I'm at so far for everyone's benefit.

, '5', '%', '/'), } command = 'open-sesame %s' # hey, use your imagination ;) # I obviously supplied only needed letters for this example, I can't tip you # off to the real pass phrase ;) This conveys the general idea.... passwdBasic = 'Big_Leg_Hitter' def main(): arrays = [known[ltr] for ltr in passwdBasic] start = [ltrs[0] for ltrs in arrays] end = [ltrs[-1] for ltrs in arrays] indexes = [0] * len(arrays) maxes = [len(ltrs)-1 for ltrs in arrays] chrs = [ltrs[i] for ltrs, i in zip(arrays, indexes)] while chrs != end: passx = ''.join(chrs) open('tries.txt', 'a+').write(passx + '\n') out = getoutput(command) if 'wrong password' not in out: print 'GOT IT!', passx return # Next letter for i in range(len(indexes)-1, -1, -1): if indexes[i] <= maxes[i]-1: indexes[i] += 1 break else: indexes[i] = 0 # Make up the chrs chrs = [ltrs[i] for ltrs, i in zip(arrays, indexes)] if __name__ == '__main__': main()

The fictitious 'open-sesame' is a modified utility that mounts this particular type of encrypted volume, it was not written in python but has been made into a command line tool so that this script can interact with it.

A couple of challenges / research directions:

  • If the '/' character was accidentally hit instead of the shift key, this would actually add a character to the pass phrase and thus could appear before any of the letters. This needs to be accounted for in the solution.
  • It would be nice to integrate this with the spellchecker utility proposed by @rrenaud: http://norvig.com/spell-correct.html
  • I'm fascinated by the application of Baye's Theorum of probability statistics which was applied to solve the spellcheck problem; I'm wondering if any research is available on erroneous keystrokes and the probability of hitting certain keys over others when typing certain words and/or phrases. This logic could be applied to password cracking in much the same fashion as the spellcheck utility, which benefits from known lists of common misspellings. I have no erroneous keystroke data with which to "train" a neural net utility.

I appreciate all the great help, I just wanted to share where I'm at so far for everyone's benefit.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

海夕 2024-12-14 05:56:30

您是否尝试过从给定的已知错误密码中枚举编辑内容?如果您只需要进行一些编辑(就像拼写错误一样),那么实际上并没有那么多可能性。

Norvig 的这个 漂亮的代码 解决了编辑一级的编辑问题,用于 edits1( ) 功能。您可以以加深深度优先的方式应用它,因此您首先尝试单个编辑,然后是编辑的编辑,以及编辑的编辑的编辑等。

Have you tried enumerating edits from the given known faulty password? If you are only a few edits away (like it would be if it was a typo), there isn't really that many possibilities.

It's enumerating one level of edits is solved by this beautiful code by Norvig for spelling correction in the edits1() function. You could just apply that in a deepening depth first kind of way, so you try single edits first, and then edits of edits, and edits of edits of edits etc.

稀香 2024-12-14 05:56:30
  • 首先你需要你的字符集。特殊字符有可能吗?大写和小写?数字?

  • 接下来你需要你最初的猜测。也许有两种猜测,第二种猜测是将大写和小写颠倒,以防止大写锁定键按下。 (fuzzY v. FUZZy)

  • 现在您需要迭代...编辑、删除和插入的所有可能性。

    • 您有 3 组初始猜测
  • 现在你决定你想走多远。也许 2 次编辑、2 次删除或 2 次插入...或 1 次编辑和 1 次插入,或 1 次删除和 1 次插入等。

一些 JavaScript 代码来说明:

var charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
var guesses = {"passWORD":true, "PASSword":true};

function getProps(obj) {
 var lst = [];
 for(var g in obj)
  lst.push(g);
 return lst;
}
function transformEdit(guesses) {
 var lst = getProps(guesses);
 for(var x=0; x<lst.length; x++) {
  var guess = lst[x];
  for(var y=0; y<guess.length; y++) {
   for(var z=0; z<charset.length; z++) {
    guesses[guess.slice(0,y) + charset.charAt(z) + guess.slice(y+1)]=true;
   }
  }
 } 
}
function transformDelete(guesses) {
 var lst = getProps(guesses);
 for(var x=0; x<lst.length; x++) {
  var guess = lst[x];
  for(var y=0; y<guess.length; y++) {
   guesses[guess.slice(0,y) + guess.slice(y+1)]=true;
  }
 }
}
function transformInsert(guesses) {
 var lst = getProps(guesses);
 for(var x=0; x<lst.length; x++) {
  var guess = lst[x];
  for(var y=0; y<guess.length+1; y++) {
   for(var z=0; z<charset.length; z++) {
    guesses[guess.slice(0,y) + charset.charAt(z) + guess.slice(y)]=true;
   }
  }
 } 
}

// not the most efficient way
// but you'll get every possible edit, delete and insert
transformDelete(guesses);
transformInsert(guesses);
transformEdit(guesses);

getProps(guesses).length; //1759604

该代码没有提供最有效的解决方案,因为有很多重叠是可以避免的,但这是为了生成一个一次性问题的密码列表,所以......

我使用 JS 对象属性列表作为猜测的哈希集。

您可以通过迭代 getProps(guesses) 返回的数组来将猜测输出到密码列表。

  • First you need your character set. Were special characters a possibility? Upper and lower case? Numbers?

  • Next you need your original guess. Maybe 2 guesses, the second one would have your upper and lower cases inverted for the chance that the CAPS LOCK key was down. (fuzzY v. FUZZy)

  • Now you need to iterate all possibilities of... an edit, a delete and an insert.

    • You have 3 sets of initial guesses
  • Now you decide how far you want to take this. Maybe 2 edits, 2 deletes, or 2 inserts... or 1 edit and 1 insert, or 1 delete and 1 insert etc.

Some JavaScript code to illustrate:

var charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
var guesses = {"passWORD":true, "PASSword":true};

function getProps(obj) {
 var lst = [];
 for(var g in obj)
  lst.push(g);
 return lst;
}
function transformEdit(guesses) {
 var lst = getProps(guesses);
 for(var x=0; x<lst.length; x++) {
  var guess = lst[x];
  for(var y=0; y<guess.length; y++) {
   for(var z=0; z<charset.length; z++) {
    guesses[guess.slice(0,y) + charset.charAt(z) + guess.slice(y+1)]=true;
   }
  }
 } 
}
function transformDelete(guesses) {
 var lst = getProps(guesses);
 for(var x=0; x<lst.length; x++) {
  var guess = lst[x];
  for(var y=0; y<guess.length; y++) {
   guesses[guess.slice(0,y) + guess.slice(y+1)]=true;
  }
 }
}
function transformInsert(guesses) {
 var lst = getProps(guesses);
 for(var x=0; x<lst.length; x++) {
  var guess = lst[x];
  for(var y=0; y<guess.length+1; y++) {
   for(var z=0; z<charset.length; z++) {
    guesses[guess.slice(0,y) + charset.charAt(z) + guess.slice(y)]=true;
   }
  }
 } 
}

// not the most efficient way
// but you'll get every possible edit, delete and insert
transformDelete(guesses);
transformInsert(guesses);
transformEdit(guesses);

getProps(guesses).length; //1759604

The code doesn't present the MOST EFFICIENT solution since there is a lot of overlap that could of been avoided, but this is to generate a password list for a one shot problem so...

I used the JS object property list as a Hash Set of guesses.

You could output the guesses to a password list by iterating the array returned by getProps(guesses).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文