Giter Club home page Giter Club logo

signal-backup-decode's People

Contributors

backspac avatar mutlusun avatar pajowu avatar sburris0 avatar xduugu avatar

Stargazers

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

Watchers

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

signal-backup-decode's Issues

Build Fail

Hi, thanks for creating this project. This is spelled "program", by the way.
This repository contains a small programm to decode a backup produced by Signal Android.

Quite frankly, I have no idea what I'm doing or have any experience in rust, and I've just had some (probably rookie) errors that I don't quite understand how to solve. When, I try to build, this happens.

C:\Users\Batman>cargo install signal-backup-decode
Updating crates.io index
Installing signal-backup-decode v0.2.3
Compiling autocfg v1.0.1
Compiling winapi v0.3.9
Compiling cfg-if v1.0.0
Compiling proc-macro2 v1.0.26
Compiling version_check v0.9.3
Compiling unicode-xid v0.2.2
Compiling typenum v1.13.0
Compiling pkg-config v0.3.19
Compiling libc v0.2.94
Compiling vcpkg v0.2.12
Compiling syn v1.0.72
Compiling getrandom v0.2.2
Compiling serde_derive v1.0.125
Compiling memchr v2.4.0
Compiling serde v1.0.125
Compiling ahash v0.4.7
Compiling ppv-lite86 v0.2.10
Compiling bitflags v1.2.1
Compiling cc v1.0.67
Compiling unicode-width v0.1.8
Compiling lazy_static v1.4.0
Compiling log v0.4.14
Compiling byteorder v1.4.3
Compiling ryu v1.0.5
Compiling regex-syntax v0.6.25
Compiling subtle v2.4.0
Compiling anyhow v1.0.40
Compiling encode_unicode v0.3.6
Compiling protobuf v2.22.1
Compiling foreign-types-shared v0.1.1
Compiling openssl v0.10.34
Compiling number_prefix v0.3.0
Compiling smallvec v1.6.1
Compiling strsim v0.8.0
Compiling opaque-debug v0.3.0
Compiling cpufeatures v0.1.1
Compiling itoa v0.4.7
Compiling fallible-iterator v0.2.0
Compiling vec_map v0.8.2
Compiling once_cell v1.7.2
Compiling signal-backup-decode v0.2.3
Compiling cfg-if v0.1.10
Compiling fallible-streaming-iterator v0.1.9
Compiling infer v0.3.7
Compiling hashbrown v0.9.1
Compiling generic-array v0.14.4
Compiling num-traits v0.2.14
Compiling num-integer v0.1.44
Compiling textwrap v0.11.0
Compiling foreign-types v0.3.2
Compiling regex-automata v0.1.9
Compiling hashlink v0.6.0
Compiling rand_core v0.6.2
Compiling libsqlite3-sys v0.20.1
Compiling regex v1.5.4
Compiling rand_chacha v0.3.0
Compiling csv-core v0.1.10
Compiling quote v1.0.9
Compiling rand v0.8.3
Compiling openssl-sys v0.9.63
Compiling rusqlite v0.24.2
Compiling digest v0.9.0
Compiling crypto-mac v0.10.0
Compiling block-buffer v0.9.0
Compiling dlv-list v0.2.3
Compiling hmac v0.10.1
Compiling sha2 v0.9.4
Compiling hkdf v0.10.0
Compiling ordered-multimap v0.3.1
error: failed to run custom build command for openssl-sys v0.9.63

Caused by:
process didn't exit successfully: C:\Users\Batman\AppData\Local\Temp\cargo-installtOQDxw\release\build\openssl-sys-2a237ba60393ffc1\build-script-main (exit code: 101)
--- stdout
cargo:rustc-cfg=const_fn
cargo:rerun-if-env-changed=X86_64_PC_WINDOWS_MSVC_OPENSSL_LIB_DIR
X86_64_PC_WINDOWS_MSVC_OPENSSL_LIB_DIR unset
cargo:rerun-if-env-changed=OPENSSL_LIB_DIR
OPENSSL_LIB_DIR unset
cargo:rerun-if-env-changed=X86_64_PC_WINDOWS_MSVC_OPENSSL_INCLUDE_DIR
X86_64_PC_WINDOWS_MSVC_OPENSSL_INCLUDE_DIR unset
cargo:rerun-if-env-changed=OPENSSL_INCLUDE_DIR
OPENSSL_INCLUDE_DIR unset
cargo:rerun-if-env-changed=X86_64_PC_WINDOWS_MSVC_OPENSSL_DIR
X86_64_PC_WINDOWS_MSVC_OPENSSL_DIR unset
cargo:rerun-if-env-changed=OPENSSL_DIR
OPENSSL_DIR unset
note: vcpkg did not find openssl: Could not find Vcpkg tree: No vcpkg installation found. Set the VCPKG_ROOT environment variable or run 'vcpkg integrate install'

--- stderr
thread 'main' panicked at '

Could not find directory of OpenSSL installation, and this -sys crate cannot
proceed without this knowledge. If OpenSSL is installed and this crate had
trouble finding it, you can set the OPENSSL_DIR environment variable for the
compilation process.

Make sure you also have the development packages of openssl installed.
For example, libssl-dev on Ubuntu or openssl-devel on Fedora.

If you're in a situation where you think the directory should be found
automatically, please open a bug at https://github.com/sfackler/rust-openssl
and include information about your system as well as this message.

$HOST = x86_64-pc-windows-msvc
$TARGET = x86_64-pc-windows-msvc
openssl-sys = 0.9.63

It looks like you're compiling for MSVC but we couldn't detect an OpenSSL
installation. If there isn't one installed then you can try the rust-openssl
README for more information about how to download precompiled binaries of
OpenSSL:

https://github.com/sfackler/rust-openssl#windows

', C:\Users\Batman.cargo\registry\src\github.com-1ecc6299db9ec823\openssl-sys-0.9.63\build\find_normal.rs:174:5
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: failed to compile signal-backup-decode v0.2.3, intermediate artifacts can be found at C:\Users\Batman\AppData\Local\Temp\cargo-installtOQDxw

Caused by:
build failed

This is on windows 10. Sorry to bother you, I'd be very thankful for assistance.

Read problem

Hello
I have problem with read data.
To this time I used signal-backup-decode 0.1.5. I readed backup and in table messages is 30000 records and 2500 readed attachments.
At new system i install 0.2.3 and from the same backup in table mms i have 6400 records and 440 attachment.
Whats wrong with that?

frame with unsupported number of fields

I cloned the git repo and built the app. When running, it ran through many frames but then ended with an error. It wrote a 0 byte db file, but the attachment folder had many correct multimedia files. Here is the error it gave:

Database Version: 39d 1 frames, 0 attachments, 54 bytes into file
thread 'main' panicked at 'Frame with an unsupported number of fields found, please report to author: ', src/main.rs:184:4
stack backtrace:
0: 0x55c89a6f5ac1 - std::sys_common::backtrace::print::hc37753fd01765e69
1: 0x55c89a6fb132 - std::panicking::default_hook::{{closure}}::h827f84ab19d3ba68
2: 0x55c89a6faec3 - std::panicking::default_hook::h7a61e2fabd403e6d
3: 0x55c89a6fb7c0 - std::panicking::rust_panic_with_hook::hdf58d8a3e45412d2
4: 0x55c89a6fb352 - std::panicking::continue_panic_fmt::hf338451f3b80117e
5: 0x55c89a6fb29f - std::panicking::begin_panic_fmt::h340a50431228f96f
6: 0x55c89a17eec9 - signal_backup_decode::decode_backup::h9a5a2fccc46de4c9
at src/main.rs:184
7: 0x55c89a149489 - signal_backup_decode::main::h4431f494941a0f5d
at src/main.rs:421
8: 0x55c89a14a832 - std::rt::lang_start::{{closure}}::hac4be1922d26fad6
at /usr/src/rustc-1.37.0/src/libstd/rt.rs:64
9: 0x55c89a6fb1d3 - std::panicking::try::do_call::h78186ff532cc12a3
10: 0x55c89a6fc78a - __rust_maybe_catch_panic
11: 0x55c89a6ef919 - std::rt::lang_start_internal::h54a47c0b3c8d65e6
12: 0x55c89a14a7f9 - std::rt::lang_start::hee63aa837b8b929d
at /usr/src/rustc-1.37.0/src/libstd/rt.rs:64
13: 0x55c89a14a71a - main
14: 0x7f10591ff1e3 - __libc_start_main
15: 0x55c89a10535e - _start
16: 0x0 -

Thanks for the help.

error[E0063]: missing field `customize` in initializer of `protoc_rust::Args<'_>`

Hi there,

Thank you for developing and offering a tool to export Signal backups!

Unfortunately, I get the error below when trying to compile/install it. My system is an Ubuntu 16.04. I installed protobuf-compiler in version 2.6.1-1.3.
I also tried to compile it on a Windows 10 machine, which leads to the same error.

Probably, I just made some minor mistake. But since I have no experience in Rust development, I would appreciate any help to solve this issue! Thanks a lot! :)

~$ cargo install signal-backup-decode
    Updating registry `https://github.com/rust-lang/crates.io-index`
  Installing signal-backup-decode v0.1.1                                        
   Compiling bitflags v1.0.3
   Compiling hex v0.3.2
   Compiling rust-ini v0.11.0
   Compiling strsim v0.7.0
   Compiling byteorder v1.2.3
   Compiling ansi_term v0.11.0
   Compiling unicode-width v0.1.4
   Compiling protobuf v1.6.0
   Compiling rustc-demangle v0.1.8
   Compiling lazy_static v1.0.0
   Compiling foreign-types-shared v0.1.1
   Compiling gcc v0.3.54
   Compiling cfg-if v0.1.3
   Compiling rustc-serialize v0.3.24
   Compiling cc v1.0.15
   Compiling libc v0.2.40
   Compiling remove_dir_all v0.5.1
   Compiling pkg-config v0.3.11
   Compiling vec_map v0.8.1
   Compiling openssl v0.10.7
   Compiling textwrap v0.9.0
   Compiling protobuf-codegen v1.6.0
   Compiling foreign-types v0.3.2
   Compiling rust-crypto v0.2.36
   Compiling log v0.4.1
   Compiling backtrace-sys v0.1.16
   Compiling rand v0.4.2
   Compiling atty v0.2.10
   Compiling time v0.1.40
   Compiling openssl-sys v0.9.30
   Compiling sqlite3-src v0.2.9
   Compiling protoc v1.6.0
   Compiling tempdir v0.3.7
   Compiling rand v0.3.22
   Compiling tempfile v3.0.2
   Compiling clap v2.31.2
   Compiling protoc-rust v1.6.0
   Compiling backtrace v0.3.7
   Compiling signal-backup-decode v0.1.1
error[E0063]: missing field `customize` in initializer of `protoc_rust::Args<'_>`
 --> build.rs:4:19
  |
4 |     protoc_rust::run(protoc_rust::Args {
  |                      ^^^^^^^^^^^^^^^^^ missing `customize`

error: aborting due to previous error

error: failed to compile `signal-backup-decode v0.1.1`, 
intermediate artifacts can be found at `/tmp/cargo-install.lnCiqeNrucZN`

Caused by:
  Could not compile `signal-backup-decode`.

To learn more, run the command again with --verbose.

no such table: main.sms_fts

I've run following command (original password removed):

$ signal-backup-decode signal-2018-06-18-00-30-12.backup --output-path ./output --sqlite-path ./output/signal_backup.db --password <some_password>

Unfortunately I'm getting error as below:

Database Version: 9ed 1 frames, 0 attachments, 54 bytes into file thread 'main' panicked at 'Failed to prepare statement: INSERT INTO sms VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?): Error { code: Some(1), message: Some("no such table: main.sms_fts") }', libcore/result.rs:945:5 stack backtrace: 0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49 1: std::sys_common::backtrace::print at libstd/sys_common/backtrace.rs:71 at libstd/sys_common/backtrace.rs:59 2: std::panicking::default_hook::{{closure}} at libstd/panicking.rs:211 3: std::panicking::default_hook at libstd/panicking.rs:227 4: std::panicking::rust_panic_with_hook at libstd/panicking.rs:463 5: std::panicking::begin_panic_fmt at libstd/panicking.rs:350 6: rust_begin_unwind at libstd/panicking.rs:328 7: core::panicking::panic_fmt at libcore/panicking.rs:71 8: core::result::unwrap_failed 9: signal_backup_decode::decode_backup 10: signal_backup_decode::main 11: std::rt::lang_start::{{closure}} 12: std::panicking::try::do_call at libstd/rt.rs:59 at libstd/panicking.rs:310 13: __rust_maybe_catch_panic at libpanic_unwind/lib.rs:105 14: std::rt::lang_start_internal at libstd/panicking.rs:289 at libstd/panic.rs:374 at libstd/rt.rs:58 15: main 16: __libc_start_main 17: <unknown>

Rustc version: rustc 1.27.0 (3eda71b00 2018-06-19)

Any help greatly appreciated.

Feature request: Reverse direction - encode backups

Hi!

What

I'd like to ask, if the reverse direction could also be implement without too much work.
Right now, i haven't yet deep dived into the code, but i assume there's no asymmetric part that would require any code from the original Signal devs, right? So given the needed data (clean text backup), you could encrypt it using this tool?
In case you need help testing or finding more information, maybe you could give me hints how to help?

Why

I'm trying to enable the use case described here: johanw666/Signal-Android#50 - given a backup of a Signal Desktop Instance (which can be decrypted by others tools like https://github.com/tbvdm/sigtop) i'd like to import this data back into Signal.

Issues

I assume that not all data is present in the Signal Desktop client that is available in a Signal Android client? But seeing that until recently-ish, Signal was able to import SMS (and ports with relatively lightweight changes can do so even now (and even WA backups): https://github.com/johanw666/Signal-Android) i think these fields can be left empty as optional.

Use or autodetect MIMEType of file and give it an extension

Signal has a MIMEType for each image in its sqlite database which is reliable enough to write file extensions for. This is critical since Windows for example relies solely on file extensions to detect file type, and HTTP servers typically does the same.

As can be seen in Signal-back, it writes file extensions for attachment filenames to disk:

https://github.com/xeals/signal-back/blob/7b9bc2112afa24316da1e2c515e067f69f91d5c4/cmd/extract.go#L116

While I would try to use signal-back instead, it crashes on backup dumps of my size (3-5GB).

Please review your dependencies.

Hi,

I'm the author of https://github.com/dpc/crev/tree/master/cargo-crev - a tool for keeping check of your dependencies.

I was doing review of crates from https://crates.io/users/IvanUkhov, since I had previous instances when I accidentally used a poor quality dependency from this user, and it looks like he has a lot of poor quality, incomplete, name-squatting crates. One of them is sqlite which you seem to be using.

I have not found any problems with that crate, but since it's a FFI crate, and I'm suspicious of this user, I would advise double-checking it, and maybe considering alternatives.

I would also advise to try https://github.com/dpc/crev/tree/master/cargo-crev, which might help with identifying problems like this in the future.

Bogus "Config file does already exist:" error

Hi,

I invoked signal-backup-decode in an empty directory as follows:

~/.cargo/bin/signal-backup-decode -p <password> ~/path/to/signal-backup-file/signal-nnnnnnnn.backup

and the program bails with:

nnnn [ERROR] Config file does already exist: signal-nnnnnnnn/preference/SecureSMS-Preferences. Try -f.

Running it with -f does indeed allow it to proceed without error, but I don't understand why the error is occurring in the first place, and whether using `-f' is causing the program to clobber some file.

Thanks again for this great utility!

"Missing newlines" (with fix?)

Hi! I'm just adding this "issue", because I'm not sure whether you've seen this. (I don't know whether github sends notifications to the project owner when a closed issue receives a new comment).

Please feel free to close this issue as you wish. HTH.

rust v1.42 needed

I just tried to build current master on a Debian-stable machine, which has Rust 1.41 installed. According to the Readme, this should be sufficient. However, Cargo.lock specifies name = "rusqlite" version = "0.24.2" as dependency, which uses the 'matches' macro, which was only "stablized" with Rust 1.42, so with Rust 1.41 I see errors like:

Compiling rusqlite v0.24.2
error[E0658]: use of unstable library feature 'matches_macro'
--> /home/username/.cargo/registry/src/github.com-1ecc6299db9ec823/rusqlite-0.24.2/src/types/from_sql.rs:146:44
|
146 | i64::column_result(value).map(|i| !matches!(i, 0))
| ^^^^^^^
|
= note: for more information, see rust-lang/rust#65721

Build fails

similar to issue #32 ? while installing on arch from the aur repos, i get this error:

error: custom inner attributes are unstable
--> src/Backups.rs:9:4
|
9 | #![rustfmt::skip]
| ^^^^^^^^^^^^^
|
= note: #[deny(soft_unstable)] on by default
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #64266 rust-lang/rust#64266

warning: unused variable: key_value
--> src/output_csv.rs:101:32
|
101 | fn write_key_value(&mut self, key_value: &crate::Backups::KeyValue) -> Result<(), anyhow::Error>{
| ^^^^^^^^^ help: if this is intentional, prefix it with an underscore: _key_value
|
= note: #[warn(unused_variables)] on by default

warning: unused variable: key_value
--> src/output_none.rs:72:32
|
72 | fn write_key_value(&mut self, key_value: &crate::Backups::KeyValue) -> Result<(), anyhow::Error>{
| ^^^^^^^^^ help: if this is intentional, prefix it with an underscore: _key_value

warning: unused variable: key_value
--> src/output_raw.rs:247:32
|
247 | fn write_key_value(&mut self, key_value: &crate::Backups::KeyValue) -> Result<(), anyhow::Error>{
| ^^^^^^^^^ help: if this is intentional, prefix it with an underscore: _key_value

warning: signal-backup-decode (bin "signal-backup-decode") generated 3 warnings
error: could not compile signal-backup-decode due to previous error; 3 warnings emitted

i am new to rust, and not so great a decoding compiler issues anyhow. but i believe the warnings are somewhat innocuous. it's the original error, the message about "unstable attributes" that is the problem, right? i followed the referenced link, but the info there is way beyond my understanding.

any thoughts on how to fix? trying to import my signal messages to sms on android so i can import to imessage...why be so difficult signal devs?!? lol

running rust 1.59.0

thanks,

winston smith

Failed to copy in memory database to file [..] near "INTO": syntax error: Error code 1: SQL error or missing database.

On tag v0.2.1, after building and installing and running

signal-backup-decode --force --password-file pw-2021-03-21  signal-2021-03-21-16-51-07.backup 

I'm getting

[ERROR] Failed to copy in memory database to file: signal-2021-03-21-16-51-07/signal_backup.db: near "INTO": syntax error: Error code 1: SQL error or missing database.

with both - a new backup file I made right now on Signal (Android) 5.4.12 and an older one from 2019-07-24 (I don't know the exact version any more, but I can try to narrow it down if of any help.)

I tried adding --output-type RAW and build from master as well as some prior commits all with the same result.

Memory allocation of X bytes failed

I understand that I'm running this program on a raspberry pi - an admittedly weak machine of only 430M of system memory - but I have 16Gb of swap space available, so in theory it should still (albeit painfully) run without running into memory allocation issues. Despite this, I still receive an error stating "Memory allocation of x bytes failed".

My understanding is that if I'm running the program with the "--no-in-memory-db" option as well, and choosing a RAW output, then the output of the decryption should be immediately on to disk and not onto RAM, so it should work...but it doesn't.

I was thinking, could there be code inherent to the program itself which evaluates when memory has failed to be allocated based on a timer, and so in my case, my machine is judged as having not enough memory when it might actually just be taking longer than the program expects it to take, to allocate the memory in swap space? If not, any idea what I might have done wrong or could do to try getting around the problem?

STDIN:

pi@raspberrypi:~ $ signal-backup-decode -v DEBUG -t RAW --no-in-memory-db --output-path /home/pi/out --password-file "Signal_backup_passwd" /home/pi/signal-2023-08-26-14-34-48.backup

STDOUT:

20:09:19 [INFO] Input file: /home/pi/signal-2023-08-26-14-34-48.backup
20:09:19 [DEBUG] (1) signal_backup_decode::input: Frame type: Header Frame (salt: [6D, 3B, 74, 50, DE, FF, A8, 96, 0B, 12, 00, 64, E1, 35, 6D, A7, B7, A4, 7E, 1F, B0, B2, 20, 4A, 54, CD, C9, F1, FD, 5A, FE, 72] (length: 32), iv: [62, 88, FC, AA, DF, E3, B4, 14, 19, EB, 1B, 66, 04, A4, 4C,
52] (length: 16))
20:11:05 [DEBUG] (2) signal_backup_decode::input: Read frame number 1 with length of 2082591147 bytes
memory allocation of 2082591138 bytes failed
Aborted```

Process getting locked but I don't know why or how.

Windows 7. After running the command, it seems like the program runs for a while but then ends with this error. I see no good reason for this error to happen, I'm definitely not trying to access these files through any other program. Tried it again without anti-virus, in case that was the cause, but that wasn't it either. Any clues for what might be locking the process?

X:\asdf>signal-backup-decode --sqlite-path X:\sqlite  signal-2018-05-26-16-44-13
.backup --password <removed for security purposes>
Database Version: 7ed 1 frames, 0 attachments, 54 bytes into file
The process cannot access the file because it is being used by another process.
(os error 32), Could not move C:\Users\DAVEKA~1\AppData\Local\Temp\.tmpxGtzSp\si
gnal_backup.sqlite to X:\sqlite, trying copy
Error: Error(Io(Os { code: 32, kind: Other, message: "The process cannot access
the file because it is being used by another process." }), State { next_error: N
one, backtrace: None })

Add section/sentence to readme regarding windows installation

I had to experiment a bit to get this to compile under Windows x64. I suggest adding a few lines to the readme, but would like someone to verify that the instructions work, because I am not 100% sure if these steps were all I did.

My steps:

  • (install rust via rustup)
  • Install vcpkg and run integrate install
  • vcpkg install openssl:x64-windows-static-md
  • vcpkg install sqlite3[fts5]:x64-windows-static-md (installs sqlite3 and the fts5 extension, which is required)
  • (cargo install signal-backup-decode)

Finding the correct openssl and sqlite packages was a bit tedious (with my limited knowledge), as I did not know about -md and [fts5]. Maybe just a pointer towards that would be nice in the readme?

signal-backup-merging

Hey there! Thanks for the amazing tool!

My motivation to use it was mainly to keep the data of a lot of backups without having to keep all that duplicated data.
For that I wrote a script that merges the backups extracted with your tool:
https://gitlab.com/thomas351/signal-backup-merging/

Would love it if you could maybe mention a link to my script in your README.md or some other place where you think there might be a place for it.

Thanks again! :)

HMAC verification failed for newer versions of Signal-Android (6.30.4) and signal-backup-decode 0.2.3

Running Signal 6.30.4, newer backup files can't be decrypted for me anymore with signal-backup-decode 0.2.3. I don't exactly know what's the last Signal-version I've read successfully since I only run the backup every couple of weeks.

Command:

signal-backup-decode -f [--no-verify-mac] --verbosity DEBUG \
    --output-path ./ \
    --password-file path/to/pw-file \
    --output-type RAW \
    path/to/signal-2023-09-05-02-55-00.backup 

Output is:

12:39:45 [INFO] Output path: /path/to/output
12:39:45 [INFO] Input file: /path/to/signal-2023-09-05-02-55-00.backup
12:39:45 [DEBUG] (1) signal_backup_decode::input: Frame type: Header Frame (salt: [24, 97, 92, 29, 6D, 18, 5B, 84, 29, 8B, 5A, 7D, 81, BA, BA, C5, E5, E4, 1E, 65, 06, 5C, B8, 76, E2, BC, D7, 59, E0, C4, 47, 24] (length: 32), iv: [28, 42, 69, CE, DF, 30, BC, 9E, F6, BA, 5B, 71, 25, 67, D6, 27] (length: 16))
12:39:45 [DEBUG] (2) signal_backup_decode::input: Read frame number 1 with length of 1313236731 bytes
12:39:47 [ERROR] HMAC verification failed (their mac: [A5, 56, CB, 80, 5A, 97, 32, 00, F1, C9], our mac: [3D, D8, 0A, 0D, AB, 1C, 27, 23, AD, F5]).

(Error code 0 btw - should be nonzero, shouldn't it?)

I double checked the files didn't get corrupted on the way by manually copying them via adb pull and comparing them with diff. And while the files seem to be close to 4GB (I'm not using any FS supporting only less than 4GB anyway), backups are still of different sizes (i.e. not capped) and more than 100MB below 4GB:

$ ls -alF /path/to/backups/*                                                                       130 ↵
-rw-r--r--. 1 me me 4184806602 Sep  4 02:56 /path/to/backups/signal-2023-09-04-02-55-00.backup
-rw-r--r--. 1 me me 4185059654 Sep  5 02:57 /path/to/backups/signal-2023-09-05-02-55-00.backup

Also I verified my passphrase inside the app and made sure the "Verifying backup.." stage while creating the backup succeeds as well..

Anyone else experiencing this? Or does it work for someone with Signal v6.30.4?

Update: I also checked with https://github.com/mossblaser/signal_for_android_decryption - it also works for the last file I can successfully decrypt with signal-backup-decode but fails with the new ones (Error: Incorrect passphrase or corrupted backup (Bad MAC))

lacking instructions and error running

I'm failing to get signal-backup-decode to run. I followed all the instructions, except I don't know what to put for sqlite3 path except what my finder shows, which is either /usr/lib/python3.5/sqlite3 or /usr/lib/python2.7/sqlite3, and I don't know if either of those are correct. How do I find my "sqlite path" and what's wrong with my command?

command:
signal-backup-decode -o -p --sqlite-path /usr/lib/python3.5/sqlite3

result:
thread 'main' panicked at 'Backup file could not be opened: Os { code: 13, kind: PermissionDenied, message: "Permission denied" }', libcore/result.rs:1009:5
note: Run with RUST_BACKTRACE=1 for a backtrace.

Running with sudo doesn't fix it. The password is verified and entered with no spaces per the manual.

Thank you.

Support KeyValue, new SharedPreference-fields

Signal recently added new fields to the SharedPreference-Frame and a new frame type named KeyValue. Those are currently unsupported, i.e. the new fields are ignores and the new frame is implemented as a noop in the output formats.

@mutlusun do you have time to look into them by any chance?

Panic during run-time

I'm trying to decode a backup of mine via

$ signal-backup-decode signal.backup --password <password here> -o ./output --sqlite-path output/signal_backup.db

but the program panics with

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error(MacVerificationError([194, 204, 123, 151, 76, 55, 140, 46, 209, 224], [253, 246, 15, 47, 113, 232, 242, 69, 170, 179]), State { next_error: None, backtrace: None })', libcore/result.rs:945:5
note: Run with `RUST_BACKTRACE=1` for a backtrace.

The full backtrace is

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error(MacVerificationError([194, 204, 123, 151, 76, 55, 140, 46, 209, 224], [253, 246, 15, 47, 113, 232, 242, 69, 170, 179]), State { next_error: None, backtrace: Some(stack backtrace:
   0:     0x55a12b78117c - backtrace::backtrace::trace::he728e6ef10b935e6
   1:     0x55a12b77f962 - backtrace::capture::Backtrace::new::hbd58f32db1ed86b2
   2:     0x55a12b77f42c - error_chain::make_backtrace::h676979fcf0f007e9
   3:     0x55a12b77f4c4 - <error_chain::State as core::default::Default>::default::ha763fbb7fe962285
   4:     0x55a12b709f03 - signal_backup_decode::decode_backup::h595a8b1b2f703127
   5:     0x55a12b70f5ee - signal_backup_decode::main::hb736c6f2fd77a4dc
   6:     0x55a12b6ee68f - std::rt::lang_start::{{closure}}::hb3961786ec22dc30
   7:     0x55a12b836bb7 - std::rt::lang_start_internal::{{closure}}::h37a0d646c7ead5f1
                        at libstd/rt.rs:59
                         - std::panicking::try::do_call::h55cb461590d952a0
                        at libstd/panicking.rs:306
   8:     0x55a12b846cee - __rust_maybe_catch_panic
                        at libpanic_unwind/lib.rs:102
   9:     0x55a12b833e55 - std::panicking::try::h574caffccc6046bb
                        at libstd/panicking.rs:285
                         - std::panic::catch_unwind::hf36d26a940fa3427
                        at libstd/panic.rs:361
                         - std::rt::lang_start_internal::h8627970b5fa2334f
                        at libstd/rt.rs:58
  10:     0x55a12b710943 - main
  11:     0x7fe5e7b5ff49 - __libc_start_main
  12:     0x55a12b6dbe39 - _start
  13:                0x0 - <unknown>) })', libcore/result.rs:945:5
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::sys_common::backtrace::print
             at libstd/sys_common/backtrace.rs:71
             at libstd/sys_common/backtrace.rs:59
   2: std::panicking::default_hook::{{closure}}
             at libstd/panicking.rs:207
   3: std::panicking::default_hook
             at libstd/panicking.rs:223
   4: std::panicking::rust_panic_with_hook
             at libstd/panicking.rs:402
   5: std::panicking::begin_panic_fmt
             at libstd/panicking.rs:349
   6: rust_begin_unwind
             at libstd/panicking.rs:325
   7: core::panicking::panic_fmt
             at libcore/panicking.rs:72
   8: core::result::unwrap_failed
   9: signal_backup_decode::main
  10: std::rt::lang_start::{{closure}}
  11: std::panicking::try::do_call
             at libstd/rt.rs:59
             at libstd/panicking.rs:306
  12: __rust_maybe_catch_panic
             at libpanic_unwind/lib.rs:102
  13: std::rt::lang_start_internal
             at libstd/panicking.rs:285
             at libstd/panic.rs:361
             at libstd/rt.rs:58
  14: main
  15: __libc_start_main
  16: _start

Compiled with rustc 1.26.1 (827013a31 2018-05-25).

New release on github for 0.2.3

Hi,

It looks like the latest release visible on github is 0.2.1 but 0.2.3 according to tags.
image

Are you able to update github with a new release?

Sample backup for testing

Hi,

I'm looking at getting Signal-backup-decode installable by homebrew (Homebrew/homebrew-core#76671) but I need a sample file to decrypt for testing the install and build.

How would I go about creating a sample backup file to test signal-backup-decode is working?

Ubuntu 22.04 Support - thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: TryFromIntError(())'

Hi,
I used to run signal-backup-decode a while ago (I think it was on Ubuntu 20.04). It worked perfectly fine, thanks for the great and simple tooling.
Unfortunately, I upgraded to a new install of Ubuntu 22.04 and tried to decrypt a backup from today to archive my messages and offload them from my Android Phone.
The decryption freezes, because a thread panics, is there something I can do to make it work on Ubuntu 22.04 again?

Details:

OS:

$ cat /etc/os-release 
PRETTY_NAME="Ubuntu 22.04.2 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.2 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy

Signal version: 6.26.4

Steps to reproduce:

$ sudo apt install libsqlite3-dev libssl-dev pkg-config
$ cargo install signal-backup-decode
$ export PATH=$PATH:/home/xxx/.cargo/bin
$ signal-backup-decode --version
signal-backup-decode 0.2.3
$ export RUST_BACKTRACE=full
$ signal-backup-decode backups/signal-2023-07-27-19-10-12.backup -p xxx -o backups/signal-2023-07-27-19-10-12 -f
19:30:05 [INFO] Output path: backups/signal-2023-07-27-19-10-12
19:30:05 [INFO] Input file: backups/signal-2023-07-27-19-10-12.backup
thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: TryFromIntError(())', /home/xxx/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-0.10.55/src/cipher_ctx.rs:565:50
stack backtrace:
   0:     0x55ed2c029fdf - std::backtrace_rs::backtrace::libunwind::trace::hf4179216f2af7039
                               at /build/rustc-ujz1Py/rustc-1.66.1+dfsg0ubuntu1/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x55ed2c029fdf - std::backtrace_rs::backtrace::trace_unsynchronized::hfa14eb12e4b8ce4f
                               at /build/rustc-ujz1Py/rustc-1.66.1+dfsg0ubuntu1/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x55ed2c029fdf - std::sys_common::backtrace::_print_fmt::hc81cbee2043ec868
                               at /build/rustc-ujz1Py/rustc-1.66.1+dfsg0ubuntu1/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x55ed2c029fdf - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h7b2be2009a6bcba2
                               at /build/rustc-ujz1Py/rustc-1.66.1+dfsg0ubuntu1/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x55ed2c04bd6e - core::fmt::write::hccee7882499b620f
                               at /build/rustc-ujz1Py/rustc-1.66.1+dfsg0ubuntu1/library/core/src/fmt/mod.rs:1209:17
   5:     0x55ed2c00d165 - std::io::Write::write_fmt::h69e1f37bb24a9f49
                               at /build/rustc-ujz1Py/rustc-1.66.1+dfsg0ubuntu1/library/std/src/io/mod.rs:1682:15
   6:     0x55ed2c029d95 - std::sys_common::backtrace::_print::h86df92192f156e4c
                               at /build/rustc-ujz1Py/rustc-1.66.1+dfsg0ubuntu1/library/std/src/sys_common/backtrace.rs:47:5
   7:     0x55ed2c029d95 - std::sys_common::backtrace::print::h3b76d5113eea7ae3
                               at /build/rustc-ujz1Py/rustc-1.66.1+dfsg0ubuntu1/library/std/src/sys_common/backtrace.rs:34:9
   8:     0x55ed2c01655f - std::panicking::default_hook::{{closure}}::h634bc187e8e58de8
                               at /build/rustc-ujz1Py/rustc-1.66.1+dfsg0ubuntu1/library/std/src/panicking.rs:267:22
   9:     0x55ed2c016218 - std::panicking::default_hook::h262aef5e4abfc826
                               at /build/rustc-ujz1Py/rustc-1.66.1+dfsg0ubuntu1/library/std/src/panicking.rs:286:9
  10:     0x55ed2c016b6b - std::panicking::rust_panic_with_hook::hedb8a8e4067bf251
                               at /build/rustc-ujz1Py/rustc-1.66.1+dfsg0ubuntu1/library/std/src/panicking.rs:688:13
  11:     0x55ed2c02a337 - std::panicking::begin_panic_handler::{{closure}}::hf501de419c9dcde3
                               at /build/rustc-ujz1Py/rustc-1.66.1+dfsg0ubuntu1/library/std/src/panicking.rs:579:13
  12:     0x55ed2c02a12c - std::sys_common::backtrace::__rust_end_short_backtrace::h8542e72ad556a307
                               at /build/rustc-ujz1Py/rustc-1.66.1+dfsg0ubuntu1/library/std/src/sys_common/backtrace.rs:137:18
  13:     0x55ed2c016712 - rust_begin_unwind
                               at /build/rustc-ujz1Py/rustc-1.66.1+dfsg0ubuntu1/library/std/src/panicking.rs:575:5
  14:     0x55ed2be58123 - core::panicking::panic_fmt::h1688e859668ba1d0
                               at /build/rustc-ujz1Py/rustc-1.66.1+dfsg0ubuntu1/library/core/src/panicking.rs:65:14
  15:     0x55ed2be58493 - core::result::unwrap_failed::h9f204f08b8ff9323
                               at /build/rustc-ujz1Py/rustc-1.66.1+dfsg0ubuntu1/library/core/src/result.rs:1791:5
  16:     0x55ed2bfb6423 - openssl::cipher_ctx::CipherCtxRef::cipher_update::h2406b399f101ef7b
  17:     0x55ed2bfb5e1d - openssl::symm::cipher::hf1e2ceda84d24777
  18:     0x55ed2bfb5d3c - openssl::symm::decrypt::h5f29f82e65c48171
  19:     0x55ed2be9ddbe - signal_backup_decode::decrypter::Decrypter::decrypt::h95894db11b65a627
  20:     0x55ed2be97299 - signal_backup_decode::input::InputFile::read_data::h45bfa15ec8b5930d
  21:     0x55ed2be975f1 - <signal_backup_decode::input::InputFile as core::iter::traits::iterator::Iterator>::next::ha9e16bf73700b59e
  22:     0x55ed2be92c3b - std::sys_common::backtrace::__rust_begin_short_backtrace::h84ed26dc5a626963
  23:     0x55ed2be74f9f - core::ops::function::FnOnce::call_once{{vtable.shim}}::ha0581d6705a2724e
  24:     0x55ed2c02dda3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hc3323dde5906bdc2
                               at /build/rustc-ujz1Py/rustc-1.66.1+dfsg0ubuntu1/library/alloc/src/boxed.rs:1987:9
  25:     0x55ed2c02dda3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h3b73c33abf11659b
                               at /build/rustc-ujz1Py/rustc-1.66.1+dfsg0ubuntu1/library/alloc/src/boxed.rs:1987:9
  26:     0x55ed2c02dda3 - std::sys::unix::thread::Thread::new::thread_start::h029e13c652d93bcf
                               at /build/rustc-ujz1Py/rustc-1.66.1+dfsg0ubuntu1/library/std/src/sys/unix/thread.rs:108:17
  27:     0x7f5411694b43 - start_thread
                               at ./nptl/./nptl/pthread_create.c:442:8
  28:     0x7f5411726a00 - clone3
                               at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
  29:                0x0 - <unknown>
Read vs. written frames: [00:00:46] [--------------------------------------------------]     0/1  

The process seem not to progress afterwards any more, it does not terminate, but it only consumes 35,5 MB memory and 0 CPU.

Is maybe some shared OS lib to recent in Ubuntu 22.04 and broke compatibility with signal-backup-decode?

Thanks for any hints

Build fails

The provided cargo install signal-backup-decode fails with

error[E0658]: non-builtin inner attributes are unstable
 --> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/protobuf-2.18.0/src/descriptor.rs:9:1
  |
9 | #![rustfmt::skip]
  | ^^^^^^^^^^^^^^^^^
  |
  = note: for more information, see https://github.com/rust-lang/rust/issues/54726

I assume this error is not in signal-backup-decode, but maybe the protobuf dependency needs to be updated? I am trying to build under debian stretch.

HMAC verification failed

The latest version of signal-backup-decode doesn't appear to want to decrypt recent backups?

I've verified and re-created backups a couple of times now, and it always fails decrypting them again. However, noteworthy is that it isn't because the actual pass phrase is incorrect. I've tried with incorrect pass phrases, and it fails after a certain amount of frames, not after the first frame (which usually happens with incorrect pass phrases).

Update instructions.

People may be using this as more than just a backup utility. Personally, I would like to use it as a way to merge my Signal conversation history back in with my default SMS/MMS history.

I feel like the suggestion in another issue thread about using "file" (linux) or "TrID" (windows) should be included with the Wiki instructions so people know what to expect with the output of signal-backup-decode and how to process it.

If the developer has a suggestion for how to merge this data in with SMS/MMS history (for Android, the SMS Backup & Restore app is the most popular) that too should be added to the Wiki.

"cargo install signal-backup-decode" fails ("failed to run custom build command")

Hi. I'm trying to install signal-backup-decode on my up-to-date debian stretch box. When I run:

cargo install signal-backup-decode

I get:

~$ cargo install signal-backup-decode
    Updating registry `https://github.com/rust-lang/crates.io-index`
  Installing signal-backup-decode v0.1.0
   Compiling libc v0.2.40
   Compiling remove_dir_all v0.5.1
   Compiling ansi_term v0.11.0
   Compiling rustc-serialize v0.3.24
   Compiling hex v0.3.2
   Compiling lazy_static v1.0.0
   Compiling cc v1.0.15
   Compiling strsim v0.7.0
   Compiling rustc-demangle v0.1.7
   Compiling bitflags v1.0.3
   Compiling vec_map v0.8.0
   Compiling byteorder v1.2.2
   Compiling gcc v0.3.54
   Compiling unicode-width v0.1.4
   Compiling cfg-if v0.1.2
   Compiling pkg-config v0.3.11
   Compiling rust-ini v0.11.0
   Compiling protobuf v1.5.1
   Compiling foreign-types-shared v0.1.1
   Compiling openssl v0.10.7
   Compiling atty v0.2.10
   Compiling rand v0.4.2
   Compiling time v0.1.39
   Compiling backtrace-sys v0.1.16
   Compiling textwrap v0.9.0
   Compiling log v0.4.1
   Compiling sqlite3-src v0.2.9
   Compiling openssl-sys v0.9.30
   Compiling rust-crypto v0.2.36
   Compiling foreign-types v0.3.2
   Compiling tempdir v0.3.7
   Compiling tempfile v3.0.1
   Compiling rand v0.3.22
   Compiling clap v2.31.2
   Compiling protoc v1.5.1
   Compiling protoc-rust v1.5.1
   Compiling backtrace v0.3.6
   Compiling signal-backup-decode v0.1.0
error: failed to run custom build command for `signal-backup-decode v0.1.0`
process didn't exit successfully: `/tmp/cargo-install.rH5pJHup5tUV/release/build/signal-backup-decode-321088517404bcbb/build-script-build` (exit code: 101)
--- stderr
thread 'main' panicked at 'protoc: Os { code: 2, kind: NotFound, message: "No such file or directory" }', libcore/result.rs:945:5
note: Run with `RUST_BACKTRACE=1` for a backtrace.

warning: build failed, waiting for other jobs to finish...
error: failed to compile `signal-backup-decode v0.1.0`, intermediate artifacts can be found at `/tmp/cargo-install.rH5pJHup5tUV`

Caused by:
  build failed

Unfortunately I know nothing about rust. If I can give you more info, please let me know.

PS: the crates page https://crates.io/crates/signal-backup-decode has a typo: the install command should be:
cargo install signal-backup-decode
not
cargo install signal-backup-decoder
HTH

Encoding errors

I am getting lots of encoding errors

e.g.

class IncrementalEncoder(codecs.IncrementalEncoder): │ │ 18 │ def encode(self, input, final=False): │ │ > 19 │ │ return codecs.charmap_encode(input,self.errors,encoding_table)[0] │ │ 20 │ │ 21 class IncrementalDecoder(codecs.IncrementalDecoder): │ │ 22 │ def decode(self, input, final=False): │ │ │ │ ┌─────────────────────────────────────────── locals ───────────────────────────────────────────┐ │ │ │ final = False │ │ │ │ input = "[2022-07-19 15:25] Me: Et si tu n′existais pas\r\nDis-moi pourquoi │ │ │ │ j'existerais\r\nP"+73 │ │ │ │ self = <encodings.cp1252.IncrementalEncoder object at 0x000002942D3CAB00> │ │ │ └──────────────────────────────────────────────────────────────────────────────────────────────┘ │ └──────────────────────────────────────────────────────────────────────────────────────────────────┘ UnicodeEncodeError: 'charmap' codec can't encode character '\u2032' in position 33: character maps to <undefined>

Steps I had to take to get signal-backup-decode to compile on ubuntu 20.04

On Ubuntu 20.04 I had to do the following to get it to compile:

  • Install Rust (obvious, but I haven't played with Rust yet)
  • add ~/.cargo/bin to my PATH
  • sudo apt install libssl-dev
  • export OPENSSL_LIB_DIR="/usr/lib/x86_64-linux-gnu"
  • export OPENSSL_INCLUDE_DIR="/usr/include/openssl"
  • sudo apt install libsqlite3-dev

Awesome utility. thank you.

SQLite error: object name reserved for internal use: sqlite_sequence

Using signal-backup-decode 0.1.3, Signal 4.43.8

I ran

~/.cargo/bin/signal-backup-decode ../import/signal-2019-07-14-11-55-59.backup --password_file pw --sqlite-path signal-2019-07-14-11-55-59.db

and got

Database Version: 21d 1 frames, 0 attachments, 54 bytes into file
thread 'main' panicked at 'Failed to prepare statement: CREATE TABLE sqlite_sequence(name,seq): Error { code: Some(1), message: Some("object name reserved for internal use: sqlite_sequence") }', src/libcore/result.rs:997:5
note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

BT:

stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
   1: std::sys_common::backtrace::_print
   2: std::panicking::default_hook::{{closure}}
   3: std::panicking::default_hook
   4: std::panicking::rust_panic_with_hook
   5: std::panicking::continue_panic_fmt
   6: rust_begin_unwind
   7: core::panicking::panic_fmt
   8: core::result::unwrap_failed
   9: signal_backup_decode::decode_backup
  10: signal_backup_decode::main
  11: std::rt::lang_start::{{closure}}
  12: std::panicking::try::do_call
  13: __rust_maybe_catch_panic
  14: std::rt::lang_start_internal
  15: main
  16: __libc_start_main
  17: _start

Are there prerequisites I'm missing? I wonder why no one else has this problem :)

btw, when I run signal-backup-decode without --sqlite-path I get

error: The following required arguments were not provided:
    --sqlite-path <sqlite_path>

Ask about install

Hi!
I'm a not programmer but i don't know where could i ask about help.
I have problem with use this code.
I tried almost everything. Could you help me?

I cant install decoder because:

firenet@firenet-VirtualBox:~/.cargo/registry/src/github.com-1ecc6299db9ec823/signal-backup-decode-0.1.5$ cargo install --features "rebuild-protobuf" signal-backup-decode
Updating crates.io index
Installing signal-backup-decode v0.1.5
Compiling libc v0.2.74
Compiling cfg-if v0.1.10
Compiling getrandom v0.1.14
Compiling proc-macro2 v1.0.19
Compiling cc v1.0.59
Compiling pkg-config v0.3.18
Compiling autocfg v1.0.0
Compiling unicode-xid v0.2.1
Compiling ppv-lite86 v0.2.8
Compiling syn v1.0.38
Compiling log v0.4.11
Compiling protobuf v2.17.0
Compiling bitflags v1.2.1
Compiling remove_dir_all v0.5.3
Compiling gcc v0.3.55
Compiling gimli v0.22.0
Compiling version_check v0.9.2
Compiling ahash v0.3.8
Compiling adler v0.2.3
Compiling foreign-types-shared v0.1.1
Compiling rustc-demangle v0.1.16
Compiling byteorder v1.3.4
Compiling object v0.20.0
Compiling unicode-width v0.1.8
Compiling openssl v0.10.30
Compiling rustc-serialize v0.3.24
Compiling ansi_term v0.11.0
Compiling strsim v0.8.0
Compiling lazy_static v1.4.0
Compiling vec_map v0.8.2
Compiling hex v0.3.2
Compiling sqlite3-src v0.2.12
Compiling hashbrown v0.7.2
Compiling openssl-sys v0.9.58
Compiling rust-crypto v0.2.36
Compiling addr2line v0.13.0
Compiling error-chain v0.12.4
Compiling miniz_oxide v0.4.0
Compiling foreign-types v0.3.2
Compiling textwrap v0.11.0
error[E0658]: non-builtin inner attributes are unstable
--> /home/firenet/.cargo/registry/src/github.com-1ecc6299db9ec823/protobuf-2.17.0/src/descriptor.rs:9:1
|
9 | #![rustfmt::skip]
| ^^^^^^^^^^^^^^^^^
|
= note: see issue #54726 rust-lang/rust#54726 for more information

error[E0658]: non-builtin inner attributes are unstable
--> /home/firenet/.cargo/registry/src/github.com-1ecc6299db9ec823/protobuf-2.17.0/src/plugin.rs:9:1
|
9 | #![rustfmt::skip]
| ^^^^^^^^^^^^^^^^^
|
= note: see issue #54726 rust-lang/rust#54726 for more information

error[E0658]: non-builtin inner attributes are unstable
--> /home/firenet/.cargo/registry/src/github.com-1ecc6299db9ec823/protobuf-2.17.0/src/rustproto.rs:9:1
|
9 | #![rustfmt::skip]
| ^^^^^^^^^^^^^^^^^
|
= note: see issue #54726 rust-lang/rust#54726 for more information

error[E0658]: non-builtin inner attributes are unstable
--> /home/firenet/.cargo/registry/src/github.com-1ecc6299db9ec823/protobuf-2.17.0/src/well_known_types/any.rs:9:1
|
9 | #![rustfmt::skip]
| ^^^^^^^^^^^^^^^^^
|
= note: see issue #54726 rust-lang/rust#54726 for more information

error[E0658]: non-builtin inner attributes are unstable
--> /home/firenet/.cargo/registry/src/github.com-1ecc6299db9ec823/protobuf-2.17.0/src/well_known_types/api.rs:9:1
|
9 | #![rustfmt::skip]
| ^^^^^^^^^^^^^^^^^
|
= note: see issue #54726 rust-lang/rust#54726 for more information

error[E0658]: non-builtin inner attributes are unstable
--> /home/firenet/.cargo/registry/src/github.com-1ecc6299db9ec823/protobuf-2.17.0/src/well_known_types/duration.rs:9:1
|
9 | #![rustfmt::skip]
| ^^^^^^^^^^^^^^^^^
|
= note: see issue #54726 rust-lang/rust#54726 for more information

error[E0658]: non-builtin inner attributes are unstable
--> /home/firenet/.cargo/registry/src/github.com-1ecc6299db9ec823/protobuf-2.17.0/src/well_known_types/empty.rs:9:1
|
9 | #![rustfmt::skip]
| ^^^^^^^^^^^^^^^^^
|
= note: see issue #54726 rust-lang/rust#54726 for more information

error[E0658]: non-builtin inner attributes are unstable
--> /home/firenet/.cargo/registry/src/github.com-1ecc6299db9ec823/protobuf-2.17.0/src/well_known_types/field_mask.rs:9:1
|
9 | #![rustfmt::skip]
| ^^^^^^^^^^^^^^^^^
|
= note: see issue #54726 rust-lang/rust#54726 for more information

error[E0658]: non-builtin inner attributes are unstable
--> /home/firenet/.cargo/registry/src/github.com-1ecc6299db9ec823/protobuf-2.17.0/src/well_known_types/source_context.rs:9:1
|
9 | #![rustfmt::skip]
| ^^^^^^^^^^^^^^^^^
|
= note: see issue #54726 rust-lang/rust#54726 for more information

error[E0658]: non-builtin inner attributes are unstable
--> /home/firenet/.cargo/registry/src/github.com-1ecc6299db9ec823/protobuf-2.17.0/src/well_known_types/struct_pb.rs:9:1
|
9 | #![rustfmt::skip]
| ^^^^^^^^^^^^^^^^^
|
= note: see issue #54726 rust-lang/rust#54726 for more information

error[E0658]: non-builtin inner attributes are unstable
--> /home/firenet/.cargo/registry/src/github.com-1ecc6299db9ec823/protobuf-2.17.0/src/well_known_types/timestamp.rs:9:1
|
9 | #![rustfmt::skip]
| ^^^^^^^^^^^^^^^^^
|
= note: see issue #54726 rust-lang/rust#54726 for more information

error[E0658]: non-builtin inner attributes are unstable
--> /home/firenet/.cargo/registry/src/github.com-1ecc6299db9ec823/protobuf-2.17.0/src/well_known_types/type_pb.rs:9:1
|
9 | #![rustfmt::skip]
| ^^^^^^^^^^^^^^^^^
|
= note: see issue #54726 rust-lang/rust#54726 for more information

error[E0658]: non-builtin inner attributes are unstable
--> /home/firenet/.cargo/registry/src/github.com-1ecc6299db9ec823/protobuf-2.17.0/src/well_known_types/wrappers.rs:9:1
|
9 | #![rustfmt::skip]
| ^^^^^^^^^^^^^^^^^
|
= note: see issue #54726 rust-lang/rust#54726 for more information

error: aborting due to 13 previous errors

For more information about this error, try rustc --explain E0658.
error: failed to compile signal-backup-decode v0.1.5, intermediate artifacts can be found at /tmp/cargo-installvZAI7X

Caused by:
could not compile protobuf.

To learn more, run the command again with --verbose.

Failed to compile (error[E0580]: main function has wrong type)

error[E0580]: main function has wrong type
   --> src/main.rs:315:1
    |
315 | / fn main() -> Result<()> {
316 | |     let matches = clap_app!(myapp =>
317 | |         (name: crate_name!())
318 | |         (version: crate_version!())
...   |
429 | |     Ok(())
430 | | }
    | |_^ expected (), found enum `std::result::Result`
    |
    = note: expected type `fn()`
               found type `fn() -> std::result::Result<(), errors::Error>`

error: aborting due to previous error

error: failed to compile `signal-backup-decode v0.1.2`, intermediate artifacts can be found at `/tmp/cargo-install.Pr4b2E2f43ce`

Caused by:
  Could not compile `signal-backup-decode`.

To learn more, run the command again with --verbose.

HMAC verification failed even when --no-verify-mac is set

Hello, I am consistently getting the "HMAC verification failed error when trying to decode a backup file even when --no-verify-mac is set. I've copied the signal.backup file from my android device and am running signal-backup-decode on my laptop running Ubuntu 22.04.

I am running the following:

$ signal-backup-decode -p "<passphrase>" --no-verify-mac -f -t csv -v DEBUG signal-<file-name>.backup

Output is:

23:40:01 [INFO] Output path: signal-2023-12-15-02-25-01
23:40:01 [INFO] Input file: signal-2023-12-15-02-25-01.backup
23:40:01 [DEBUG] (1) signal_backup_decode::input: Frame type: Header Frame (salt: [DA, D4, 4D, 54, 65, 06, 04, 12, AA, B5, E9, 08, 6F, 85, 4C, AD, DE, 02, FB, 08, F9, 2B, 5C, F4, 09, E8, 52, 64, 7C, 2A, 24, F9] (length: 32), iv: [9D, 43, C8, 62, C6, F4, 3B, 75, 81, 62, CF, 31, 75, 03, 59, BD] (length: 16))
23:40:02 [DEBUG] (2) signal_backup_decode::input: Read frame number 1 with length of 1595561157 bytes
23:40:13 [ERROR] HMAC verification failed (their mac: [F9, C3, 30, 59, 2F, 70, 98, CC, 0A, D8], our mac: [51, 88, 90, 3A, 73, 51, DD, 10, 18, B7]).

I've confirmed that the passphrase is correct on my android device using Signal's "verify backup passphrase" feature. Backups were created using Signal version 6.41.3

Using signal-backup-decode version:

$ signal-backup-decode -V
signal-backup-decode 0.2.3

Any insight would be very helpful. Thank you.

[ERROR] failed to fill whole buffer

Thanks for the awesome tool!
However I run into an issue when running:

rhk@haapa:~/Datat/backup/signal/signal-backup-decode$ signal-backup-decode --no-verify-mac -v WARN -f --password-file ../salasana.txt signal-2023-04-13-03-59-11.backup
Bytes read: [00:02:32] [#################################################>] 6.33GB/6.33GB
Read vs. written frames: [00:02:32] [##################################################] 129207/129207
07:14:34 [ERROR] failed to fill whole buffer.

rhk@haapa:~/Datat/backup/signal/signal-backup-decode$ signal-backup-decode --version
signal-backup-decode 0.2.3

rhk@haapa:~/Datat/backup/signal/signal-backup-decode$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 12 (bookworm)
Release: 12
Codename: bookworm

Any ideas what's wrong or what to try?

thread '<unnamed>' panicked at 'assertion failed: output.len() <= c_int::max_value() as usize

I've used your tool for over a year to extract my signal backups, and it always worked perfectly, it even managed to extract incomplete copies of *.backup files that I ended up with from time to time.

But now I ran into a problem:

13:52:56 �[0m�[34m[INFO] �[0mOutput path: signal-2023-07-26-04-46-08
13:52:56 �[0m�[34m[INFO] �[0mInput file: Archives/signal-2023-07-26-04-46-08.backup
thread '' panicked at 'assertion failed: output.len() <= c_int::max_value() as usize', /root/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-0.10.38/src/symm.rs:627:13
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

I've tried to do a fresh install using cargo install --git https://github.com/pajowu/signal-backup-decode signal-backup-decode since I thought maybe there was something broken with the openssl (since that was what caused the panic), but today's stable rust compiler version doesn't want to compile the version in this git repository:

error: custom inner attributes are unstable
 --> src/Backups.rs:9:4
  |
9 | #![rustfmt::skip]
  |    ^^^^^^^^^^^^^
  |
  = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
  = note: for more information, see issue #64266 <https://github.com/rust-lang/rust/issues/64266>
  = note: `#[deny(soft_unstable)]` on by default

warning: use of deprecated associated function `chrono::NaiveDateTime::from_timestamp`: use `from_timestamp_opt()` instead
  --> src/message.rs:31:28
   |
31 |                 chrono::NaiveDateTime::from_timestamp(x / 1000, 0)
   |                                        ^^^^^^^^^^^^^^
   |
   = note: `#[warn(deprecated)]` on by default

warning: use of deprecated associated function `chrono::NaiveDateTime::from_timestamp`: use `from_timestamp_opt()` instead
  --> src/message.rs:33:28
   |
33 |                 chrono::NaiveDateTime::from_timestamp(0, 0)
   |                                        ^^^^^^^^^^^^^^

warning: use of deprecated associated function `chrono::NaiveDateTime::from_timestamp`: use `from_timestamp_opt()` instead
  --> src/message.rs:37:28
   |
37 |                 chrono::NaiveDateTime::from_timestamp(x / 1000, 0)
   |                                        ^^^^^^^^^^^^^^

warning: use of deprecated associated function `chrono::NaiveDateTime::from_timestamp`: use `from_timestamp_opt()` instead
  --> src/message.rs:39:28
   |
39 |                 chrono::NaiveDateTime::from_timestamp(0, 0)
   |                                        ^^^^^^^^^^^^^^

warning: unused variable: `key_value`
   --> src/output_csv.rs:101:32
    |
101 |     fn write_key_value(&mut self, key_value: &crate::Backups::KeyValue) ->  Result<(), anyhow::Error>{
    |                                   ^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_key_value`
    |
    = note: `#[warn(unused_variables)]` on by default

warning: unused variable: `key_value`
  --> src/output_none.rs:72:32
   |
72 |     fn write_key_value(&mut self, key_value: &crate::Backups::KeyValue) ->  Result<(), anyhow::Error>{
   |                                   ^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_key_value`

warning: unused variable: `key_value`
   --> src/output_raw.rs:247:32
    |
247 |     fn write_key_value(&mut self, key_value: &crate::Backups::KeyValue) ->  Result<(), anyhow::Error>{
    |                                   ^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_key_value`

warning: `signal-backup-decode` (bin "signal-backup-decode") generated 7 warnings
error: could not compile `signal-backup-decode` due to previous error; 7 warnings emitted
error: failed to compile `signal-backup-decode v0.2.3 (https://github.com/pajowu/signal-backup-decode#31100a37)`, intermediate artifacts can be found at `/tmp/cargo-installwYaMz2`

Next I've had a look at https://github.com/pajowu/signal-backup-decode/network and found a fork with a branch that had a promising name: support-new-backup-version.

I managed to install that version using cargo install --git "https://github.com/pascalgn/signal-backup-decode" --branch support-new-backup-version which also gave a few warnings, but no errors.

Using that I was able to unpack my newer signal backups just fine again. Would be lovely if you could merge that change and publish a new version with it.

Tag a release

Hi, I would like to package this for Void Linux.
Void build templates need a release version specified for fetching source code from Github.
I see that this is versioned in Cargo.toml, @pajowu would you mind creating a release for 0.1.3?

Thank you for making this! It's proven to be very useful.

Display data human-readable

Hi,
great work, thank you.
Are you aware of a simple way to display the data in a human-readable way?
I am thinking maybe some project that parses the results into a nice html so one can view (certain) (group) conversations in a browser or something.
Or at least an sql-query that lets you read group conversations quite comfortably? Can't believe I am the first one needing this.
I am also thankful for hints where I could ask my question, but this project is such a great starting point...

Error trying to install on Windows 7.

So I just installed Cargo, I'm on Windows 7. I get this error when trying to install signal-backup-decode.

   Compiling openssl-sys v0.9.31
error: failed to run custom build command for `openssl-sys v0.9.31`
process didn't exit successfully: `C:\Users\DAVEKA~1\AppData\Local\Temp\cargo-in
stallEnxWzu\release\build\openssl-sys-6eac7ebabc0d6549\build-script-main` (exit
code: 101)
--- stdout
cargo:rerun-if-env-changed=X86_64_PC_WINDOWS_MSVC_OPENSSL_LIB_DIR
cargo:rerun-if-env-changed=OPENSSL_LIB_DIR
cargo:rerun-if-env-changed=X86_64_PC_WINDOWS_MSVC_OPENSSL_INCLUDE_DIR
cargo:rerun-if-env-changed=OPENSSL_INCLUDE_DIR
cargo:rerun-if-env-changed=X86_64_PC_WINDOWS_MSVC_OPENSSL_DIR
cargo:rerun-if-env-changed=OPENSSL_DIR
note: vcpkg did not find openssl as libcrypto and libssl : VcpkgNotFound("No vcp
kg.user.targets found. Set the VCPKG_ROOT environment variable or run \'vcpkg in
tegrate install\'")
note: vcpkg did not find openssl as ssleay32 and libeay32: VcpkgNotFound("No vcp
kg.user.targets found. Set the VCPKG_ROOT environment variable or run \'vcpkg in
tegrate install\'")

--- stderr
thread 'main' panicked at '

Could not find directory of OpenSSL installation, and this `-sys` crate cannot
proceed without this knowledge. If OpenSSL is installed and this crate had
trouble finding it,  you can set the `OPENSSL_DIR` environment variable for the
compilation process.

Make sure you also have the development packages of openssl installed.
For example, `libssl-dev` on Ubuntu or `openssl-devel` on Fedora.

If you're in a situation where you think the directory *should* be found
automatically, please open a bug at https://github.com/sfackler/rust-openssl
and include information about your system as well as this message.

    $HOST = x86_64-pc-windows-msvc
    $TARGET = x86_64-pc-windows-msvc
    openssl-sys = 0.9.31


It looks like you're compiling for MSVC but we couldn't detect an OpenSSL
installation. If there isn't one installed then you can try the rust-openssl
README for more information about how to download precompiled binaries of
OpenSSL:

    https://github.com/sfackler/rust-openssl#windows

', C:\Users\Dave Kap\.cargo\registry\src\github.com-1ecc6299db9ec823\openssl-sys
-0.9.31\build/main.rs:232:5
note: Run with `RUST_BACKTRACE=1` for a backtrace.

warning: build failed, waiting for other jobs to finish...

'Failed to prepare statement: CREATE TABLE sqlite_sequence(name,seq): Error { code: Some(1), message: Some("object name reserved for internal use: sqlite_sequence") }

Running the program on my backup produces the following error:

$ RUST_BACKTRACE=1 ./signal-backup-decode signal-2019-04-29-04-03-42.backup --password '<omitted>' --sqlite-path out.sqlite3
Database Version: 20d 1 frames, 0 attachments, 54 bytes into file
thread 'main' panicked at 'Failed to prepare statement: CREATE TABLE sqlite_sequence(name,seq): Error { code: Some(1), message: Some("object name reserved for internal use: sqlite_sequence") }', src/libcore/result.rs:997:5
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:39
   1: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:70
   2: std::panicking::default_hook::{{closure}}
             at src/libstd/sys_common/backtrace.rs:58
             at src/libstd/panicking.rs:200
   3: std::panicking::default_hook
             at src/libstd/panicking.rs:215
   4: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:478
   5: std::panicking::continue_panic_fmt
             at src/libstd/panicking.rs:385
   6: rust_begin_unwind
             at src/libstd/panicking.rs:312
   7: core::panicking::panic_fmt
             at src/libcore/panicking.rs:85
   8: core::result::unwrap_failed
   9: signal_backup_decode::decode_backup
  10: signal_backup_decode::main
  11: std::rt::lang_start::{{closure}}
  12: std::panicking::try::do_call
             at src/libstd/rt.rs:49
             at src/libstd/panicking.rs:297
  13: __rust_maybe_catch_panic
             at src/libpanic_unwind/lib.rs:87
  14: std::rt::lang_start_internal
             at src/libstd/panicking.rs:276
             at src/libstd/panic.rs:388
             at src/libstd/rt.rs:48
  15: main
  16: __libc_start_main
  17: _start

This is on Debian 9. Version information:

$ apt policy sqlite3
sqlite3:
  Installed: 3.16.2-5+deb9u1
  Candidate: 3.16.2-5+deb9u1
  Version table:
     3.27.2-2~bpo9+1 100
        100 http://deb.debian.org/debian stretch-backports/main amd64 Packages
 *** 3.16.2-5+deb9u1 500
        500 http://deb.debian.org/debian stretch/main amd64 Packages
        100 /var/lib/dpkg/status

Version information on the host that built the binary (which is different than what I'm running it on, but should have the exact same packages installed because they share the same Qubes OS TemplateVM):

% rustc --version
rustc 1.34.1 (fc50f328b 2019-04-24)

% cargo --version
cargo 1.34.0 (6789d8a0a 2019-04-01)

% apt policy sqlite3
sqlite3:
  Installed: 3.16.2-5+deb9u1
  Candidate: 3.16.2-5+deb9u1
  Version table:
     3.27.2-2~bpo9+1 100
        100 http://deb.debian.org/debian stretch-backports/main amd64 Packages
 *** 3.16.2-5+deb9u1 500
        500 http://deb.debian.org/debian stretch/main amd64 Packages
        100 /var/lib/dpkg/status

The program was installed with cargo install today. Please do let me know what other information I can provide.

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.