gzip:stdin:非gzip格式


26

当我跑步时:

tar -zxvf john-1.7.0.2.tar.gz

我得到这个:

gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error is not recoverable: exiting now

它应该开始拆箱。

有人告诉我不要使用,z但是我得到了同样的错误。

这是我以这种方式下载的文件:

wget http://openwall.com/john/f/john-1.7.0.2.tar.gz

4
您发布的链接似乎是一个网页,而不是实际的存档:john-1.7.0.2.tar.gz: HTML document, ASCII text, with very long lines
steeldriver

Answers:


25

诊断下载的文件类型错误

正如steeldriver所说,这意味着该文件实际上并不是gzip压缩的tar文件,也不是任何gzip压缩的文件,尽管它的名称像一个文件。

当您使用下载文件时wget,通常有迹象表明您最终得到的文件不同于您要查找的文件:

ek@Io:~$ wget http://openwall.com/john/f/john-1.7.0.2.tar.gz
--2017-01-28 23:57:33--  http://openwall.com/john/f/john-1.7.0.2.tar.gz
Resolving openwall.com (openwall.com)... 195.42.179.197
Connecting to openwall.com (openwall.com)|195.42.179.197|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: http://www.openwall.com/john/ [following]
--2017-01-28 23:57:40--  http://www.openwall.com/john/
Resolving www.openwall.com (www.openwall.com)... 195.42.179.202
Connecting to www.openwall.com (www.openwall.com)|195.42.179.202|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: ‘john-1.7.0.2.tar.gz’

john-1.7.0.2.tar.gz                          [      <=>                                                                        ]  15.27K  3.61KB/s    in 4.2s

2017-01-28 23:57:51 (3.61 KB/s) - ‘john-1.7.0.2.tar.gz’ saved [15633]

在这种情况下,主要标志是:

  • 301 Moved Permanently消息,重定向到后面带有一个地址/。这将为服务器上的某个目录加载默认页面,该目录通常index.html(几乎总是)是HTML文件。
  • Length: unspecified [text/html],告诉您正在接收纯文本(text),并且应将其解释为html。这确实不只是一个标志-您可以确定没有基于此的真实gzip压缩文件。

您还可以使用该file实用程序,该实用程序检查文件并告诉您它看起来是哪种文件:

ek@Io:~$ file john-1.7.0.2.tar.gz
john-1.7.0.2.tar.gz: HTML document, ASCII text, with very long lines

当然,你可以检查自己的文件,等工具headless以及view

ek@Io:~$ head john-1.7.0.2.tar.gz
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
<TITLE>John the Ripper password cracker</TITLE>
<link href="/ubuntu//style.css" type="text/css" rel="stylesheet">
<META name="keywords" content="John the Ripper, password cracker, JtR, password checker, password recovery, password, cracker, crackers, cracking, crack, crypt, passwd, shadow, Unix, Linux, Windows, Win32, Mac OS X, Mac OSX, MacOS X, OS X, OSX, DOS, VMS, OpenVMS, hash, DES, MD5, Blowfish, Kerberos, AFS, LM, LanMan, LanManager, NT, 2000, XP, 2003, Vista, 7, NTLM, NTLMv1, MD4, Netscape LDAP, SHA, SSHA, MySQL, TGT, s/key, Eggdrop, Apache, apr1, SYSUAF, SYSUAF.DAT, AltiVec, MMX, SSE, SSE2, AVX, XOP, wordlist, wordlists, dictionary, brute force, decrypt, challenge, response, John, Ripper, john, jhon, jonh, jack, Jack the Ripper">
<META name="description" content="A fast password cracker for Unix, Windows, DOS, and OpenVMS, with support for Unix, Windows, and Kerberos AFS passwords, plus a lot more with contributed patches">
</HEAD>

<BODY bgcolor="#E0E0E0" text="black" link="blue" alink="red" vlink="navy">

如果这确实是一个二进制文件,那么您将得到一堆毫无意义的垃圾,因为您使用的任何寻呼机或查看器都无济于事,试图将某些内容解释为实际上不是的纯文本。例如,在正确的文件上:

ek@Io:~$ head john-1.8.0.tar.gz
WӦQ♥john-1.8.0.tar ▒▒kw▒ر&▒▒ٿ▒▒▒▒4E]|▒v▒NF▒d[▒n▒▒▒L&▒HB▒$▒ ▒df͚▒▒▒▒▒ꩪ▒7@▒▒▒9ӳf▒▒J▒m     ▒ؗ▒u▒▒~,▒ї▒▒▒ˣ▒▒ӣ_▒▒▒▒C▒▒|▒▒▒▒▒şw▒v▒▒>▒|w▒▒▒}▒▒▒ί▒▒i9▒?7+▒gY7i▒$▒▒ʲ▒▒s?▒J'MV%▒rY4ur[▒4▒▒e▒▒.▒▒▒▒▒&/u▒-2▒W▒▒V▒▒!o▒0b▒▒▒♥▒|Q▒4▒▒▒&▒▒Y1Y▒F▒▒Iy▒▒▒▒$▒▒▒▒,▒]▒h▒▒8▒"▒▒M▒,Һ~(▒i▒4Y▒d▒QgQ▒*ۚf7yA▒.▒&i▒<d▒↓▒7▒H_-l▒7▒▒▒Z▒▒.m▒▒ʒ%F,▒۬▒*▒▒hrW▒cY▒▒
▒+▒O1▒-y>▒▒J▒yM?▒4I▒▒▒kYS▒▒:▒▒n▒C▒▒%▒▒▒v▒▒▒{[[tN▒9▒▒▒kA▒▒▒▒▒/[▒▒▒▒u▒▒▒z▒▒▒▒>▒▒5▒▒▒▒t▒t▒▒Y6Û<▒*/i▒i{K>▒,▒▒▒▒▒;9)▒Z.mJSeiLB▒▒▒▒▒j▒▒eQ緅▒_▒α▒Ŋ▒▒▒W▒▒▒▒▒_▒▒ˢ▒▒-q▒<gyw͍▒9▒?▒,▒▒▒▒h&▒V"▒▒▒▒▒▒▒l▒▒3▒▒▒▒\▒▒i#▒▒综▒◄0▒▒▒.e♠>a▒▒▒▒▒▒$klt:▒▒rA▒M▒'F▒R▒▒▒▒Lo▒♥1z▒\▒↓X▒▒▒P"֕▒▒▒♦▒▒▒▒|▒▒▒▒▒▒1I▒o"'#|6e▒▒t▒Ц▒FVL▒▒S▒ޓ▒▒;▒x▒▒▒▒▒▒▒QVrr▒▒▒9O▒W7▒♠Og▒
▒▒▒8▒▒/▒▒dm▒FG'▒'t2L▒▒&L▒Y:▒▒▒▒▒4▒rI<▒#▒+▒je▒▒▒>T9▒▒M▒XE-ʆ▒▒'n▒▒$↑▒m▒W▒▒w̕▒▒m▒n%▒|A_▒yGp↑D▒↓߻▒▒▒i▒▒}ӡH▒▒▒▒׍$$H▒▒&▒▒4▒▒▒Z-@♣▒*~▒▒▒ y6▒▒▒`▒v↓▒s▒+̱▒?▒1▒▒▒<▒>▒^▒▒Y#k▒
7`N'▒o▒.&▒▒(▒Դ~AD▒"E◄' lq▒`▒▒`▒[▒9◄▒▒wzuK▒N▒▒Y▒▒%or▒▒)▒▒i↓▒▒▒l5.S▒޶r▒_*▒RO▒{▒$▒(▒▒▒▒C▒·▒▒׀f2ˊ[:▒▒▒,|ew▒▒▒Ag▒'▒▒▒H▒▒t▒{͓▒▒▒▒JH˭s▒)g▒ON▒▒eŚQ▒▒▒♠ s▒▒ߪ▒▒▒▒▒▒▒▒▒▒_♠▒-▒

(我只是复制了开始的内容。)

获取正确的文件

这就告诉您如何确定在这些情况下(特别是在这种情况下)出了什么问题。但是,您实际上如何找到并下载正确的文件?

情况因情况而异。但是,一个好的开始是:

  • 转到该软件的官方网站,查看它们是否提供下载链接。即使这是您最初使用的链接的方式,但经过一段时间后,您可能会发现该链接已更改。

    例如,在这种情况下,当前版本是1.8.0,而不是1.7.0.2(并在j子目录中而不是f),并且旧版本不再在该URL中可用。

  • 转到下载文件时重定向到的页面。在这种情况下,即为:http : //www.openwall.com/john/

    或者,您甚至可以检查下载的文件。(或在网络浏览器中打开。)

您已重定向到该软件的主要下载页面。您可以在Web浏览器中下载,也可以复制正确的当前下载链接并使用进行下载wget。有几个选择,但假设你实际上并不需要你试图下载特定旧版本,并根据您的具体文件没有尝试下载,我怀疑http://openwall.com/john/j/ john-1.8.0.tar.gz是您所寻找的。

当然,以后找到这篇文章的读者可能会发现链接不再有效。但是,此处展示的用于解决此类问题的方法将仍然有效。

ek@Io:~$ wget http://openwall.com/john/j/john-1.8.0.tar.gz
--2017-01-29 00:16:19--  http://openwall.com/john/j/john-1.8.0.tar.gz
Resolving openwall.com (openwall.com)... 195.42.179.197
Connecting to openwall.com (openwall.com)|195.42.179.197|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 5450412 (5.2M) [application/x-tar]
Saving to: ‘john-1.8.0.tar.gz’

john-1.8.0.tar.gz                        100%[================================================================================>]   5.20M  78.8KB/s    in 26s

2017-01-29 00:16:47 (202 KB/s) - ‘john-1.8.0.tar.gz’ saved [5450412/5450412]

我已经下载了文件。请注意,这一次,没有不希望发生的重定向和类型是作为application/x-tar代替text/html

(HTTP重定向并不总是很糟糕。这是当您重定向到似乎不是您真正要查找的文件的东西时,您应该怀疑下载并未真正成功。)

file 同意:

ek@Io:~$ file john-1.8.0.tar.gz
john-1.8.0.tar.gz: gzip compressed data, was "john-1.8.0.tar", last modified: Thu May 30 04:19:35 2013, max compression, from Unix

它成功解压缩:

ek@Io:~$ tar xf john-1.8.0.tar.gz
ek@Io:~$ cd john-1.8.0/
ek@Io:~/john-1.8.0$ ls -l
total 12
drwxrwxr-x 2 ek ek 4096 Jan 29 00:22 doc
lrwxrwxrwx 1 ek ek   10 May 29  2013 README -> doc/README
drwxrwxr-x 2 ek ek 4096 Jan 29 00:22 run
drwxrwxr-x 2 ek ek 4096 Jan 29 00:22 src

(很正确,使用z; 并不重要tar xzf,因为它是正确的文件,它仍然可以使用。)

您可以继续构建源代码并安装。

记住,您不必总是从源代码构建

有时,您确实需要程序的最新版本,而Ubuntu的存储库中没有。您可能会尝试找到PPA,但是如果找不到真正信任的PPA或提供您想要的东西,或者想要使用自定义选项构建它,或者您真的很喜欢从源代码构建,然后从源代码是一种宝贵而有用的技术。

我确实建议至少检查Ubuntu官方存储库中适用于您的系统的软件。在我的16.04系统上:

ek@Io:~$ apt show john
Package: john
Version: 1.8.0-2
Priority: optional
Section: admin
Origin: Ubuntu
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Ruben Molina <rmolina@udea.edu.co>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 452 kB
Depends: libc6 (>= 2.14), john-data (= 1.8.0-2)
Suggests: wordlist
Homepage: http://www.openwall.com/john/
Supported: 5y
Download-Size: 184 kB
APT-Sources: http://us.archive.ubuntu.com/ubuntu xenial/main amd64 Packages
Description: active password cracking tool
 John the Ripper is a tool designed to help systems administrators to
 find weak (easy to guess or crack through brute force) passwords, and
 even automatically mail users warning them about it, if it is desired.
 .
 Besides several crypt(3) password hash types most commonly found on
 various Unix flavors, supported out of the box are Kerberos AFS and
 Windows NT/2000/XP/2003 LM hashes, plus several more with contributed
 patches.

还有其他几种搜索软件包的方法。通常,使用Ubuntu软件包搜索网页很方便。

由于您打算尝试安装1.7.0.2版,因此官方存储库中的1.8.0版可能已足够。(实际上,1.8.0似乎与从官方网站上提供的版本相同。)因此,您真的可能只想安装该版本:

sudo apt update
sudo apt install john
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.