Accessing a sqlite ...
 
Notifications
Clear all

Accessing a sqlite database in UFED PA Python

13 Posts
3 Users
0 Reactions
2,923 Views
(@mattias1978)
Active Member
Joined: 14 years ago
Posts: 8
Topic starter  

Hi

I'm playing around a bit with the python interpreter inside UFED PA, and I would like to access a sqlite3 database, but I can’t figure out how I can load a sqlite module so that I get an interface to the sqlite3 database. Normally I would only import sqlite3 and Bobs your uncle. He does not seem to want to be even remotely related to me when we are inside the python interpreter, any tips? I have read the python help without getting any wiser.

Thanks
Mattias


   
Quote
(@alexc)
Reputable Member
Joined: 16 years ago
Posts: 301
 

Are you just getting the standard ImportError exception or something more obscure?


   
ReplyQuote
(@mattias1978)
Active Member
Joined: 14 years ago
Posts: 8
Topic starter  

Traceback (most recent call last)
File "<string>", line 1, in <module>
File "C\Program Files\Cellebrite Mobile Synchronization\UFED Physical Analyzer\PyLib\physical\pylib.py", line 93, in find_module
IOError System.IO.IOException Could not add reference to assembly sqlite3
at Microsoft.Scripting.Actions.Calls.MethodCandidate.Caller.Call(Object[] args, Boolean& shouldOptimize)
at System.Dynamic.UpdateDelegates.UpdateAndExecute3[T0,T1,T2,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2)
at find_module$4226(Closure , PythonFunction , Object , Object , Object )
at IronPython.Runtime.PythonFunction.FunctionCaller`3.Call3(CallSite site, CodeContext context, Object func, T0 arg0, T1 arg1, T2 arg2)
at CallSite.Target(Closure , CallSite , CodeContext , Object , Object , Object )
at IronPython.Runtime.Importer.FindAndLoadModuleFromImporter(CodeContext context, Object importer, String fullName, List path, Object& ret)
at IronPython.Runtime.Importer.TryLoadMetaPathModule(CodeContext context, String fullName, List path, Object& ret)
at IronPython.Runtime.Importer.ImportTopAbsolute(CodeContext context, String name)
at IronPython.Runtime.Importer.ImportModule(CodeContext context, Object globals, String modName, Boolean bottom, Int32 level)
at IronPython.Modules.Builtin.__import__(CodeContext context, String name, Object globals, Object locals, Object fromlist, Int32 level)
at IronPython.Runtime.Importer.Import(CodeContext context, String fullName, PythonTuple from, Int32 level)
at Microsoft.Scripting.Utils.InvokeHelper`4.Invoke(Object arg0, Object arg1, Object arg2)
at Microsoft.Scripting.Interpreter.CallInstruction.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.Interpreter.RunInstructions(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet](T0 arg0, T1 arg1)
at IronPython.Compiler.PythonScriptCode.RunWorker(CodeContext ctx)
at IronPython.Compiler.RuntimeScriptCode.InvokeTarget(Scope scope)
at WPFComponents.PythonShell.Language.CodeExecuter.ExecuteCode(Object codeRangeObj)


   
ReplyQuote
(@alexc)
Reputable Member
Joined: 16 years ago
Posts: 301
 

Wierd, looks like it couldn't find the module, it could be that it's not part of IronPython's standard library or it's not looking in the right place for other modules. Can you import the… json module for example?

import json
I'd refer this to the guys at CelleBrite, or PM RonS on this board because I don't think you're doing anything wrong per se, but the setup is probably different.


   
ReplyQuote
(@mattias1978)
Active Member
Joined: 14 years ago
Posts: 8
Topic starter  

import json works fine.

I have tested multiple installations of PA and they all seem to have the same error.


   
ReplyQuote
(@alexc)
Reputable Member
Joined: 16 years ago
Posts: 301
 

Heh, gotta assume that sqlite3 isn't in the IronPython standard library then I guess. It does sort of make sense as it relies heavily on the native (written in C) sqlite library. That being said you should be able to use the .NET library instead - but that's not nearly as fun to use as sqlite3…

Oh wait - http//blog.jdhardy.ca/2010/05/ironpython-sqlite-and-zlib.html

try

import IronPython.SQLite as sqlite3
Does that work?


   
ReplyQuote
(@mattias1978)
Active Member
Joined: 14 years ago
Posts: 8
Topic starter  

Nopp
returns following error.
Traceback (most recent call last)
File "<string>", line 1, in <module>
ImportError No module named SQLite


   
ReplyQuote
(@mattias1978)
Active Member
Joined: 14 years ago
Posts: 8
Topic starter  

The strange thing is that I get a different error message when trying to import sqlite3 then if I try to import kallekula which is a module that definitely don’t exist.


   
ReplyQuote
(@alexc)
Reputable Member
Joined: 16 years ago
Posts: 301
 

Well, I'm out of ideas - please let me know what the folks at Cellebrite come up with!


   
ReplyQuote
 RonS
(@rons)
Reputable Member
Joined: 17 years ago
Posts: 358
 

I have asked someone from R&D to help with this


   
ReplyQuote
Page 1 / 2
Share: