1. 程式人生 > >mac book air 編譯sqlcipher

mac book air 編譯sqlcipher

編譯SQLCipher

  • 0x01. 編譯成靜態庫
$ ./configure --enable-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC" \
    LDFLAGS="/opt/local/lib/libcrypto.a"

錯誤:

clang: error: no such file or directory: '/opt/local/lib/libcrypto.a'
...
configure:2922: error: in `/Users/panjing/github/sqlcipher':
configure:2924: error: C compiler cannot create executables
See `config.log'
for more details
  • 0x02. 編譯成動態庫

第一步順利通過

$ ./configure --enable-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC" \
    LDFLAGS="-lcrypto"

第二步出錯:

$ make

錯誤資訊:

sqlite3.c:18280:10: fatal error: 'openssl/rand.h' file not found

重新安裝openssl

Last login: Sat Jun  9 16:53:04 on ttys000
➜  ~ brew uninstall --force openssl
➜  ~ brew cleanup --force -s openssl
➜  ~ brew prune
Pruned 0
symbolic links and 1 directories from /usr/local ➜ ~ brew install openssl Updating Homebrew... ==> Auto-updated Homebrew! Updated 1 tap (homebrew/core). ==> Updated Formulae ace heroku ngspice apache-spark hg-fast-export nomad ballerina hugo nsd bitrise imagemagick passenger buildifier
[email protected]
6 pgpool-ii byacc infer phoronix-test-suite cglm iozone php-cs-fixer clhep jenkins plantuml conan json-fortran ponyc dfix krakend pre-commit docker-squash libgit2 pyvim exiftool libngspice restic eye-d3 libplctag s3-backer fibjs libraw saldl flac linkerd spotbugs folly mikutter stella fonttools minetest terraform_landscape fzf mingw-w64 treefrog genact mkdocs unbound [email protected]1.4 mkvtoolnix webpack goreleaser mypy youtube-dl gsoap nco zita-convolver hadolint nesc ==> Deleted Formulae aws-cloudsearch ==> Downloading https://homebrew.bintray.com/bottles/openssl-1.0.2o_1.high_sierr ######################################################################## 100.0% ==> Pouring openssl-1.0.2o_1.high_sierra.bottle.tar.gz ==> Caveats A CA file has been bootstrapped using certificates from the SystemRoots keychain. To add additional certificates (e.g. the certificates added in the System keychain), place .pem files in /usr/local/etc/openssl/certs and run /usr/local/opt/openssl/bin/c_rehash This formula is keg-only, which means it was not symlinked into /usr/local, because Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries. If you need to have this software first in your PATH run: echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.zshrc For compilers to find this software you may need to set: LDFLAGS: -L/usr/local/opt/openssl/lib CPPFLAGS: -I/usr/local/opt/openssl/include ==> Summary ? /usr/local/Cellar/openssl/1.0.2o_1: 1,791 files, 12.3MB ➜ ~

根據提示執行:

echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.zshrc
  • 0x03. 重新靜態編譯

修正libcrypto.a的路徑,重新編譯:

➜  sqlcipher git:(master) ✗ ./configure --enable-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC" \
        LDFLAGS="/usr/local/opt/openssl/lib/libcrypto.a"

error:

sqlite3.c:21628:10: fatal error: 'openssl/rand.h' file not found
#include <openssl/rand.h>
         ^~~~~~~~~~~~~~~~
1 error generated.
make: *** [sqlite3.lo] Error 1

檔案存在,但是路徑不對。

➜  sqlcipher git:(master) ✗ ls /usr/local/opt/openssl/include/openssl 
aes.h         des.h         idea.h        pem2.h        ssl2.h
asn1.h        des_old.h     krb5_asn.h    pkcs12.h      ssl23.h
asn1_mac.h    dh.h          kssl.h        pkcs7.h       ssl3.h
asn1t.h       dsa.h         lhash.h       pqueue.h      stack.h
bio.h         dso.h         md4.h         rand.h        symhacks.h
blowfish.h    dtls1.h       md5.h         rc2.h         tls1.h
bn.h          e_os2.h       mdc2.h        rc4.h         ts.h
buffer.h      ebcdic.h      modes.h       ripemd.h      txt_db.h
camellia.h    ec.h          obj_mac.h     rsa.h         ui.h
cast.h        ecdh.h        objects.h     safestack.h   ui_compat.h
cmac.h        ecdsa.h       ocsp.h        seed.h        whrlpool.h
cms.h         engine.h      opensslconf.h sha.h         x509.h
conf.h        err.h         opensslv.h    srp.h         x509_vfy.h
conf_api.h    evp.h         ossl_typ.h    srtp.h        x509v3.h
crypto.h      hmac.h        pem.h         ssl.h

解決辦法:

➜  sqlcipher git:(master) ✗ brew link openssl --force
Warning: Refusing to link: openssl
Linking keg-only openssl means you may end up linking against the insecure,
deprecated system OpenSSL while using the headers from Homebrew's openssl.
Instead, pass the full include/library paths to your compiler e.g.:
  -I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib
➜  sqlcipher git:(master) ✗ 

// 下面命令才解決問題,上面命令沒用
./configure --enable-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC" LDFLAGS="-lcrypto" CPPFLAGS="-I/usr/local/opt/openssl/include"

編譯:

➜  sqlcipher git:(master) ✗ clear 

➜  sqlcipher git:(master) ✗ make
./libtool --mode=compile --tag=CC gcc -I/usr/local/opt/openssl/include  -DSQLITE_HAS_CODEC -DSQLCIPHER_CRYPTO_OPENSSL -DSQLITE_OS_UNIX=1 -I. -I/Users/panjing/github/sqlcipher/src -I/Users/panjing/github/sqlcipher/ext/rtree -I/Users/panjing/github/sqlcipher/ext/icu -I/Users/panjing/github/sqlcipher/ext/fts3 -I/Users/panjing/github/sqlcipher/ext/async -I/Users/panjing/github/sqlcipher/ext/session -D_HAVE_SQLITE_CONFIG_H -DBUILD_sqlite -DNDEBUG  -DSQLITE_THREADSAFE=1    -DSQLITE_TEMP_STORE=2 -c sqlite3.c
libtool: compile:  gcc -I/usr/local/opt/openssl/include -DSQLITE_HAS_CODEC -DSQLCIPHER_CRYPTO_OPENSSL -DSQLITE_OS_UNIX=1 -I. -I/Users/panjing/github/sqlcipher/src -I/Users/panjing/github/sqlcipher/ext/rtree -I/Users/panjing/github/sqlcipher/ext/icu -I/Users/panjing/github/sqlcipher/ext/fts3 -I/Users/panjing/github/sqlcipher/ext/async -I/Users/panjing/github/sqlcipher/ext/session -D_HAVE_SQLITE_CONFIG_H -DBUILD_sqlite -DNDEBUG -DSQLITE_THREADSAFE=1 -DSQLITE_TEMP_STORE=2 -c sqlite3.c  -fno-common -DPIC -o .libs/sqlite3.o
libtool: compile:  gcc -I/usr/local/opt/openssl/include -DSQLITE_HAS_CODEC -DSQLCIPHER_CRYPTO_OPENSSL -DSQLITE_OS_UNIX=1 -I. -I/Users/panjing/github/sqlcipher/src -I/Users/panjing/github/sqlcipher/ext/rtree -I/Users/panjing/github/sqlcipher/ext/icu -I/Users/panjing/github/sqlcipher/ext/fts3 -I/Users/panjing/github/sqlcipher/ext/async -I/Users/panjing/github/sqlcipher/ext/session -D_HAVE_SQLITE_CONFIG_H -DBUILD_sqlite -DNDEBUG -DSQLITE_THREADSAFE=1 -DSQLITE_TEMP_STORE=2 -c sqlite3.c -o sqlite3.o >/dev/null 2>&1
./libtool --mode=link gcc -I/usr/local/opt/openssl/include  -DSQLITE_HAS_CODEC -DSQLCIPHER_CRYPTO_OPENSSL -DSQLITE_OS_UNIX=1 -I. -I/Users/panjing/github/sqlcipher/src -I/Users/panjing/github/sqlcipher/ext/rtree -I/Users/panjing/github/sqlcipher/ext/icu -I/Users/panjing/github/sqlcipher/ext/fts3 -I/Users/panjing/github/sqlcipher/ext/async -I/Users/panjing/github/sqlcipher/ext/session -D_HAVE_SQLITE_CONFIG_H -DBUILD_sqlite -DNDEBUG  -DSQLITE_THREADSAFE=1    -lcrypto  -no-undefined -o libsqlcipher.la sqlite3.lo -lcrypto   \
         -rpath "/usr/local/lib" -version-info "8:6:8"
libtool: link: gcc -dynamiclib  -o .libs/libsqlcipher.0.dylib  .libs/sqlite3.o   -lcrypto    -install_name  /usr/local/lib/libsqlcipher.0.dylib -compatibility_version 9 -current_version 9.6 -Wl,-single_module
libtool: link: (cd ".libs" && rm -f "libsqlcipher.dylib" && ln -s "libsqlcipher.0.dylib" "libsqlcipher.dylib")
libtool: link: ar cru .libs/libsqlcipher.a  sqlite3.o
libtool: link: ranlib .libs/libsqlcipher.a
libtool: link: ( cd ".libs" && rm -f "libsqlcipher.la" && ln -s "../libsqlcipher.la" "libsqlcipher.la" )
./libtool --mode=link gcc -I/usr/local/opt/openssl/include  -DSQLITE_HAS_CODEC -DSQLCIPHER_CRYPTO_OPENSSL -DSQLITE_OS_UNIX=1 -I. -I/Users/panjing/github/sqlcipher/src -I/Users/panjing/github/sqlcipher/ext/rtree -I/Users/panjing/github/sqlcipher/ext/icu -I/Users/panjing/github/sqlcipher/ext/fts3 -I/Users/panjing/github/sqlcipher/ext/async -I/Users/panjing/github/sqlcipher/ext/session -D_HAVE_SQLITE_CONFIG_H -DBUILD_sqlite -DNDEBUG  -DSQLITE_THREADSAFE=1    -lcrypto  -DHAVE_READLINE=0  -DHAVE_EDITLINE=1 -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_UNKNOWN_SQL_FUNCTION -DSQLITE_ENABLE_STMTVTAB \
        -o sqlcipher /Users/panjing/github/sqlcipher/src/shell.c libsqlcipher.la \
        -ledit  -lcrypto   -rpath "/usr/local/lib"
libtool: link: gcc -I/usr/local/opt/openssl/include -DSQLITE_HAS_CODEC -DSQLCIPHER_CRYPTO_OPENSSL -DSQLITE_OS_UNIX=1 -I. -I/Users/panjing/github/sqlcipher/src -I/Users/panjing/github/sqlcipher/ext/rtree -I/Users/panjing/github/sqlcipher/ext/icu -I/Users/panjing/github/sqlcipher/ext/fts3 -I/Users/panjing/github/sqlcipher/ext/async -I/Users/panjing/github/sqlcipher/ext/session -D_HAVE_SQLITE_CONFIG_H -DBUILD_sqlite -DNDEBUG -DSQLITE_THREADSAFE=1 -DHAVE_READLINE=0 -DHAVE_EDITLINE=1 -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_UNKNOWN_SQL_FUNCTION -DSQLITE_ENABLE_STMTVTAB -o .libs/sqlcipher /Users/panjing/github/sqlcipher/src/shell.c  ./.libs/libsqlcipher.dylib -ledit -lcrypto

檢視編譯結果:

➜  sqlcipher git:(master) ✗ ls
CHANGELOG.md                  config.h.in                   fts5parse.out                 manifest.uuid                 sqlcipher                     sqlite3.lo
LICENSE                       config.log                    fts5parse.y                   mkkeywordhash                 sqlcipher-1.1.8-testkey.db    sqlite3.o
Makefile                      config.status                 install-sh                    mkso.sh                       sqlcipher-2.0-be-testkey.db   sqlite3ext.h
Makefile.in                   config.sub                    keywordhash.h                 mptest                        sqlcipher-2.0-beta-testkey.db sqlite3session.h
Makefile.linux-gcc            configure                     lemon                         opcodes.c                     sqlcipher-2.0-le-testkey.db   src
Makefile.msc                  configure.ac                  lempar.c                      opcodes.h                     sqlcipher-3.0-testkey.db      test
README.md                     contrib                       libsqlcipher.la               parse.c                       sqlcipher.1                   tool
VERSION                       doc                           libtool                       parse.h                       sqlcipher.pc                  tsrc
aclocal.m4                    ext                           ltmain.sh                     parse.h.temp                  sqlcipher.pc.in               vsixtest
art                           fts5.c                        macosx                        parse.out                     sqlcipher.xcodeproj
autoconf                      fts5.h                        magic.txt                     parse.y                       sqlite.pc.in
config.guess                  fts5parse.c                   main.mk                       shell.c                       sqlite3.c
config.h                      fts5parse.h                   manifest                      spec.template                 sqlite3.h

執行:

➜  sqlcipher git:(master) ✗ ./sqlcipher
SQLCipher version 3.20.1 2017-08-24 16:21:36
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> .exit
➜  sqlcipher git:(master) ✗ 

安裝sqlcipher

sqlcipher git:(master)brew install sqlcipher

破解微信資料庫:

➜  Downloads sqlcipher
SQLCipher version 3.20.1 2017-08-24 16:21:36
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> .open EnMicroMsg.db
sqlite> pragma key='f4d27d4';
sqlite> pragma cipher_use_hmac=off;
sqlite> pragma cipher_page_size=1024;
sqlite> pragma kdf_iter=4000;
sqlite> attach database 'MicroMsg.db' as wc key '';
sqlite> select sqlcipher_export('wc');

sqlite> detach database wc;
sqlite> .quit

參考

相關推薦

mac book air 編譯sqlcipher

編譯SQLCipher 0x01. 編譯成靜態庫 $ ./configure --enable-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC" \ LDFLAGS="/opt/local/lib/libcr

MAC BOOK Air 安裝metasploit-framework

raw 文件夾 127.0.0.1 數據 otn 可能 postgre localhost 成功 Step 1:Xcode命令行開發工具OS X確保它已經安裝了Xcode開發工具,在終端執行: xcode-select --install1Step 2:Java SDK安裝

蘋果MAC BOOK PRO 5.5 2009年中 安裝fedora26——broadcom BCM4322 無線驅動在fedora上的安裝

broadcom bcm4322 fedora 無線網卡驅動 Broadcom BCM4322 無線驅動在fedora上的安裝MAK BOOK PRO 5.5-2009年中,網卡Broadcom BCM4322 驅動安裝在linux上。直接安裝fedora後,此電腦是沒有無線網卡驅動的,但是安裝u

交叉編譯sqlcipher

項目 分代 什麽 sqlit 所有 依賴 代碼包 代碼片段 linux平臺 1. 小心預編譯宏SQLITE_HAS_CODEC 2. openssl在不同License下,導出的符號不對等。 一如往常,所有GNU Make like的項目在linux平臺下configu

mac 上python編譯報錯No module named MySQLdb

nload egg setup sql tmp loading mysql exp finall mac 上python編譯報錯No module named MySQLdb You installed python You did brew install mys

Mac下重新編譯Linux內核

nload usr linux內核 linu fig 內核源碼 clas 過程 耐心 Mac下重新編譯Linux內核 操作系統實驗,要求添加系統調用並重新編譯內核,這裏記錄一下編譯內核的過程 0.下載VirtualBox 博主一直用parallel desk,但因為驅動等問

mac環境ndk編譯lame

超級簡單直接上步驟 1 下載 wget https://downloads.sourceforge.net/lame/lame-3.100.tar.gz –no-check-certificat 2 解壓 tar xvf lame-3.100.tar.gz 3 建立交叉編譯環境

產品經理聊產品--mac book pro 2018 初體驗

  工作前幾年,使用電腦,基本上都是微軟的作業系統,自從從大廠出來之後,才逐漸熟悉使用linux,到現在基本上都是基本上一個月windows平臺基本不需要開機就可以,可以說基本上被ubuntu的簡潔和實用性吸引住了,但是,用了久之後,逐漸發現了ubuntu的一些缺點,也不算是ubuntu的缺點吧,主要是沒有

mac 下載 安裝 編譯 配置 bitcoind 一步到位

由於本人的電腦配置帶虛擬機器比較累,索性直接使用本機進行bitcoin相關開發 網上對於mac使用bitcoin開發的資料相對較少 我直接貼一個自己安裝的過程 大家少走彎路 首先是下載比特幣原始碼  git clone https://github.com/bit

mac下 反編譯apk

使用apktool+dex2jar+jd-gui反編譯apk 1.安裝apktool 如果未安裝 下載apktool : 解壓apktool.zip,把apktool和apktool.jar放到usr/local/bin檔案下; 終端下輸入命令: apktool --

Ubuntu下編譯SqlCipher以及解密微信資料庫EnMicroMsg.db過程和坑

wget https://codeload.github.com/sqlcipher/sqlcipher/zip/v3.4.2 ./configure --enable-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC -DSQLITE_TEMP_STORE=

mac下phpize編譯提示Cannot find autoconf解決辦法

  mac下phpize編譯如下報錯: /usr/bin/phpizeConfiguring for:PHP Api Version: 20121113Zend Module Api No: 20121212Zend Extension Api No: 220121212Cannot fi

Mac 10.14 編譯Android 8.1原始碼及刷入nexus 6p

環境準備 官網 描述得已經相當清楚了 ,這裡稍微總結一下: 建立區分大小寫的磁碟映像 mac系統預設是不區分大小寫的,所以我們需要建立一個區分大小寫的檔案系統 hdiutil create -type SPARSE -fs 'Case-sensitive Journaled HFS+' -size 6

Mac上下載編譯Android 6.0原始碼詳細記錄

第一步: 使用命令建立一個字尾為.dmg或.dmg.sparseimage的映象檔案 $ hdiutil create -type SPARSE -fs 'Case-sensitive Journaled HFS+' -size 80g ~/

mac環境下編譯Opencv4.0 以及在Processing中使用opencv4.0舉例

一、環境 Mac OS Sierra 10.12.6 Processing 3.4  https://processing.org/download/ Opencv 4.0.0  https://opencv.org/releases.html

mac book pro 最全快捷鍵

應用軟體和其他 OS X 快捷鍵 注:部分應用軟體可能不支援以下所有應用軟體按鍵組合。 按鍵組合        功能 -空格鍵        顯示或隱藏 Spotlight 搜尋欄(如果安裝了多語種,則可能在啟用的腳本系統間迴圈) Control-A        移到行/段落的開頭

Mac下反編譯和重新編譯打包APK

反編譯APK需要的工具如下: - dex2jar 這個工具用於將dex檔案轉換成jar檔案 下載地址:http://sourceforge.net/projects/dex2jar/files/

linux/mac平臺上編譯安裝boost庫

環境:Ubuntu LTS 10.04, 64bit GCC版本: #gcc --version gcc (Ubuntu 4.4.3-4ubuntu5) 4.4.3 Copyright (C) 2009 Free Software Foundation, Inc. This is free sof

Mac 10.12 編譯 Android 原始碼

Android 原始碼系列文章: 環境準備 這裡只講 Mac 10.12 的環境配置, 其他的我沒有嘗試過, 不好描述 我們需要的編譯的是 Android6.0, 所以我們需要 Xcode , Command L

關於Mac os gradle 編譯時報‘could not download gradle.jar…’的錯誤問題解決

報這個錯誤的主要原因是沒有對應的gradle的jar包 需要分別在目錄                 Users/apple /.gradle/wrapper/dists 和android studio的目錄     Android Studio.app/Contents