?????? ??? ????????????? ZIP

?????? ??????

????? ???????? ?????? �????????�, ?????. ?. ?????’????????? ????? ?????????, ????????? ?????. Aspose.ZIP API ???????? ????? ? ?????? ????????????? ????????, ??? ???????????? ?????. ? ??? ?????? ???????? ?????????? ?????? ??????????? zip-??????, ????????????? AES.

???????????????? ?????? ??????

???????, ??? ?????? ??????????? ? ???????? “T0p$ecret”, ?? ????? ??? ?????? ?????????? ?????? ?? ??? ?????. ????, ?? ?????? ??????? ?????? ???:

1string template = "T0p$ecret{0}{1}";

?? ?????????? ?????????? ??????????? ??? ??????? ??????????? ??????, ???????? ??? ??????????? ?????.

????????????? ??????? ??????

??? ??????? ??? ???????????

1 using (var a = new Archive("encrypted.zip", new ArchiveLoadOptions() {DecryptionPassword = password}))
2    a.ExtractToDirectory(".");

???????? InvalidDataException, ???? ???? ??????? ???????????? ??????.

????? ?????? ????? ?? ?????

???? ???????? ? ????????? ?????? ???? ?? ?????. ? ???? ?????? ???????? ?????? ??????????? ?????? ?? ???????.

 1    string template = "T0p$ecret{0}{1}";
 2    for (char c = 'A'; c < 'Z'; c++)
 3    {
 4        bool correct = false;
 5        for (int i = 10; i < 99; i++)
 6        {
 7            string password = string.Format(template, c, i);
 8            try
 9            {
10                using (Archive a = new Archive("encrypted.zip", new ArchiveLoadOptions() {DecryptionPassword = password}))
11                a.ExtractToDirectory(".");
12                correct = true;
13            }
14            catch (System.IO.InvalidDataException e)
15            {
16                correct = false;
17            }
18    
19            if (correct)
20            {
21                Console.WriteLine($"Proper password: {password}");
22                break;
23            }
24        }
25
26        if (correct)
27            break;
28    }

Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.