Git Product home page Git Product logo

ceb2txt's Introduction

ceb2txt

A small tool that can convert ceb (Conversations Encrypted Backup) files to simple plain text.

Prebuild binaries

You can find binaries that only need the Java Runtime Enviroment (JRE) to run in the release section of this project.

Compile

mvn package

Usage

java -jar target/im.conversations.ceb2txt-0.1.jar /path/to/file.ceb

ceb2txt's People

Contributors

dependabot[bot] avatar inputmice avatar moppman avatar rflexor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ceb2txt's Issues

Exception: String must not be empty after applying the rules.

Conversations 2.9.13+fcr created a CEB file that, when opened by ceb2txt 0.1.0 causes the following exception:

Exception in thread "main" java.lang.IllegalArgumentException: String must not be empty after applying the rules.
	at rocks.xmpp.precis.OpaqueStringProfile.enforce(OpaqueStringProfile.java:47)
	at rocks.xmpp.addr.FullJid.<init>(FullJid.java:131)
	at rocks.xmpp.addr.FullJid.of(FullJid.java:230)
	at rocks.xmpp.addr.Jid.of(Jid.java:160)
	at im.conversations.ceb2txt.entities.Message.getCounterpart(Message.java:115)
	at im.conversations.ceb2txt.Main.main(Main.java:151)

Cannot decrypt CEB file created by version 2.12.1

It used to work fine with backups until 2.10.10.

This is the output when attempting to open a CEB file created by 2.12.1+free (F-Droid).

Exception in thread "main" org.sql2o.Sql2oException: Error preparing statement - [SQLITE_ERROR] SQL error or missing database (table accounts has no column named pinned_mechanism) at org.sql2o.Query.buildPreparedStatement(Query.java:439) at org.sql2o.Query.buildPreparedStatement(Query.java:421) at org.sql2o.Query.executeUpdate(Query.java:652) at im.conversations.ceb2txt.Main.main(Main.java:140) Caused by: org.sqlite.SQLiteException: [SQLITE_ERROR] SQL error or missing database (table accounts has no column named pinned_mechanism) at org.sqlite.core.DB.newSQLException(DB.java:1030) at org.sqlite.core.DB.newSQLException(DB.java:1042) at org.sqlite.core.DB.throwex(DB.java:1007) at org.sqlite.core.NativeDB.prepare_utf8(Native Method) at org.sqlite.core.NativeDB.prepare(NativeDB.java:137) at org.sqlite.core.DB.prepare(DB.java:257) at org.sqlite.core.CorePreparedStatement.<init>(CorePreparedStatement.java:45) at org.sqlite.jdbc3.JDBC3PreparedStatement.<init>(JDBC3PreparedStatement.java:30) at org.sqlite.jdbc4.JDBC4PreparedStatement.<init>(JDBC4PreparedStatement.java:25) at org.sqlite.jdbc4.JDBC4Connection.prepareStatement(JDBC4Connection.java:35) at org.sqlite.jdbc3.JDBC3Connection.prepareStatement(JDBC3Connection.java:241) at org.sqlite.jdbc3.JDBC3Connection.prepareStatement(JDBC3Connection.java:205) at org.sqlite.jdbc3.JDBC3Connection.prepareStatement(JDBC3Connection.java:214) at org.sql2o.Query.buildPreparedStatement(Query.java:434) ... 3 more

The reference to pinned_mechanism is found in parts of code that changed in recent versions, e.g. this line in src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java:
Account.PINNED_MECHANISM + " TEXT,"

Prebuild binaries

Some people don't have a JDK installed and also don't have maven set up etc. would be cool to have some kind of prebuild binaries for them....

does not seem to be a valid backup file

When I run "java -jar target/im.conversations.ceb2txt-0.1.jar test.ceb' in ubuntu20, it shows "/home/jkl/document/test.ceb does not seem to be a valid backup file"
2021-06-30 10-32-10屏幕截图

NullPointerException in Message.getCounterpart

I get multiple null pointer exceptions when decrypting my backup:

Exception in thread "main" java.lang.NullPointerException
	at org.jxmpp.jid.impl.JidCreate.from(JidCreate.java:177)
	at org.jxmpp.jid.impl.JidCreate.fromOrNull(JidCreate.java:220)
	at im.conversations.ceb2txt.entities.Message.getCounterpart(Message.java:124)
	at im.conversations.ceb2txt.Main.main(Main.java:199)

Sounds like #14 is related. The corresponding counterpart string in Message leading to the exceptions were in my case either null or [email protected]/. These were the corresponding messages generated in the output when catching the exception and setting nick to NULLPOINTEREXCEPTION:

./group/[email protected]/2017-06-26.txt:23:23 NULLPOINTEREXCEPTION -> [file received over P2P (Jingle)]
./group/[email protected]/2017-06-26.txt:23:24 NULLPOINTEREXCEPTION -> [file received over P2P (Jingle)]
./group/[email protected]/2017-06-22.txt:08:15 NULLPOINTEREXCEPTION -> [file received over P2P (Jingle)]
./group/[email protected]/2017-06-18.txt:21:05 NULLPOINTEREXCEPTION -> [file received over P2P (Jingle)]
./group/[email protected]/2023-05-05.txt:03:26 NULLPOINTEREXCEPTION <- dam spammers
./group/[email protected]/2021-05-23.txt:16:30 NULLPOINTEREXCEPTION <- 
./group/[email protected]/2021-05-23.txt:16:30 NULLPOINTEREXCEPTION <- 
./group/[email protected]/2021-05-23.txt:16:30 NULLPOINTEREXCEPTION <- 
./group/[email protected]/2021-05-23.txt:16:30 NULLPOINTEREXCEPTION <- 
./group/[email protected]/2021-05-23.txt:16:30 NULLPOINTEREXCEPTION <- 
./group/[email protected]/2021-05-23.txt:16:31 NULLPOINTEREXCEPTION <- 
./group/[email protected]/2021-05-23.txt:16:31 NULLPOINTEREXCEPTION <- Www.google.com
./group/[email protected]/2021-05-23.txt:16:32 NULLPOINTEREXCEPTION <- 䕂住䬠                                          
./group/[email protected]/2021-05-23.txt:16:32 NULLPOINTEREXCEPTION <- 䕂住䬠
./group/[email protected]/2021-05-23.txt:16:32 NULLPOINTEREXCEPTION <- 䕂住䬠
./group/[email protected]/2021-05-23.txt:16:32 NULLPOINTEREXCEPTION <- 䕂住䬠
./group/[email protected]/2021-05-23.txt:16:32 NULLPOINTEREXCEPTION <- 䕂住䬠
./group/[email protected]/2021-05-23.txt:16:32 NULLPOINTEREXCEPTION <- 䕂住䬠

A proper fix should be proposed by a more knowledgeable person.

JCE cannot authenticate the provider Conscrypt

Versions

Java Runtime Environment 1.8.0_271-b09 (x64)
Conversations 2.9.0+fcr (via Google Play)
Android 10

Problem

I've created a backup with Conversations on my smartphone. Now I'm trying to export the chat messages into plain text files using your nice helper tool. Unfortunately, it fails with the following error after entering the password:

java -jar im.conversations.ceb2txt-0.1.jar [email protected]
Enter password for [email protected]:
Exception in thread "main" java.lang.SecurityException: JCE cannot authenticate the provider Conscrypt
        at javax.crypto.Cipher.getInstance(Cipher.java:660)
        at im.conversations.ceb2txt.Main.main(Main.java:68)
Caused by: java.util.jar.JarException: file:/C:/temp/im.conversations.ceb2txt-0.1.jar has unsigned entries - im/conversations/ceb2txt/entities/Message$FileParams.class
        at javax.crypto.JarVerifier.verifySingleJar(JarVerifier.java:510)
        at javax.crypto.JarVerifier.verifyJars(JarVerifier.java:371)
        at javax.crypto.JarVerifier.verify(JarVerifier.java:297)
        at javax.crypto.JceSecurity.verifyProviderJar(JceSecurity.java:164)
        at javax.crypto.JceSecurity.getVerificationResult(JceSecurity.java:190)
        at javax.crypto.Cipher.getInstance(Cipher.java:656)
        ... 1 more

I've doublechecked the password and created a new backup file - the problem persists.

Do you have any ideas about that? Thank you!

ClassNotFoundException

On raspberry pi

cd target
java -jar im.conversations.ceb2txt-0.1.jar fi.ceb

shows an error:
Fehler: Hauptklasse im.conversations.ceb2txt.Main konnte nicht gefunden oder geladen werden.
Ursache: java.lang.ClassNotFoundException: im.conversations.ceb2txt.Main

I don't know how to handle this, no experience with java,
thank you for any hints

malformed input around byte 25

java.io.UTFDataFormatException: malformed input around byte 25
at java.io.DataInputStream.readUTF(DataInputStream.java:656)
at java.io.DataInputStream.readUTF(DataInputStream.java:564)
at im.conversations.ceb2txt.BackupFileHeader.read(BackupFileHeader.java:53)
at im.conversations.ceb2txt.Main.main(Main.java:62)
C:\Users\Administrator\Desktop\111\1.ceb does not seem to be a valid backup file

Latest binary no longer works

Export made with Conversations 2.12.6+free. openjdk-8,11,17,18,19-jre-headless fail to extract on Ubuntu 22.04 (Trisquel 11). Output for openjdk-19-jre-headlesss looks like this:

$ java -jar im.conversations.ceb2txt-0.1.jar REDACTED.ceb
Enter password for REDACTED:                                                                                                                                                           
Exception in thread "main" org.sql2o.Sql2oException: Error preparing statement - [SQLITE_ERROR] SQL error or missing database (table accounts has no column named pinned_mechanism)
        at org.sql2o.Query.buildPreparedStatement(Query.java:439)
        at org.sql2o.Query.buildPreparedStatement(Query.java:421)
        at org.sql2o.Query.executeUpdate(Query.java:652)
        at im.conversations.ceb2txt.Main.main(Main.java:115)
Caused by: org.sqlite.SQLiteException: [SQLITE_ERROR] SQL error or missing database (table accounts has no column named pinned_mechanism)
        at org.sqlite.core.DB.newSQLException(DB.java:1010)
        at org.sqlite.core.DB.newSQLException(DB.java:1022)
        at org.sqlite.core.DB.throwex(DB.java:987)
        at org.sqlite.core.NativeDB.prepare_utf8(Native Method)
        at org.sqlite.core.NativeDB.prepare(NativeDB.java:134)
        at org.sqlite.core.DB.prepare(DB.java:264)
        at org.sqlite.core.CorePreparedStatement.<init>(CorePreparedStatement.java:45)
        at org.sqlite.jdbc3.JDBC3PreparedStatement.<init>(JDBC3PreparedStatement.java:30)
        at org.sqlite.jdbc4.JDBC4PreparedStatement.<init>(JDBC4PreparedStatement.java:19)
        at org.sqlite.jdbc4.JDBC4Connection.prepareStatement(JDBC4Connection.java:35)
        at org.sqlite.jdbc3.JDBC3Connection.prepareStatement(JDBC3Connection.java:241)
        at org.sqlite.jdbc3.JDBC3Connection.prepareStatement(JDBC3Connection.java:205)
        at org.sqlite.jdbc3.JDBC3Connection.prepareStatement(JDBC3Connection.java:214)
        at org.sql2o.Query.buildPreparedStatement(Query.java:434)
        ... 3 more

The solution is to make a new release with the latest commit or build with maven.

git clone https://github.com/iNPUTmice/ceb2txt
cd ceb2txt
sudo apt update
sudo apt install -y openjdk-19-jre-headless openjdk-19-jdk-headless maven sqlite3 # Not sure if all of these are required, but these were the changes I made.
unset JAVA_HOME
mvn package
cd ..
java -jar ceb2txt/target/im.conversations.ceb2txt-0.1.jar REDACTED.ceb

Output is for last command looks like this:

Enter password for REDACTED:
24 conversations have been written to REDACTED/*/*.txt

Can only extract small amount of backup

I have a backup from 20230406 to 20230714
After using the ceb2txt and type in the password, it shows the error message:

Exception in thread "main" java.lang.IllegalArgumentException: String must not be empty after applying the rules.
	at rocks.xmpp.precis.OpaqueStringProfile.enforce(OpaqueStringProfile.java:47)
	at rocks.xmpp.addr.FullJid.<init>(FullJid.java:131)
	at rocks.xmpp.addr.FullJid.of(FullJid.java:230)
	at rocks.xmpp.addr.Jid.of(Jid.java:160)
	at im.conversations.ceb2txt.entities.Message.getCounterpart(Message.java:123)
	at im.conversations.ceb2txt.Main.main(Main.java:196)

After that I open the folder and I can only see the backup from 2023-04-06.txt to 2023-05-04.txt of group/[email protected], no other backup from other group and 1on1 is extracted.
The file 2023-05-05.txt in group/[email protected] is empty, and no more file extracted after 2023-05-05.

ceb2txt fails on exotic MUC nickname

Hello,
I report here as a corner case; i applied the tool on a .ceb file and it fails to complete, with this error:

Exception in thread "main" rocks.xmpp.precis.InvalidCodePointException: Invalid code point at position 1: 0x3031
	at rocks.xmpp.precis.PrecisProfile.prepare(PrecisProfile.java:669)
	at rocks.xmpp.precis.PrecisProfile.enforce(PrecisProfile.java:690)
	at rocks.xmpp.precis.OpaqueStringProfile.enforce(OpaqueStringProfile.java:43)
	at rocks.xmpp.addr.FullJid.<init>(FullJid.java:131)
	at rocks.xmpp.addr.FullJid.of(FullJid.java:230)
	at rocks.xmpp.addr.Jid.of(Jid.java:160)
	at im.conversations.ceb2txt.entities.Message.getCounterpart(Message.java:123)
	at im.conversations.ceb2txt.Main.main(Main.java:195)

Decrypting the cab file with ceb2sqlgz i found that the failure happens at this point in the file (hexdump):

03e323d0  32 34 30 30 30 2c 27 23  6d 6f 6e 69 74 6f 72 61  |24000,'#monitora|
03e323e0  2d 70 61 23 6d 61 74 72  69 78 2e 6f 70 65 6e 63  |-pa#matrix.openc|
03e323f0  6c 6f 75 64 2e 6c 75 40  61 72 69 61 2d 6e 65 74  |loud.lu@aria-net|
03e32400  2e 6f 72 67 2f e2 b4 b1  e3 80 b1 e3 84 ad e2 80  |.org/...........|
03e32410  b2 20 e2 b4 b1 e3 80 b1  e3 84 ad e2 80 b2 e2 b4  |. ..............|
03e32420  b1 e3 80 b1 e3 84 ad e2  80 b2 20 e2 b4 b1 e3 80  |.......... .....|
03e32430  b1 e3 84 ad e2 80 b2 e2  b4 b1 e3 80 b1 e2 b4 b1  |................|
03e32440  e3 80 b1 e3 84 ad e2 80  b2 20 e2 b4 b1 e3 80 b1  |......... ......|
03e32450  e3 84 ad e2 80 b2 e2 b4  b1 e3 80 b1 e3 84 ad e2  |................|
03e32460  80 b2 20 e2 b4 b1 e3 80  b1 e3 84 ad e2 80 b2 e2  |.. .............|
03e32470  b4 b1 e3 80 b1 e2 b4 b1  e3 80 b1 e3 84 ad e2 80  |................|
03e32480  b2 20 e2 b4 b1 e3 80 b1  e3 84 ad e2 80 b2 e2 b4  |. ..............|
03e32490  b1 e3 80 b1 e3 84 ad e2  80 b2 20 e2 b4 b1 e3 80  |.......... .....|
03e324a0  b1 e3 84 ad e2 80 b2 e2  b4 b1 e3 80 b1 e3 84 ad  |................|
03e324b0  e2 80 b2 e2 80 b2 e2 80  b2 27 2c 4e 55 4c 4c 2c  |.........',NULL,|

When trying to decode the sender of a message from a matrix via XMPP bridge, with shows as follows:

Screenshot_20220810-111459_Trebuchet_1

Redacting the nick and reencrypting with sql2ceb got rid of the error.

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.