我正在尝试构建动态密码恢复工具.您可以指定密码以及与未知密码索引相对应的未知字符列表.因此,如果您记住90%的密码,并且不记得几个字母,这将为您带来轻巧的暴力. 我可以将用户提供的密码与未知字符列表结合使用;但是,我一直试图打印每个可能的密码.
I am trying to build a dynamic password recovery tool. You can specify a password, and an unknown character list which correspond to unknown password indexes. So, if you remember 90% of your password, and can't remember a few letters, this will do a light weight brute force for you. I am able to combine the user supplied password with an unknown character list; however, I am stuck trying to print every potential password.
我被困在这里:
password = 'Dude123' charList = ['d8','vV','','D8','','',''] finalString = [''.join(set((a, b))) for a, b in zip(password, charList)] print(finalString) #This statement yields the following ['Dd8', 'uv^', 'd', 'eD8', '1', '2', '3']现在我需要打印: 杜德123 dude123 8ude123 Dvde123 dvde123 8vde123 ...
Now I need to print: Dude123 dude123 8ude123 Dvde123 dvde123 8vde123 ...
或具有某种效果的东西(它没有以任何特定顺序遍历字符,我只需要列出所有可能的组合即可.
or something to that effect (it doesn't have loop through the characters in any particular order, I just need a list of all the possible combinations.
谢谢您的帮助!
戴夫
推荐答案您的意思是这样的吗?
>>> import itertools >>> >>> password = 'Dude123' >>> charList = ['d8','vV','','D8','','',''] >>> >>> finalString = [''.join(set((a, b))) for a, b in zip(password, charList)] >>> >>> possibles = list(''.join(poss) for poss in itertools.product(*finalString)) >>> possibles ['Dude123', 'DudD123', 'Dud8123', 'Dvde123', 'DvdD123', 'Dvd8123', 'DVde123', 'DVdD123', 'DVd8123', 'dude123', 'dudD123', 'dud8123', 'dvde123', 'dvdD123', 'dvd8123', 'dVde123', 'dVdD123', 'dVd8123', '8ude123', '8udD123', '8ud8123', '8vde123', '8vdD123', '8vd8123', '8Vde123', '8VdD123', '8Vd8123']更多推荐
如何打印密码组合(但每个索引都有自定义约束)
发布评论