错误:'zlib'是无效命令

时间:2015-04-23 17:57:14

标签: macos openssl zlib

如何在OSX中运行此命令?

dd if=mybackup.ab bs=24 skip=1|openssl zlib -d > mybackup.tar

当我运行此操作时,我收到以下错误

$ dd if=mybackup.ab bs=24 skip=1|openssl zlib -d > mybackup.tar
dd: mybackup.ab: No such file or directory
openssl:Error: 'zlib' is an invalid command.

Standard commands
asn1parse      ca             ciphers        crl            crl2pkcs7      
dgst           dh             dhparam        dsa            dsaparam       
ec             ecparam        enc            engine         errstr         
gendh          gendsa         genrsa         nseq           ocsp           
passwd         pkcs12         pkcs7          pkcs8          prime          
rand           req            rsa            rsautl         s_client       
s_server       s_time         sess_id        smime          speed          
spkac          verify         version        x509           

Message Digest commands (see the `dgst' command for more details)
md2            md4            md5            mdc2           rmd160         
sha            sha1           

Cipher commands (see the `enc' command for more details)
aes-128-cbc    aes-128-ecb    aes-192-cbc    aes-192-ecb    aes-256-cbc    
aes-256-ecb    base64         bf             bf-cbc         bf-cfb         
bf-ecb         bf-ofb         cast           cast-cbc       cast5-cbc      
cast5-cfb      cast5-ecb      cast5-ofb      des            des-cbc        
des-cfb        des-ecb        des-ede        des-ede-cbc    des-ede-cfb    
des-ede-ofb    des-ede3       des-ede3-cbc   des-ede3-cfb   des-ede3-ofb   
des-ofb        des3           desx           rc2            rc2-40-cbc     
rc2-64-cbc     rc2-cbc        rc2-cfb        rc2-ecb        rc2-ofb        
rc4            rc4-40         rc5            rc5-cbc        rc5-cfb        
rc5-ecb        rc5-ofb        seed           seed-cbc       seed-cfb       
seed-ecb       seed-ofb     

2 个答案:

答案 0 :(得分:46)

mac上的Openssl是在没有zlib支持的情况下编译的。 this article中描述的替代方法适用于我的优胜美地:

dd if=backup.ab bs=1 skip=24 | python -c "import zlib,sys;sys.stdout.write(zlib.decompress(sys.stdin.read()))" | tar -xvf -

Optionaly,如果您只想将其转换为tar存档:

dd if=backup.ab bs=1 skip=24 | python -c "import zlib,sys;sys.stdout.write(zlib.decompress(sys.stdin.read()))" > backup.tar

它会跳过前24个字节的Android标头,然后解压缩zlib数据。

答案 1 :(得分:9)

只需修好

即可

OpenSSL Official Repo获取最新版本。

$ wget https://www.openssl.org/source/openssl-1.1.0e.tar.gz
$ tar -zxvf openssl-1.1.0e.tar.gz
$ cd openssl-1.1.0e

使用zlib支持配置OpenSSL

$ ./config zlib
$ make 
$ sudo make install

快乐的日子

$ which openssl
/usr/local/bin/openssl