使用 Perl 解压文件时如何找出错误代码的含义?

发布于 2024-12-09 10:38:07 字数 814 浏览 1 评论 0原文

我正在尝试在 Linux 上使用 perl 解压缩文件。该文件受密码保护,并且正在通过暴力攻击循环遍历可能的密码(是的,这是一项家庭作业)

我已隔离并删除了错误代码 20992(密码错误),但仍然收到另一个错误代码未在 docs 中的任何位置列出,并且找不到任何相关内容也可以使用谷歌。

错误是:

512  error:  invalid compressed data to inflate secret_brute.txt

有人看到这个错误消息吗?如果是这样,意味着什么?

#!/usr/bin/perl

@aaaa_zzzz = ("aaaa" .. "zzzz");

foreach(@aaaa_zzzz){
        $output = system("unzip -P $_ -q -o secret_brute.zip");
        if($output  !~ m/20992/){ #  <-- filtering out other error message
                chomp($output);
                print "$_ : $output\n";
        }
}

编辑

每个请求:Secret_brute.zip

I'm trying to unzip a file using perl on linux. The file is password protected, and am looping through possible password in a brute force attack (yes this is a homework assignment)

I have isolated and removed ther error code 20992 (bad password), but am still getting another error code which is not listed anywhere in the docs, and couldn't find anything relevant using The Googles either.

The error is:

512  error:  invalid compressed data to inflate secret_brute.txt

Has anyone seen this error message? If so, what mean?

#!/usr/bin/perl

@aaaa_zzzz = ("aaaa" .. "zzzz");

foreach(@aaaa_zzzz){
        $output = system("unzip -P $_ -q -o secret_brute.zip");
        if($output  !~ m/20992/){ #  <-- filtering out other error message
                chomp($output);
                print "$_ : $output\n";
        }
}

Edit

Per request: Secret_brute.zip

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

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

发布评论

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

评论(1

森林很绿却致人迷途 2024-12-16 10:38:07

以下是解压退出代码的列表。

如前所述,perldoc -f system 解释了如何获取 unzip 的退出值:

如果您想手动检查系统的故障,您可以
通过检查 $? 来检查所有可能的故障模式:

if ($? == -1) {
    print "failed to execute: $!\n";
}
elsif ($? & 127) {
    printf "child died with signal %d, %s coredump\n",
        ($? & 127),  ($? & 128) ? 'with' : 'without';
}
else {
    printf "child exited with value %d\n", $? >> 8;
}

:在这种情况下,值 512 将映射到:

2:检测到 zip 文件格式中的一般错误。无论如何,处理可能已成功完成;其他归档程序创建的一些损坏的 zip 文件有简单的解决方法。

另一方面,20992 将映射到:

82:由于解密密码错误,未找到文件。 (但是,如果成功处理一个文件,退出状态将为 1。)

Here is a list of exit codes from unzip.

As mentioned, perldoc -f system explains how to get the exit value of unzip:

If you'd like to manually inspect system's failure, you can
check all possible failure modes by inspecting $? like this:

if ($? == -1) {
    print "failed to execute: $!\n";
}
elsif ($? & 127) {
    printf "child died with signal %d, %s coredump\n",
        ($? & 127),  ($? & 128) ? 'with' : 'without';
}
else {
    printf "child exited with value %d\n", $? >> 8;
}

In this case, a value of 512 would map to:

2: A generic error in the zipfile format was detected. Processing may have completed successfully anyway; some broken zipfiles created by other archivers have simple work-arounds.

On the other hand, 20992 would map to:

82: No files were found due to bad decryption password(s). (If even one file is successfully processed, however, the exit status is 1.)

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