-
-
Save dpnishant/c7c6b47ebfd8cd671ecf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var func_sqlite3_prepare_v2 = Module.findExportByName('libsqlite3.dylib', 'sqlite3_prepare_v2'); | |
var func_sqlite3_sql = Module.findExportByName('libsqlite3.dylib', 'sqlite3_sql'); | |
var sqlite3_sql = new NativeFunction(func_sqlite3_sql, 'char', ['pointer']); | |
Interceptor.attach(func_sqlite3_prepare_v2, { | |
onEnter: function(args) { | |
var sqlite3_stmt = args[3]; | |
var output = sqlite3_sql(sqlite3_stmt); | |
console.log('SQL: ' + output); | |
}, | |
onLeave: function (retval) { | |
//console.log('Return Value: ' + Memory.readUtf8String(retval)); | |
} | |
}); |
Line 9 should be:
new NativeFunction(func_sqlite3_sql, 'char', ['pointer'])
Revised the script. Now works as expected. Thanks @riverar
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Signature of
sqlite3_prepare_v2()
// Doc: https://www.sqlite.org/c3ref/prepare.htmlSignature of
sqlite3_sql()
// Doc: http://www.sqlite.org/c3ref/sql.htmlconst char *sqlite3_sql(sqlite3_stmt *pStmt);
Question: I want to call the
sqlite3_sql()
method, from the loadedlibsqlite3.dylib
, by passing the 4th argument ofsqlite3_prepare_v2()
.But I'm getting the following error: