GithubHelp home page GithubHelp logo

signal-golang / textsecure Goto Github PK

View Code? Open in Web Editor NEW
57.0 9.0 26.0 1.35 MB

TextSecure(signal) client package for Go

License: GNU General Public License v3.0

Go 99.28% Makefile 0.72%
hacktoberfest

textsecure's Introduction

TextSecure library and command line test client for Go

This is a Go package implementing the TextSecure push data (i.e. not encrypted SMS) protocol v3 including the Axolotl ratchet.

The included sample command line app can send and receive text messages and attachments and supports group chat.

The API presented by the package is in flux, mainly driven by the needs of https://github.com/nanu-c/axolotl

Automatically generated documentation can be found on GoDoc

Installation

This command will install both the library and the test client.

go get github.com/signal-golang/textsecure/cmd/textsecure

textsecure also depends on crayfish which is a Go library for interacting with the upstream libsignal-client library. It's currently used for registration and decryption of messages. libzkgroup is used for the groupv2 protocol and is add by [this go wrapper] (https://github.com/nanu-c/zkgroup). It has to be added to the LD_LIBRARY_PATH environment variable. Crayfish is built with cago build and has to be placed next to the textsecure binary.

Configuration

Copy cmd/textsecure/.config to a directory and modify it, then run the tool from that directory. It will create .storage to hold all the protocol state. Removing that dir and running the tool again will trigger a reregistration with the server.

Usage

Do not run multiple instances of the app from the same directory, it (and the server) can get confused

This will show the supported command line flags

textsecure -h

Running the command without arguments will put it in receiving mode, and once it receives a message it will be able to talk to that contact.

Discussions

User and developer discussions happen on the mailing list

textsecure's People

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

textsecure's Issues

Release v1.3.1 libzkgroup_linux_amd64.so needed

Just compiled the latest release from today and encountered that the library is missing on the system, which the tool wants

/usr/bin/signal: error while loading shared libraries: libzkgroup_linux_amd64.so: cannot open shared object file: No such file

and therefore don't want to start.

I just got back to Release v.1.2.14 https://github.com/signal-golang/textsecure/releases/tag/v1.2.14 and this works flawlessly and doesn't need this library.

Any Ideas?
Thanks

Go get does not work

Running the following command go get github.com/signal-golang/textsecure/cmd/textsecure I get an output of:

# github.com/signal-golang/textsecure/cmd/textsecure
go/src/github.com/signal-golang/textsecure/cmd/textsecure/main.go:139:16: not enough arguments in call to client.cmdable.Publish
        have (string, []byte)
        want (context.Context, string, interface {})

Is there another way I am supposed to be using the library?

Crayfish not working

I have built the latest version https://github.com/signal-golang/textsecure/tree/v1.4.3 and wanted to run it in gateway mode like @morph027 documented it in https://morph027.gitlab.io/signal-web-gateway/

Unfortunately the crayfish does not work.
When starting the program, following output is logged:

level=info msg="[textsecure] Checking certificate"
level=debug msg="[textsecure] GetRegisteredContacts"
level=info msg="[textsecure-crayfish] Starting crayfish-backend"
level=error msg="[textsecure-crayfish] crayfish not found"
level=debug msg="[textsecure-crayfish-ws] BackendStartListening"
level=debug msg="[textsecure-crayfish-ws] websocket connecting to crayfish-server"
level=error msg="dial tcp [::1]:9081: connect: connection refused"
level=error msg="[textsecure-crayfish-ws] Failed to start listening" error="dial tcp [::1]:9081: connect: connection refused"
level=info msg="[crayfish] /home/signal\n"
level=info msg="[textsecure-crayfish-ws] out: /home/signal\n\n"
level=info msg="[textsecure-crayfish-ws] err: \n"
level=info msg="[textsecure-crayfish] Crayfish-backend finished with error: <nil>"

therefore it also unsuccessfully tries to connect to the crayfish server:

level=debug msg="[textsecure] Websocket sending message"
level=debug msg="[textsecure-crayfish-ws] websocket connecting to crayfish-server"
level=error msg="dial tcp [::1]:9081: connect: connection refused"
level=error msg="[textsecure-crayfish-ws] Failed to start listening" error="dial tcp [::1]:9081: connect: connection refused"
level=debug msg="[textsecure-crayfish-ws] websocket connecting to crayfish-server"
level=error msg="dial tcp [::1]:9081: connect: connection refused"
level=error msg="[textsecure-crayfish-ws] Failed to start listening" error="dial tcp [::1]:9081: connect: connection refused"
level=debug msg="[textsecure-crayfish-ws] websocket connecting to crayfish-server"
level=error msg="dial tcp [::1]:9081: connect: connection refused"

Any idea what I'm missing?

The service runs just as the low privileged signal user.

ed25519/extra25519 change of repositories

While trying to get this project up and running, I see that https://github.com/agl/ed25519 is now deprecated and has moved to https://github.com/golang/crypto/tree/master/ed25519.

For now, I've forked the original project https://github.com/pieterbork/ed25519 and this project https://github.com/pieterbork/textsecure and changed all of the imports to build successfully. However, it seems like the correct solution is to point at the official crypto/ed25519 repo, but I'm not sure what to do about extra25519 as it is imported multiple times in textsecure and doesn't seem to be present in crypto/ed25519.

Any way to accept a group invite ?

Hi i use "signal-web-gateway" wich uses textsecure to send signal messages from check_mk.
This works fine to a single contact.

We want to send to a group which basically seems to be possible.
The problem is that i found no way to accept the group invitation with textsecure.

Is there any way or workaround to achieve this ?

Thanks in advanced!

Unable to send messages using latest build

I've just rebuild the signal commandline binary using the latest build and can't send messages.

The log says:

INFO[2021/01/24 20:39:56] Registration done.                           
DEBU[2021/01/24 20:39:56] [textsecure] missing my uuid defer           
DEBU[2021/01/24 20:39:56] [textsecure] get my uuid                     
DEBU[2021/01/24 20:39:57] [textsecure] GET /v1/accounts/whoami 200     
DEBU[2021/01/24 20:39:57] [textsecure] PUT /v1/messages/+.... 409 
DEBU[2021/01/24 20:39:57] [textsecure] Mismatched devices: {MissingDevices:[2] ExtraDevices:[]} 
DEBU[2021/01/24 20:39:57] [textsecure] PUT /v1/messages/+.... 200 
DEBU[2021/01/24 20:39:57] [textsecure] SendMessageResponse: {NeedsSync:false Timestamp:1611517197065}

The mobile phone only says "Unterhaltungssitzung aktualisert"

signal-2021-01-24-204355

Unable to receive messages due to invalid MAC

After seeing an unexpected EOF on 02-09-2021, receiving messages stopped working with an error of invalid MAC.

Feb 9 16:39:13 textsecurebox TS[3321]: time="2021/02/09 16:39:13" level=error msg="[textsecure] Failed to send websocket ping message" error="tls: use of closed connection"
Feb 9 16:39:21 textsecurebox TS[3321]: 2021/02/09 16:39:21 websocket: close 1006 (abnormal closure): unexpected EOF
Feb 9 16:50:04 textsecurebox TS[3321]: time="2021/02/09 16:50:04" level=error msg="[textsecure] Failed to handle received message" error="invalid MAC for incoming message"
Feb 9 16:50:08 textsecurebox TS[3321]: time="2021/02/09 16:50:08" level=error msg="[textsecure] Failed to handle received message" error="invalid MAC for incoming message"
Feb 9 16:50:11 textsecurebox TS[3321]: time="2021/02/09 16:50:11" level=error msg="[textsecure] Failed to handle received message" error="invalid MAC for incoming message"
Feb 9 16:50:14 textsecurebox TS[3321]: time="2021/02/09 16:50:14" level=error msg="[textsecure] Failed to handle received message" error="invalid MAC for incoming message"

I am using the latest version of the library at the time of this post.

nil pointer dereference when processing attachments sent by Signal Android

Signal Android clients (at least as of 4.70.3) that send a message to a client running this repo's code will trigger a nil pointer deref in handleSingleAttachment

My initial thoughts are that it is at least partially due to this Signal Android commit, as it looks like uploadAttachmentV3 is now being called where it previously may not have been: signalapp/Signal-Android@813c820

Stack trace:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x59f75c]
goroutine 41 [running]:
github.com/signal-golang/textsecure.handleSingleAttachment(0x133a0c0, 0x0, 0x0, 0x0)
#011/home/x/mygo/src/github.com/signal-golang/textsecure/attachments.go:96 +0x38
github.com/signal-golang/textsecure.handleAttachments(0x13e4af0, 0xc, 0x13e4af0, 0x0, 0x0, 0x0)
#011/home/x/mygo/src/github.com/signal-golang/textsecure/attachments.go:135 +0x80
github.com/signal-golang/textsecure.handleDataMessage(0x1465534, 0xc, 0x2e1e75e3, 0x174, 0x13e4af0, 0x0, 0x0)
#011/home/x/mygo/src/github.com/signal-golang/textsecure/textsecure.go:457 +0x50
github.com/signal-golang/textsecure.handleMessage(0x1465534, 0xc, 0x2e1e75e3, 0x174, 0x12a2170, 0xe7, 0x150, 0x1bc, 0x1cf)
#011/home/x/mygo/src/github.com/signal-golang/textsecure/textsecure.go:421 +0x3f8
github.com/signal-golang/textsecure.handleReceivedMessage(0x12043c0, 0x1db, 0x1e0, 0x801a20, 0x1508b80)
#011/home/x/mygo/src/github.com/signal-golang/textsecure/textsecure.go:590 +0x4b8
github.com/signal-golang/textsecure.StartListening(0x0, 0x0)
#011/home/x/mygo/src/github.com/signal-golang/textsecure/websocket.go:185 +0x680

404 when sending messages

Somehow it suddenly stopped sending messages and receives a mix of 401 and 404 on requests.

time="2021/08/29 09:42:55" level=info msg="Registration done."
time="2021/08/29 09:42:55" level=debug msg="[textsecure] GetRegisteredContacts"
time="2021/08/29 09:42:56" level=debug msg="[textsecure] GET /v1/directory/auth 401\n"
time="2021/08/29 09:42:56" level=debug msg="[textsecure] getCredentials "
time="2021/08/29 09:42:56" level=debug msg="[textsecure] GetAndVerifyMultiRemoteAttestation"
time="2021/08/29 09:42:56" level=debug msg="[textsecure] PUT with auth /v1/attestation/<uuid> 401\n"
time="2021/08/29 09:42:56" level=debug msg="[textsecure] GetRegisteredContacts assestations"
time="2021/08/29 09:42:56" level=debug msg="[textsecure] GetRegisteredContacts contactDiscoveryRequest"
time="2021/08/29 09:42:56" level=debug msg="[textsecure] getContactDiscoveryRegisteredUser"
time="2021/08/29 09:42:57" level=debug msg="[textsecure] PUT with auth & cookoie /v1/discovery/<uuid> 401 \n"
time="2021/08/29 09:42:57" level=debug msg="[textsecure] GetAndVerifyMultiRemoteAttestation resp"
time="2021/08/29 09:42:57" level=info msg="Could not get contacts: Could not get get ContactDiscovery invalid character 'C' looking for beginning of value"
time="2021/08/29 09:42:57" level=debug msg="[textsecure] Websocket Connecting to signal-server"
time="2021/08/29 09:42:57" level=debug msg="[textsecure] Websocket Connected successfully"
time="2021/08/29 09:42:57" level=debug msg="[textsecure] Ask for new messages"
time="2021/08/29 09:42:57" level=info msg="[textsecure] No new messages"
time="2021/08/29 09:42:57" level=debug msg="[textsecure] Websocket sending message"
time="2021/08/29 09:43:48" level=debug msg="[textsecure] Websocket sending message"
time="2021/08/29 09:43:48" level=debug msg="[textsecure] Websocket sending message"
time="2021/08/29 09:43:48" level=debug msg="[textsecure] Websocket sending message"
time="2021/08/29 09:43:48" level=debug msg="[textsecure] Websocket sending message"
time="2021/08/29 09:43:48" level=debug msg="[textsecure] Websocket sending message"
time="2021/08/29 09:43:49" level=debug msg="[textsecure] Websocket sending message"
time="2021/08/29 09:43:49" level=debug msg="[textsecure] Websocket sending message"
time="2021/08/29 09:43:49" level=debug msg="[textsecure] Websocket sending message"
time="2021/08/29 09:43:49" level=debug msg="[textsecure] Websocket sending message"
time="2021/08/29 09:43:51" level=debug msg="[textsecure] Sending websocket ping message"
time="2021/08/29 09:43:51" level=debug msg="[textsecure] Received websocket pong message"
time="2021/08/29 09:43:54" level=debug msg="[textsecure] PUT /v1/messages/<mobile> 404\n"
time="2021/08/29 09:43:54" level=error msg="Error: status code 404"

bundle of 401 during work with texsecure

When try to do anything there is 401 error

./textsecure -showdevices
INFO[0000] [textsecure] Setting log level to debug
INFO[2022/11/08 14:38:27] [textsecure-crayfish] Starting crayfish-backend
INFO[2022/11/08 14:38:27] Registration done.
DEBU[2022/11/08 14:38:27] [textsecure] saving config +79636044365
DEBU[2022/11/08 14:38:27] [textsecure] UpdateProfile ab334dad-75e5-4b1d-a210-bb522e8a332d argon
DEBU[2022/11/08 14:38:27] [crayfish] starting crayfish e76f1cb11caad441c7961a14243d5c78fdeee2dc
DEBU[2022/11/08 14:38:27] [crayfish] Starting libsignal-service web socket at ws://127.0.0.1:9081/libsignal
DEBU[2022/11/08 14:38:28] [textsecure] PUT /v1/profile/ 401
INFO[2022/11/08 14:38:28] [textsecure] Checking certificate
INFO[2022/11/08 14:38:28] [textsecure] Using existing profile key credential 145
DEBU[2022/11/08 14:38:28] [textsecure-crayfish-ws] BackendStartListening
DEBU[2022/11/08 14:38:28] [textsecure-crayfish-ws] websocket connecting to crayfish-server
DEBU[2022/11/08 14:38:28] [textsecure-crayfish-ws] websocket Connected successfully
DEBU[2022/11/08 14:38:28] [crayfish] establishing client connection... WebSocket
DEBU[2022/11/08 14:38:28] [textsecure] GET /v1/devices/ 401

./textsecure -leavegroup string
INFO[0000] [textsecure] Setting log level to debug
INFO[2022/11/08 14:41:28] [textsecure-crayfish] Starting crayfish-backend
INFO[2022/11/08 14:41:28] Registration done.
DEBU[2022/11/08 14:41:28] [textsecure] saving config +79636044365
DEBU[2022/11/08 14:41:28] [textsecure] UpdateProfile ab334dad-75e5-4b1d-a210-bb522e8a332d argon
DEBU[2022/11/08 14:41:28] [crayfish] starting crayfish e76f1cb11caad441c7961a14243d5c78fdeee2dc
DEBU[2022/11/08 14:41:28] [crayfish] Starting libsignal-service web socket at ws://127.0.0.1:9081/libsignal
DEBU[2022/11/08 14:41:28] [textsecure] PUT /v1/profile/ 401
INFO[2022/11/08 14:41:28] [textsecure] Checking certificate
INFO[2022/11/08 14:41:28] [textsecure] Using existing profile key credential 145
DEBU[2022/11/08 14:41:28] [textsecure] GetRegisteredContacts
DEBU[2022/11/08 14:41:28] [textsecure] read contacts from .config/contacts.yml
DEBU[2022/11/08 14:41:29] [textsecure-crayfish-ws] BackendStartListening
DEBU[2022/11/08 14:41:29] [textsecure-crayfish-ws] websocket connecting to crayfish-server
DEBU[2022/11/08 14:41:29] [textsecure-crayfish-ws] websocket Connected successfully
DEBU[2022/11/08 14:41:29] [crayfish] establishing client connection... WebSocket
DEBU[2022/11/08 14:41:29] [textsecure] GET /v1/directory/auth 401
DEBU[2022/11/08 14:41:29] [textsecure] getCredentials
DEBU[2022/11/08 14:41:29] [textsecure] GetAndVerifyMultiRemoteAttestation
DEBU[2022/11/08 14:41:29] [textsecure] PUT with auth /v1/attestation/c98e00a4e3ff977a56afefe7362a27e4961e4f19e211febfbb19b897e6b80b15 401
INFO[2022/11/08 14:41:29] Could not get contacts: could not get remote attestation invalid character 'C' looking for beginning of value

textsecure gateway stops because of websocket failure

I have encountered, that the textsecure server in gateway mode stopped after some time with the error unexpected EOF because of some websocket failure. The logging level is already in debug.

I selfcompiled the binary as stated in https://morph027.gitlab.io/signal-web-gateway/installation/standalone/

From the system log:

level=debug msg="[textsecure] Received websocket pong message"
level=debug msg="[textsecure] Sending websocket ping message"
level=debug msg="[textsecure] Received websocket pong message"
level=debug msg="[textsecure] Sending websocket ping message"
level=debug msg="[textsecure] Received websocket pong message"
level=debug msg="[textsecure] Sending websocket ping message"
level=debug msg="[textsecure] Received websocket pong message"
level=error msg="websocket: close 1006 (abnormal closure): unexpected EOF"

Any Ideas?

Cheers.

requestCode SIGSEGV

I've just downloaded libzkgroup_linux_x86_64.so and moved it to /usr/lib (then sudo ldconfig).
Changed the phone number in config.yml.
Downloaded and build crayfish and run make run in cmd/textsecure

Found go with version go version go1.17.5 linux/amd64
LD_LIBRARY_PATH=/tmp/textsecure/cmd/textsecure go run .
INFO[2021/12/16 08:30:12] [textsecure-crayfish] Starting crayfish-backend 
DEBU[2021/12/16 08:30:12] [textsecure-crayfish-ws] BackendStartListening 
DEBU[2021/12/16 08:30:12] [textsecure-crayfish-ws] websocket connecting to crayfish-server 
DEBU[2021/12/16 08:30:12] [texsecure] register Device                  
DEBU[2021/12/16 08:30:12] [textsecure] loading config                  
INFO[2021/12/16 08:30:12] [textsecure] request verification code for  +421905118965 
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x894c47]

goroutine 1 [running]:
github.com/signal-golang/textsecure.requestCode({0xc000026fb0, 0xd}, {0xc000026ff8, 0x3}, {0x0, 0xc0000001a0})
	/tmp/textsecure/server.go:125 +0x1c7
github.com/signal-golang/textsecure.registerDevice()
	/tmp/textsecure/textsecure.go:421 +0x12c
github.com/signal-golang/textsecure.Setup(0xc0000ec300)
	/tmp/textsecure/textsecure.go:297 +0x28e
main.main()
	/tmp/textsecure/cmd/textsecure/main.go:507 +0xe6
exit status 2
make: *** [Makefile:97: run] Error 1

Not support for arm64

Undefined symbols for architecture arm64:
"_FFI_AuthCredentialPresentation_checkValidContents", referenced from:
__cgo_23d06c6dc298_Cfunc_FFI_AuthCredentialPresentation_checkValidContents in _x002.o
(maybe you meant: __cgo_23d06c6dc298_Cfunc_FFI_AuthCredentialPresentation_checkValidContents)

428 when sending messages

textsecure has stopped sending messages and now gives error 428 on send. I am still seeing a lot of unexpected closes, but this has not been preventing textsecure to work. Sometimes the unexpected closes cause messages to not be received. I am on the latest build.

time="2022/01/26 18:34:30" level=debug msg="[textsecure] Websocket Connecting to signal-server"
time="2022/01/26 18:34:30" level=debug msg="[textsecure] Websocket Connected successfully"
time="2022/01/26 18:34:30" level=debug msg="[textsecure] Ask for new messages"
time="2022/01/26 18:34:30" level=info msg="[textsecure] No new messages"
time="2022/01/26 18:34:30" level=debug msg="[textsecure] Websocket sending message"
time="2022/01/26 18:34:58" level=debug msg="[textsecure-crayfish-ws] Sending websocket ping message"
time="2022/01/26 18:34:58" level=debug msg="[textsecure-crayfish-ws] Received websocket pong message"
time="2022/01/26 18:35:15" level=debug msg="[textsecure] Sending websocket ping message"
time="2022/01/26 18:35:15" level=error msg="[textsecure] Failed to send websocket ping message" error="websocket: close sent"
time="2022/01/26 18:35:15" level=debug msg="[textsecure] Closing writeWorker"
time="2022/01/26 18:35:24" level=debug msg="[textsecure] Sending websocket ping message"
time="2022/01/26 18:35:24" level=debug msg="[textsecure] Received websocket pong message"
time="2022/01/26 18:35:30" level=debug msg="[textsecure] Websocket UnexpectedCloseError: websocket: close 1000 (normal): OK"
2022/01/26 18:35:30 websocket: close 1000 (normal): OK
time="2022/01/26 18:35:33" level=debug msg="[textsecure] Websocket Connecting to signal-server"
time="2022/01/26 18:35:33" level=debug msg="[textsecure] Websocket Connected successfully"
time="2022/01/26 18:35:33" level=debug msg="[textsecure] Ask for new messages"
time="2022/01/26 18:35:33" level=info msg="[textsecure] No new messages"
time="2022/01/26 18:35:33" level=debug msg="[textsecure] Websocket sending message"
time="2022/01/26 18:35:52" level=debug msg="[textsecure-crayfish-ws] Sending websocket ping message"
time="2022/01/26 18:35:52" level=debug msg="[textsecure-crayfish-ws] Received websocket pong message"
time="2022/01/26 18:36:05" level=debug msg="[textsecure] handleMessage"
time="2022/01/26 18:36:05" level=debug msg="[textsecure] handleDataMessage 1643240165277 1643240165277 86400"
time="2022/01/26 18:36:05" level=debug msg="[textsecure] PUT /v1/messages/<redacted UUID> 428\n"
time="2022/01/26 18:36:06" level=debug msg="[textsecure] PUT /v1/messages/<redacted UUID> 428\n"
time="2022/01/26 18:36:06" level=debug msg="[textsecure] PUT /v1/messages/<redacted UUID> 428\n"
time="2022/01/26 18:36:06" level=debug msg="[textsecure] Websocket sending message"

Triggering SIGSEGV by revoking Group Invite

I found a reproducible Crash in the textsecure Client

So running textsecure in Combination with a Desktop Client ist still bugging for me. For example Group Invites not working (like #43) and I can't read the messages on the Desktop Client as it only states all the time "Unterhaltungssitzung aktualisiert" on the Desktop Client.

So for the SIGSEGV Crash; How to reproduce:

  1. Make Group
  2. Invite Textsecure Client Number
  3. Client will be invited but does not automatically accepts invitations, therefore there is an open invitation for that client
  4. Revoke invitation for the invited textsecure client
  5. SIGSEGV
INFO[2021/07/23 13:51:52] [textsecure] Incoming WhisperMessage try legacy decrypting 
DEBU[2021/07/23 13:51:52] [textsecure] handleDataMessage xxxxxxxxxxxxxx xxxxxxxxxxxxxx XXXXXX 
DEBU[2021/07/23 13:51:52] [textsecure][groupsv2] signature verification succesful 
DEBU[2021/07/23 13:51:52] [textsecure][groupsv2] handle group action  <ID> 
DEBU[2021/07/23 13:51:52] [textsecure][groupsv2] SourceUuid <ID> <nil> 
DEBU[2021/07/23 13:51:52] [textsecure][groupsv2] Revision 9            
DEBU[2021/07/23 13:51:52] [textsecure][groupsv2] AddPendingMembers     
DEBU[2021/07/23 13:51:52] [textsecure][groupsv2] pendingMember <MEMBERID> 
DEBU[2021/07/23 13:51:52] [textsecure][groupsv2] update group from server 
DEBU[2021/07/23 13:51:52] [textsecure][groupsv2] queryGroupChangeFromServer 
DEBU[2021/07/23 13:51:52] [textsecure][groupsv2] get groupCredentials /v1/certificate/group/XXXXX/XXXXX 
DEBU[2021/07/23 13:51:52] [textsecure] GET /v1/certificate/group/XXXXX/XXXXX 200 
DEBU[2021/07/23 13:51:53] [textsecure] GET with auth /v1/groups/ 200   
DEBU[2021/07/23 13:51:53] [textsecure][groupsv2] queryGroupChangeFromServer group 
DEBU[2021/07/23 13:51:53] [textsecure][groupsv2] decrypt group         
DEBU[2021/07/23 13:51:53] [textsecure] save groupv2 .storage/groupsv2/<GROUPID> 
DEBU[2021/07/23 13:51:53] [textsecure][groupsv2] update group from server 
DEBU[2021/07/23 13:51:53] [textsecure] Websocket sending message       


INFO[2021/07/23 13:52:08] [textsecure] Incoming WhisperMessage try legacy decrypting 
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x929083]

goroutine 1 [running]:
github.com/signal-golang/textsecure.handleDataMessage(0xDUMMY, 0xd, 0xDUMMY, 0x24, 0xDUMMY, 0xDUMMY, 0x0, 0xDUMMY)
	/go/pkg/mod/github.com/signal-golang/[email protected]/textsecure.go:491 +0x123
github.com/signal-golang/textsecure.handleMessage(0xDUMMY, 0xd, 0xDUMMY, 0x24, 0xDUMMY, 0xDUMMY, 0xfe, 0x150, 0x1d0, 0x400)
	/go/pkg/mod/github.com/signal-golang/[email protected]/textsecure.go:437 +0x50f
github.com/signal-golang/textsecure.handleReceivedMessage(0xDUMMY, 0x1e3, 0x200, 0xb0bc90, 0xDUMMY)
	/go/pkg/mod/github.com/signal-golang/[email protected]/textsecure.go:677 +0x914
github.com/signal-golang/textsecure.StartListening(0x0, 0x0)
	/go/pkg/mod/github.com/signal-golang/[email protected]/websocket.go:186 +0x31e
main.main()
	/go/pkg/mod/github.com/signal-golang/[email protected]/cmd/textsecure/main.go:649 +0x68b

I replaced some of the values with 0xDUMMY. If needed, I can share in private the full logs.

status code 401 when try to register

Hello full log with debug mode.
Phone number is hided.

LD_LIBRARY_PATH=$PWD go run .
INFO[0000] [textsecure] Setting log level to debug
INFO[2022/11/07 13:58:44] [textsecure-crayfish] Starting crayfish-backend
DEBU[2022/11/07 13:58:44] [texsecure] register Device
DEBU[2022/11/07 13:58:44] [textsecure] loading config
DEBU[2022/11/07 13:58:44] [textsecure] Crayfish registration starting
Enter Phone number beginning with + and country code like +44...>
DEBU[2022/11/07 13:58:44] [crayfish] starting crayfish e76f1cb11caad441c7961a14243d5c78fdeee2dc
DEBU[2022/11/07 13:58:44] [crayfish] Starting libsignal-service web socket at ws://127.0.0.1:9081/libsignal
DEBU[2022/11/07 13:58:45] [textsecure-crayfish-ws] BackendStartListening
DEBU[2022/11/07 13:58:45] [textsecure-crayfish-ws] websocket connecting to crayfish-server
DEBU[2022/11/07 13:58:45] [textsecure-crayfish-ws] websocket Connected successfully
DEBU[2022/11/07 13:58:45] [crayfish] establishing client connection... WebSocket
+79245-I-HIDE-IT
INFO[2022/11/07 13:59:24] 1. Goto https://signalcaptchas.org/registration/generate.html
INFO[2022/11/07 13:59:24] 2. Run the interception code in the browser terminal.
INFO[2022/11/07 13:59:24] window.onToken = function(token){alert(token);};
INFO[2022/11/07 13:59:24] 3. Solve captcha and copy the token from the alert.
DEBU[2022/11/07 13:59:39] [textsecure-crayfish-ws] Sending websocket ping message
DEBU[2022/11/07 13:59:39] [textsecure-crayfish-ws] Received websocket pong message
4. Enter captcha token>
6LfBXs0bAAAAAAjkDyyI1Lk5gBAUWfhI_bIyox5W.registration.03AEkXODADuy7uOxxShKpJkZfbyb9XVewZWNDPlabGGexss6U-RhysKquxDUZjcFsLpdI9-_TS-WoOBmlPFA9sVD2n93_90uX108EJhpswKa-8Pasf_xi9WOaK33PGN3c_5j8IoBYrcpvTfflke7Up8dCLqvKWhHJpiuGweUc0RjptMSiGJ2jYeMBoa9few5xF1bY6arSAi20VCfU_IH4FXUzMm2Rx0wLBtThdrjnZhuC9HOpOSJniPKtW0wMM8GuRUli1vVAQ7iMRe2YhtgMgm4RQaHJ07JDtCjS2xTZrv0aPsFcpv2MnACpCGrTn3W98SbeiyUvKrleTFDgcHMrdtq0ZV2H-SBIVmDi_qYdYnhAhMd69PKapcgiNalpxRJsdGzZ4tvfPSJNodFRpjTssc042-16pW0rP3pyiiHpQwFUg6UdQcKcGblWitRGentMWFeFF5b055IabSqBe7ZdTgcdpqW0YoIwPhb_MlkSnaMsoMKZM4Ab_Lxenzkeb30NwjMsV3LHKjAc7YqK17tqLez1lWNojtIVqIxDz51jHruwIudYuNq9nexn5EoLU4gwbw-CjyzRUTuWm40Z8xYjNbRV9oazlIyyFwo1JFaT-_HHxp5WNNn3K055VlDmcg2iBYzWiNOLXZdPxklpwmwPV1DEfLScIxNytpNynIiErtg7alpaf1w8eso50dpGB5EcIUpkkoSPeCaqGAl_ta5nExG8w8VOD0IwFz_v6dRVT-fVvqnxS8jOxjmVmJxtWg-kN3OVT-vewHKaYzwR3_tOHwKvYx01CZjzIhIOAir6QOtewMEjVMBMNB-WTrhkMutCShsUgb7ORkfnNhOfR18FKJJVZBvQjZbhNXQ8h8h1jMzuEuqWQomMtcmTqOoCH6ENOItC08Pu8KYCKYeH2jbqylBfyxns04qEvrQdxQNS8Wq9GPtRHi5IVixSmf3kd6Z4e047k2DIjI-Fpi21yokvWQA6OWRYjeYjUYRqEfo_m7uohJPYCc1Qb2FQiP-sNAxVSszXaFacCcB5Arx_WSkeBOcl_SABrYZur4e8y8FJradT5RHAU017Ni8Ginpj8eiV93T7FM7cLzbY3DdRNgTQUTFsIX9ZOwtK7IJf6SLV2b7morNY3g4CmCJnxNEXhJ6_HXoTw1lTWOU2E8YxLJQmxWjxoxhT5pdMXVU1OYayA1nJujjx-KERS9Ue0mi0BiP9QyPDrR0rLNaultR0aJ3U6nLc_GE3lG34tQHB2kG3KA39Qs2EMA68svejkTCV9OJH30CtYl8FdbTR4OQBU8J-TDOerTM4Alm5aM3CVffWUgzwMrnpEruukY5m59xHJDimTAP2489huaWK3pMV8dAV1GcePXxmU6SxRiI2LZy0h_bDRaq116wEFZpCiBbUIVEBFfkxpDjMDJwAJyKpc71-uf6shtlCprgLDff4Ki1M5Nji3YvW6pfNTfTwPJ1IYgLu2Mzb3dMyQ50UZQUNosMyHrbcVV7FTeWyeOn38PMaUSxOZHzSt4h8ZMDDfE4MeONa-v1ORPzQ3fSoa-tZ2_vMju4JHpNvt-bCFTDGBtTD5xEtH25s3skPI1-c
DEBU[2022/11/07 13:59:41] [textsecure-crayfish-ws] Registering via crayfish build message
DEBU[2022/11/07 13:59:41] [textsecure-crayfish-ws] Registering via crayfish send
Enter verification code>
DEBU[2022/11/07 13:59:41] [textsecure-crayfish-ws] incoming ws send message
DEBU[2022/11/07 13:59:41] [textsecure-crayfish-ws] websocket sending message
DEBU[2022/11/07 13:59:41] [crayfish] Handle registration message
DEBU[2022/11/07 13:59:42] [crayfish] Registration request was sent
DEBU[2022/11/07 13:59:42] [textsecure-crayfish-ws] incoming msg
DEBU[2022/11/07 13:59:42] [textsecure-crayfish-ws] Received websocket response message 1
039884
DEBU[2022/11/07 14:00:20] [textsecure-crayfish-ws] Registering via crayfish send verification
DEBU[2022/11/07 14:00:20] [textsecure-crayfish-ws] incoming ws send message
DEBU[2022/11/07 14:00:20] [textsecure-crayfish-ws] websocket sending message
DEBU[2022/11/07 14:00:20] [crayfish] Handle registration confirmation message
DEBU[2022/11/07 14:00:20] [crayfish] error: failed to parse json missing field name at line 1 column 322
DEBU[2022/11/07 14:00:20] [textsecure-crayfish-ws] incoming msg
DEBU[2022/11/07 14:00:20] [textsecure-crayfish-ws] Received websocket response message 2
DEBU[2022/11/07 14:00:20] [textsecure-crayfish-ws] Registering via crayfish uuid 00000000-0000-0000-0000-000000000000
DEBU[2022/11/07 14:00:20] [textsecure] saving config +792-HIDE
DEBU[2022/11/07 14:00:20] [textsecure] Crayfish registration done
DEBU[2022/11/07 14:00:20] [textsecure] generate keys
DEBU[2022/11/07 14:00:21] [textsecure] PUT /v2/keys/ 401
FATA[2022/11/07 14:00:21] status code 401
exit status 1

Library doesn't work with current Signal Desktop

Looks like due to envelope timestamps, the messages from this library don't show up with Signal Desktop version 1.32.0 and above. I tested with the CLI client to confirm. I can give more information from Signal Desktop commits if needed.

textsecure.go doesn't honor logging levels set by config

If you look at textsecure.go on line 268, it sets the logging level to debug regardless of what has been set in the config file. The proper code has been commented out for unknown reasons. This causes all kinds of stuff to be in the logs, without any control over it other than manually editing the library code after pulling it down.

error when registering: Websocket message type is nil

ERRO[2022/03/18 17:58:26] [textsecure-crayfish-ws] Websocket message type is nil {"error":"missing field `request` at line 1 column 58"}

steps to reproduce:

  • build latest commits of textsecure and crayfish
  • ./textsecure -register
  • enter phone number
  • enter captcha from url in terminal output (open the signalcaptcha:// link in browser to see the captcha)
  • above error message appears

Not receiving reactions

Hey,

I have an interesting issue: textsecure is receiving messages from all contacts normally, but for one contact it can't receive reactions. The log I get is:

go_1          | time="2022/10/16 05:44:25" level=debug msg="[textsecure-crayfish-ws] Sending envelope"
go_1          | time="2022/10/16 05:44:25" level=debug msg="[textsecure-crayfish-ws] HandleEnvelope send"
go_1          | time="2022/10/16 05:44:25" level=debug msg="[textsecure-crayfish-ws] incoming ws send message"
go_1          | time="2022/10/16 05:44:25" level=debug msg="[textsecure-crayfish-ws] websocket sending message"
go_1          | time="2022/10/16 05:44:25" level=info msg="[crayfish] Handle sealed sender decrypt message\n"
go_1          | time="2022/10/16 05:44:25" level=info msg="[crayfish] decrypt_sealed_message\n"
go_1          | time="2022/10/16 05:44:25" level=info msg="[crayfish] opening storage at location Some(\"/root/.local/share/textsecure.nanuc\")\nStorage::open\n"
go_1          | time="2022/10/16 05:44:25" level=info msg="[crayfish] load_file_sync \"/root/.local/share/textsecure.nanuc/.storage/identity/regid\"\nOpening unencrypted file \"/root/.local/share/textsecure.nanuc/.storage/identity/regid\"\n"
go_1          | time="2022/10/16 05:44:25" level=debug msg="[textsecure-crayfish-ws] incoming msg"
go_1          | time="2022/10/16 05:44:25" level=debug msg="[textsecure-crayfish-ws] Received websocket response message 3"
go_1          | time="2022/10/16 05:44:25" level=debug msg="[textsecure-crayfish-ws] websocket sending ack response "
go_1          | time="2022/10/16 05:44:25" level=debug msg="[textsecure-crayfish-ws] incoming ws send message"
go_1          | time="2022/10/16 05:44:25" level=debug msg="[textsecure-crayfish-ws] websocket sending message"
go_1          | time="2022/10/16 05:44:25" level=debug msg="[textsecure-crayfish-ws] HandleEnvelope recieved an response"
go_1          | time="2022/10/16 05:44:25" level=info msg="[textsecure] handleReceivedMessage: +00 "
go_1          | time="2022/10/16 05:44:25" level=debug msg="[textsecure] handleMessage"
go_1          | time="2022/10/16 05:44:25" level=error msg="[textsecure] Unknown message content received "
go_1          | time="2022/10/16 05:44:25" level=debug msg="[textsecure] Websocket sending message"
go_1          | time="2022/10/16 05:44:25" level=debug msg="[textsecure-crayfish-ws] incoming msg"
go_1          | time="2022/10/16 05:44:25" level=error msg="[textsecure-crayfish-ws] Websocket message type is nil {\"error\":\"missing field `request` at line 1 column 58\"}"

Due to the fact that the line [textsecure] handleReceivedMessage: +00 can't even print the phonenumber, I guess something with decrypting the envelope is broken. This log appears in the switch case signalservice.Envelope_UNIDENTIFIED_SENDER in the method handleReceivedMessage(env *signalservice.Envelope) error in textsecure.go.

Can I reset something with the contact? To execute EndSession(uuid string, msg string) (uint64, error) did not help ๐Ÿ˜ž

And at the same time, receiving messages from this contact works great. And sending reactions from this contact to other contacts works also.

Stops receiving after some time when running in gateway mode

After adding the listener to gateway functions (commit) my bot/listener sometimes stops listening, but is still able to send messages.

i've noticed the following messages when this happens:

Jan 09 13:19:58 signal-gateway signal[1505]: time="2020/01/09 13:19:58" level=debug msg="[textsecure] Closing writeWorker"
Jan 12 09:49:41 signal-gateway signal[2008]: time="2020/01/12 09:49:41" level=debug msg="[textsecure] Closing writeWorker"
Jan 14 05:56:24 signal-gateway signal[5517]: time="2020/01/14 05:56:24" level=debug msg="[textsecure] Closing writeWorker"

Looks like this is affecting the receiving of messages in

textsecure/websocket.go

Lines 105 to 138 in 8ed6f75

func (c *Conn) writeWorker() {
ticker := time.NewTicker(pingPeriod)
defer func() {
log.Debugf("[textsecure] Closing writeWorker")
ticker.Stop()
c.ws.Close()
}()
for {
select {
case message, ok := <-c.send:
if !ok {
log.Errorf("[textsecure] Failed to read message from channel")
c.write(websocket.CloseMessage, []byte{})
return
}
log.Debugf("[textsecure] Websocket sending message")
if err := c.write(websocket.BinaryMessage, message); err != nil {
log.WithFields(log.Fields{
"error": err,
}).Error("[textsecure] Failed to send websocket message")
return
}
case <-ticker.C:
log.Debugf("[textsecure] Sending websocket ping message")
if err := c.write(websocket.PingMessage, nil); err != nil {
log.WithFields(log.Fields{
"error": err,
}).Error("[textsecure] Failed to send websocket ping message")
return
}
}
}
}

Should probably restart/re-open the socket handler when this happens and/or add a watchdog which supervises the websocket.

Missing / in commit c4ec2205937bdc7f86443c7d5e30baed6f06b646 causes attachments to fail

Hi, in the latest commit (c4ec220) the initial "/" are missing in the following:
ATTACHMENT_KEY_DOWNLOAD_PATH = "attachments/%s"
ATTACHMENT_ID_DOWNLOAD_PATH = "attachments/%d"
ATTACHMENT_UPLOAD_PATH = "attachments/"

These should be as follows:
ATTACHMENT_KEY_DOWNLOAD_PATH = "/attachments/%s"
ATTACHMENT_ID_DOWNLOAD_PATH = "/attachments/%d"
ATTACHMENT_UPLOAD_PATH = "/attachments/"

The initial missing "/" causes the URL to be "https://cdn2.signal.orgattachments/", which causes attachments to fail.

groupsv2 panic when add client to group or group message recivied

New message:

DEBU[2022/11/11 10:25:48] [textsecure] handleMessage
DEBU[2022/11/11 10:25:48] [textsecure] Websocket sending message
DEBU[2022/11/11 10:25:50] [textsecure] handleMessage
DEBU[2022/11/11 10:25:50] [textsecure] handleDataMessage 1668151550786 1668151550377 0
DEBU[2022/11/11 10:25:50] [textsecure][groupsv2] handle groupv2 group not found open .storage/groupsv2/259288278ceee8311f2e47c3c527f972fa1e30b7dddf279ca2b1ab2326ee2d00: no such file or directory .storage/groupsv2/259288278ceee8311f2e47c3c527f972fa1e30b7dddf279ca2b1ab2326ee2d00
DEBU[2022/11/11 10:25:50] [textsecure][groupv2] save group .storage/groupsv2/259288278ceee8311f2e47c3c527f972fa1e30b7dddf279ca2b1ab2326ee2d00
DEBU[2022/11/11 10:25:50] [textsecure][groupsv2] update group from server
DEBU[2022/11/11 10:25:50] [textsecure][groupsv2] queryGroupChangeFromServer
DEBU[2022/11/11 10:25:50] [textsecure][groupsv2] get groupCredentials
DEBU[2022/11/11 10:25:51] [textsecure] GET /v1/certificate/group/19307/19314 200
DEBU[2022/11/11 10:25:51] [textsecure] GET with auth /v1/groups/ 401
ERRO[2022/11/11 10:25:51] [textsecure][groupsv2] error updating group change from serverstatus code 401
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x58 pc=0x8255e8]

goroutine 1 [running]:
github.com/signal-golang/textsecure/groupsv2.HandleGroupsV2({0xc000180460?, 0x5?}, 0xc0000cce10?)
/home/agronovsa/go/src/signal-alerts/vendor/github.com/signal-golang/textsecure/groupsv2/groupsv2.go:313 +0x3e8
github.com/signal-golang/textsecure.handleDataMessage({0xc00011a810, 0x24}, {0xc00011a810, 0x24}, 0x1?, 0xc000536240)
/home/agronovsa/go/src/signal-alerts/vendor/github.com/signal-golang/textsecure/handler.go:86 +0x1a9
github.com/signal-golang/textsecure.handleMessage({0xc00011a810, 0x24}, {0xc00011a810, 0x24}, 0xc0000a8c60?, {0xc00052ac70, 0x5b, 0xa0})
/home/agronovsa/go/src/signal-alerts/vendor/github.com/signal-golang/textsecure/handler.go:21 +0x425
github.com/signal-golang/textsecure.handleReceivedMessage(0xc000148700)
/home/agronovsa/go/src/signal-alerts/vendor/github.com/signal-golang/textsecure/textsecure.go:636 +0xcad
github.com/signal-golang/textsecure.StartListening()
/home/agronovsa/go/src/signal-alerts/vendor/github.com/signal-golang/textsecure/websocket.go:199 +0x5df
main.main()
/home/agronovsa/go/src/signal-alerts/cmd/main.go:476 +0x8ea
exit status 2

Textsecure only supports signal server until the introduction of pni -> Dez 2022

I have build binaries for textsecure and crayfish and modified the config.yml to poin to ip address of my selfhosted signal server. Registration via crayfish does not seem to work. Nothing happens after entering phone number, signal captcha, user name. Verification code is never requested. Am i missing anything for setup.

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.