如何自己破解密码档案

气道正压通气


有一个存档,您需要提取内容,但是忘记了密码。您可以使用Google并信任其他程序(一个两个三个),但是

破解RAR存档的唯一方法是蛮力。

初始数据


归档文件和密码字典(如果您将%username%放入归档文件中,请不要忘记将常用的文件名添加到本地!)。


程序


从以前的文章:


– , 262144 SHA1, WinRAR ( AES) ( ). , CRC32, , . – , , . RAR — « ».

. WinRAR , .

因此,第一个版本中的算法将很简单:使用密码打开文件,然后遍历归档文件的密码,直到损坏为止。


不要忘记我们使用Go
密码档案


dictFile, err := os.Open(dictionary)
if err != nil {
    log.Fatalln(err)
    }
defer dictFile.Close()

存档本身


zipr, err := zip.OpenReader(zipfile)
if err != nil {
    log.Fatal(err)
}

而我们的 算法


scanner := bufio.NewScanner(dictFile)
for scanner.Scan() {
    pass := scanner.Text()
    for _, z := range zipr.File {
        z.SetPassword(pass)
        _, err := z.Open()
        //   
        if err == nil {
            println("[+] Found password")
            println("[+] Password = " + pass)
            os.Exit(0)
        }
    }

如果密码在存档中-瞧!


二十一点和多线程版本


还有一个更有趣的版本 -多线程和goroutines。


存储库包含有关各种主题的63种更复杂的实用程序。如果您有想法要添加-写。


UPD


多次减法是避免错误的最可靠方法。感谢大家的回应。


All Articles