Git Product home page Git Product logo

klbvfs's Introduction

this is a proof-of-concept implementation of klab's encrypted sqlite3 vfs. it can be used to query encrypted databases in your /data/data/com.klab.lovelive.allstars/files/files directory

it assumes your directory structure is the same as it would be on your android device to extract your master key from shared_prefs . so you must dump your /data/data directory as is, or run this directly on your phone

usage

you need python3 and pip installed

if you have python venv:

python3 -m venv env
source env/bin/activate

then install dependencies

python3 -m pip install -r requirements.txt

now you can use it

./klbvfs.py query masterdata.db_* "select sql from sqlite_master;"
./klbvfs decrypt *.db_*.db
./klbvfs.py --help
./klbvfs.py dump [--types [[...]]] [directories [directories ...]]

this also registers a python codec for klbvfs which can be used to decrypt like so

key = sqlite_key('encrypted.db')
src = codecs.open('encrypted.db', mode='rb', encoding='klbvfs', errors=key)
dst = open('decrypted.db', 'wb+')
shutil.copyfileobj(src, dst)

future development

I'd like to actually make it dump all the pkg* files with correct names and directory structure. the mapping between virtual paths and pkg dirs is stored in these db's among other stuff

klbvfs's People

Contributors

francesco149 avatar hygn avatar

Stargazers

 avatar  avatar Bromine0x23 avatar Smilie Pop avatar Caret avatar Jacob Mintzer avatar  avatar  avatar  avatar  avatar  avatar TWY avatar  avatar

Watchers

James Cloos avatar  avatar  avatar  avatar  avatar

klbvfs's Issues

About errors upon decrypting files

First of all, thank you for your excellent work!
Using your script, I managed to decrypt my db files, but when I try to decrypt my files using -dump argument, it continuously spit out this error:

aesrfhha

Could you help me how to use the script properly..? Any help would be appreciated.
Best regards.

How to further

Thank you for your perfect work, I got the right *. DB now, but what should I do next to get PNG like you? I tried "Python klbvfs.py dump pkg0", it doesn't work -- please forgive my English, it comes from translation

Issue installing requirements

Sorry to bother you about this but I'm having an issue installing the apsw thats required. So I tried to install it myself by looking it up... but the script didn't recognize it so it didn't work either. I'm not sure how I'm supposed to fix this. Thank you in advance!!

the error log is too large for me to screen shot it so I copied it:

ERROR: Command errored out with exit status 1:
command: 'C:\Users\ \AppData\Local\Programs\Python\Python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\ \AppData\Local\Temp\pip-install-9ufcrch8\apsw\setup.py'"'"'; file='"'"'C:\Users\ \AppData\Local\Temp\pip-install-9ufcrch8\apsw\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record 'C:\Users\ \AppData\Local\Temp\pip-record-pg8w_xh0\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\ \AppData\Local\Programs\Python\Python38-32\Include\apsw'
cwd: C:\Users\ \AppData\Local\Temp\pip-install-9ufcrch8\apsw
Complete output (38 lines):
C:\Users\ \AppData\Local\Programs\Python\Python38-32\lib\site-packages\setuptools\dist.py:471: UserWarning: Normalizing '3.9.2-r1' to '3.9.2.post1'
warnings.warn(
running install
running build
running build_ext
SQLite: Using amalgamation C:\Users\ \AppData\Local\Temp\pip-install-9ufcrch8\apsw\sqlite3\sqlite3.c
building 'apsw' extension
creating build
creating build\temp.win32-3.8
creating build\temp.win32-3.8\Release
creating build\temp.win32-3.8\Release\src
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.27.29110\bin\HostX86\x86\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DEXPERIMENTAL=1 -DNDEBUG=1 -DAPSW_USE_SQLITE_AMALGAMATION="C:\Users\ \AppData\Local\Temp\pip-install-9ufcrch8\apsw\sqlite3\sqlite3.c" -DAPSW_USE_SQLITE_CONFIG="C:\Users\ \AppData\Local\Temp\pip-install-9ufcrch8\apsw\sqlite3\sqlite3config.h" -Isrc -IC:\Users\ \AppData\Local\Temp\pip-install-9ufcrch8\apsw\sqlite3 -IC:\Users\ \AppData\Local\Programs\Python\Python38-32\include -IC:\Users\ \AppData\Local\Programs\Python\Python38-32\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.27.29110\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" /Tcsrc/apsw.c /Fobuild\temp.win32-3.8\Release\src/apsw.obj
apsw.c
C:\Users\ \AppData\Local\Temp\pip-install-9ufcrch8\apsw\sqlite3\sqlite3.c(16538): warning C4013: 'localtime_r' undefined; assuming extern returning int
C:\Users\ \AppData\Local\Temp\pip-install-9ufcrch8\apsw\src\exceptions.c(177): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Users\ \AppData\Local\Temp\pip-install-9ufcrch8\apsw\src\exceptions.c(188): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Users\ \AppData\Local\Temp\pip-install-9ufcrch8\apsw\src\exceptions.c(193): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Users\ \AppData\Local\Temp\pip-install-9ufcrch8\apsw\src\util.c(340): warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Users\ \AppData\Local\Temp\pip-install-9ufcrch8\apsw\src\connection.c(1913): warning C4996: 'PyObject_CheckReadBuffer': deprecated in 3.0
C:\Users\ \AppData\Local\Temp\pip-install-9ufcrch8\apsw\src\connection.c(1917): warning C4996: 'PyObject_AsReadBuffer': deprecated in 3.0
C:\Users\ \AppData\Local\Temp\pip-install-9ufcrch8\apsw\src\blob.c(404): warning C4996: 'PyObject_AsWriteBuffer': deprecated in 3.0
C:\Users\ \AppData\Local\Temp\pip-install-9ufcrch8\apsw\src\blob.c(532): warning C4996: 'PyObject_CheckReadBuffer': deprecated in 3.0
C:\Users\ \AppData\Local\Temp\pip-install-9ufcrch8\apsw\src\blob.c(534): warning C4996: 'PyObject_AsReadBuffer': deprecated in 3.0
C:\Users\ \AppData\Local\Temp\pip-install-9ufcrch8\apsw\src\cursor.c(558): warning C4996: 'PyObject_CheckReadBuffer': deprecated in 3.0
C:\Users\ \AppData\Local\Temp\pip-install-9ufcrch8\apsw\src\cursor.c(564): warning C4996: 'PyObject_AsReadBuffer': deprecated in 3.0
C:\Users\ \AppData\Local\Temp\pip-install-9ufcrch8\apsw\src\vfs.c(638): warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Users\ \AppData\Local\Temp\pip-install-9ufcrch8\apsw\src\vfs.c(978): warning C4996: 'PyObject_AsReadBuffer': deprecated in 3.0
C:\Users\ \AppData\Local\Temp\pip-install-9ufcrch8\apsw\src\vfs.c(1881): warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Users\ \AppData\Local\Temp\pip-install-9ufcrch8\apsw\src\vfs.c(1987): warning C4996: 'PyObject_CheckReadBuffer': deprecated in 3.0
C:\Users\ \AppData\Local\Temp\pip-install-9ufcrch8\apsw\src\vfs.c(1992): warning C4996: 'PyObject_AsReadBuffer': deprecated in 3.0
C:\Users\ \AppData\Local\Temp\pip-install-9ufcrch8\apsw\src\vfs.c(2143): warning C4996: 'PyObject_AsReadBuffer': deprecated in 3.0
src/apsw.c(1112): warning C4996: 'PyObject_AsReadBuffer': deprecated in 3.0
creating C:\Users\ \AppData\Local\Temp\pip-install-9ufcrch8\apsw\build\lib.win32-3.8
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.27.29110\bin\HostX86\x86\link.exe /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:C:\Users\ \AppData\Local\Programs\Python\Python38-32\libs /LIBPATH:C:\Users\ \AppData\Local\Programs\Python\Python38-32\PCbuild\win32 "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.27.29110\lib\x86" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.18362.0\ucrt\x86" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.18362.0\um\x86" /EXPORT:PyInit_apsw build\temp.win32-3.8\Release\src/apsw.obj /OUT:build\lib.win32-3.8\apsw.cp38-win32.pyd /IMPLIB:build\temp.win32-3.8\Release\src\apsw.cp38-win32.lib
Creating library build\temp.win32-3.8\Release\src\apsw.cp38-win32.lib and object build\temp.win32-3.8\Release\src\apsw.cp38-win32.exp
apsw.obj : error LNK2001: unresolved external symbol _localtime_r
build\lib.win32-3.8\apsw.cp38-win32.pyd : fatal error LNK1120: 1 unresolved externals
error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.27.29110\bin\HostX86\x86\link.exe' failed with exit status 1120
----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\ \AppData\Local\Programs\Python\Python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\ \AppData\Local\Temp\pip-install-9ufcrch8\apsw\setup.py'"'"'; file='"'"'C:\Users\ \AppData\Local\Temp\pip-install-9ufcrch8\apsw\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record 'C:\Users\ \AppData\Local\Temp\pip-record-pg8w_xh0\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\ \AppData\Local\Programs\Python\Python38-32\Include\apsw' Check the logs for full command output.

What is going on, I used colab to decrypt the LLSIFAS file and there was an error

What is going on, I used colab to decrypt the LLSIFAS file and there was an error

/content/gdrive/MyDrive//klbvfs.py dump [--types [[/content/data/data/com.klab.lovelive.allstars/files]]] [directories [directories /content/gdrive/MyDrive/LLASSUIT]]

File "", line 1
content(/gdrive/MyDrive//klbvfs.py, dump, [--types, [[/content/data/data/com.klab.lovelive.allstars/files]]], [directories, [directories, /content/gdrive/MyDrive/LLASSUIT]])
^
SyntaxError: invalid syntax

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.