Giter Club home page Giter Club logo

sqlitebrowser's Introduction

sqlitebrowser

可以打开微信(7.0.4)EnMicroMsg.db的sqlitebrowser

Download DB Browser for SQLCipher.7z

基于https://github.com/sqlitebrowser/sqlitebrowser/tree/50c1f46bdbbefaadee01b0674b9cf237eaff5052编译。

主要patch代码是PRAGMA参数的顺序。

diff --git a/src/sqlitedb.cpp b/src/sqlitedb.cpp                                                                                                                                   
index f7bfc2dd..166206ca 100644                                                                                                                                                    
--- a/src/sqlitedb.cpp                                                                                                                                                             
+++ b/src/sqlitedb.cpp                                                                                                                                                             
@@ -166,11 +166,15 @@ bool DBBrowserDB::open(const QString& db, bool readOnly)                                                                                                     
 #ifdef ENABLE_SQLCIPHER                                                                                                                                                           
     if(isEncrypted && cipherSettings)                                                                                                                                             
     {                                                                                                                                                                             
-        executeSQL(QString("PRAGMA key = %1").arg(cipherSettings->getPassword()), false, false);                                                                                  
-        executeSQL(QString("PRAGMA cipher_page_size = %1;").arg(cipherSettings->getPageSize()), false, false);                                                                    
-        executeSQL(QString("PRAGMA kdf_iter = %1;").arg(cipherSettings->getKdfIterations()), false, false);                                                                       
-        executeSQL(QString("PRAGMA cipher_hmac_algorithm = %1;").arg(cipherSettings->getHmacAlgorithm()), false, false);                                                          
-        executeSQL(QString("PRAGMA cipher_kdf_algorithm = %1;").arg(cipherSettings->getKdfAlgorithm()), false, false);                                                            
+        //executeSQL(QString("PRAGMA key = %1").arg(cipherSettings->getPassword()), false, false);                                                                                
+        //executeSQL(QString("PRAGMA cipher_page_size = %1;").arg(cipherSettings->getPageSize()), false, false);                                                                  
+        //executeSQL(QString("PRAGMA kdf_iter = %1;").arg(cipherSettings->getKdfIterations()), false, false);                                                                     
+        //executeSQL(QString("PRAGMA cipher_hmac_algorithm = %1;").arg(cipherSettings->getHmacAlgorithm()), false, false);                                                        
+        //executeSQL(QString("PRAGMA cipher_kdf_algorithm = %1;").arg(cipherSettings->getKdfAlgorithm()), false, false);                                                          
+               executeSQL(QString("PRAGMA cipher_default_kdf_iter = 4000;"), false, false);                                                                                       
+               executeSQL(QString("PRAGMA key = %1").arg(cipherSettings->getPassword()), false, false);                                                                           
+               executeSQL(QString("PRAGMA cipher_use_hmac = OFF;"), false, false);                                                                                                
+               executeSQL(QString("PRAGMA cipher_page_size = 1024;"), false, false);                                                                                              
     }                                                                                                                                                                             
 #endif                                                                                                                                                                            
     delete cipherSettings;                                                                                                                                                        
@@ -463,19 +467,22 @@ bool DBBrowserDB::tryEncryptionSettings(const QString& filePath, bool* encrypted                                                                             
                 cipherSettings = nullptr;                                                                                                                                         
                 return false;                                                                                                                                                     
             }                                                                                                                                                                     
-                                                                                                                                                                                  
+                                                                                                                                                                                  
+                       sqlite3_exec(dbHandle, QString("PRAGMA cipher_default_kdf_iter = 4000").toUtf8(), nullptr, nullptr, nullptr);                                              
             // Set the key                                                                                                                                                        
             sqlite3_exec(dbHandle, QString("PRAGMA key = %1").arg(cipherSettings->getPassword()).toUtf8(), nullptr, nullptr, nullptr);                                            
+                       sqlite3_exec(dbHandle, QString("PRAGMA cipher_use_hmac = OFF").toUtf8(), nullptr, nullptr, nullptr);                                                       
+                       sqlite3_exec(dbHandle, QString("PRAGMA cipher_page_size = 1024").toUtf8(), nullptr, nullptr, nullptr);                                                     
                                                                                                                                                                                   
             // Set the page size if it differs from the default value                                                                                                             
-            if(cipherSettings->getPageSize() != enc_default_page_size)                                                                                                            
-                sqlite3_exec(dbHandle, QString("PRAGMA cipher_page_size = %1;").arg(cipherSettings->getPageSize()).toUtf8(), nullptr, nullptr, nullptr);                          
-            if(cipherSettings->getKdfIterations() != enc_default_kdf_iter)                                                                                                        
-                sqlite3_exec(dbHandle, QString("PRAGMA kdf_iter = %1;").arg(cipherSettings->getKdfIterations()).toUtf8(), nullptr, nullptr, nullptr);                             
-            if(cipherSettings->getHmacAlgorithm() != enc_default_hmac_algorithm)                                                                                                  
-                sqlite3_exec(dbHandle, QString("PRAGMA cipher_hmac_algorithm = %1;").arg(cipherSettings->getHmacAlgorithm()).toUtf8(), nullptr, nullptr, nullptr);                
-            if(cipherSettings->getKdfAlgorithm() != enc_default_kdf_algorithm)                                                                                                    
-                sqlite3_exec(dbHandle, QString("PRAGMA cipher_kdf_algorithm = %1;").arg(cipherSettings->getKdfAlgorithm()).toUtf8(), nullptr, nullptr, nullptr);                  
+            //if(cipherSettings->getPageSize() != enc_default_page_size)                                                                                                          
+            //    sqlite3_exec(dbHandle, QString("PRAGMA cipher_page_size = %1;").arg(cipherSettings->getPageSize()).toUtf8(), nullptr, nullptr, nullptr);                        
+            //if(cipherSettings->getKdfIterations() != enc_default_kdf_iter)                                                                                                      
+            //    sqlite3_exec(dbHandle, QString("PRAGMA kdf_iter = %1;").arg(cipherSettings->getKdfIterations()).toUtf8(), nullptr, nullptr, nullptr);                           
+            //if(cipherSettings->getHmacAlgorithm() != enc_default_hmac_algorithm)                                                                                                
+            //    sqlite3_exec(dbHandle, QString("PRAGMA cipher_hmac_algorithm = %1;").arg(cipherSettings->getHmacAlgorithm()).toUtf8(), nullptr, nullptr, nullptr);              
+            //if(cipherSettings->getKdfAlgorithm() != enc_default_kdf_algorithm)                                                                                                  
+            //    sqlite3_exec(dbHandle, QString("PRAGMA cipher_kdf_algorithm = %1;").arg(cipherSettings->getKdfAlgorithm()).toUtf8(), nullptr, nullptr, nullptr);                
                                                                                                                                                                                   
             *encrypted = true;                                                                                                                                                    
 #else                                                                                                                                                                             

sqlitebrowser's People

Contributors

lasting-yang avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.