mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-28 18:10:38 +00:00
Rename to signal-cli
Changes experimental dbus interface from org.asamk.TextSecure to org.asamk.Signal
This commit is contained in:
parent
10719a443a
commit
eabd361405
27 changed files with 108 additions and 108 deletions
46
README.md
46
README.md
|
@ -1,72 +1,72 @@
|
|||
# textsecure-cli
|
||||
# signal-cli
|
||||
|
||||
textsecure-cli is a commandline interface for [libtextsecure-java](https://github.com/WhisperSystems/libtextsecure-java). It supports registering, verifying, sending and receiving messages. To be able to receiving messages textsecure-cli uses a [patched libtextsecure-java](https://github.com/AsamK/libtextsecure-java), because libtextsecure-java [does not yet support registering for the websocket support](https://github.com/WhisperSystems/libtextsecure-java/pull/5). For registering you need a phone number where you can receive SMS or incoming calls.
|
||||
signal-cli is a commandline interface for [libtextsecure-java](https://github.com/WhisperSystems/libtextsecure-java). It supports registering, verifying, sending and receiving messages. To be able to receiving messages signal-cli uses a [patched libtextsecure-java](https://github.com/AsamK/libtextsecure-java), because libtextsecure-java [does not yet support registering for the websocket support](https://github.com/WhisperSystems/libtextsecure-java/pull/5). For registering you need a phone number where you can receive SMS or incoming calls.
|
||||
It is primarily intended to be used on servers to notify admins of important events. For this use-case, it has a dbus interface, that can be used to send messages from any programming language that has dbus bindings.
|
||||
|
||||
## Usage
|
||||
|
||||
usage: textsecure-cli [-h] [-u USERNAME] [-v] {register,verify,send,quitGroup,updateGroup,receive} ...
|
||||
usage: signal-cli [-h] [-u USERNAME] [-v] {register,verify,send,quitGroup,updateGroup,receive} ...
|
||||
|
||||
* Register a number (with SMS verification)
|
||||
|
||||
textsecure-cli -u USERNAME register
|
||||
signal-cli -u USERNAME register
|
||||
|
||||
* Register a number (with voice verification)
|
||||
|
||||
textsecure-cli -u USERNAME register -v
|
||||
signal-cli -u USERNAME register -v
|
||||
|
||||
* Verify the number using the code received via SMS or voice
|
||||
|
||||
textsecure-cli -u USERNAME verify CODE
|
||||
signal-cli -u USERNAME verify CODE
|
||||
|
||||
* Send a message to one or more recipients
|
||||
|
||||
textsecure-cli -u USERNAME send -m "This is a message" [RECIPIENT [RECIPIENT ...]] [-a [ATTACHMENT [ATTACHMENT ...]]]
|
||||
signal-cli -u USERNAME send -m "This is a message" [RECIPIENT [RECIPIENT ...]] [-a [ATTACHMENT [ATTACHMENT ...]]]
|
||||
|
||||
* Pipe the message content from another process.
|
||||
|
||||
uname -a | textsecure-cli -u USERNAME send [RECIPIENT [RECIPIENT ...]]
|
||||
uname -a | signal-cli -u USERNAME send [RECIPIENT [RECIPIENT ...]]
|
||||
|
||||
* Groups
|
||||
|
||||
* Create a group
|
||||
|
||||
textsecure-cli -u USERNAME updateGroup -n "Group name" -m [MEMBER [MEMBER ...]]
|
||||
signal-cli -u USERNAME updateGroup -n "Group name" -m [MEMBER [MEMBER ...]]
|
||||
|
||||
* Update a group
|
||||
|
||||
textsecure-cli -u USERNAME updateGroup -g GROUP_ID -n "New group name"
|
||||
signal-cli -u USERNAME updateGroup -g GROUP_ID -n "New group name"
|
||||
|
||||
* Send a message to a group
|
||||
|
||||
textsecure-cli -u USERNAME send -m "This is a message" -g GROUP_ID
|
||||
signal-cli -u USERNAME send -m "This is a message" -g GROUP_ID
|
||||
|
||||
## DBus service
|
||||
|
||||
textsecure-cli can run in daemon mode and provides an experimental dbus interface.
|
||||
signal-cli can run in daemon mode and provides an experimental dbus interface.
|
||||
For dbus support you need jni/unix-java.so installed on your system (Debian: libunixsocket-java ArchLinux: libmatthew-unix-java (AUR)).
|
||||
|
||||
* Run in daemon mode (dbus session bus)
|
||||
|
||||
textsecure-cli -u USERNAME daemon
|
||||
signal-cli -u USERNAME daemon
|
||||
|
||||
* Send a message via dbus
|
||||
|
||||
textsecure-cli --dbus send -m "Message" [RECIPIENT [RECIPIENT ...]] [-a [ATTACHMENT [ATTACHMENT ...]]]
|
||||
signal-cli --dbus send -m "Message" [RECIPIENT [RECIPIENT ...]] [-a [ATTACHMENT [ATTACHMENT ...]]]
|
||||
|
||||
### System bus
|
||||
|
||||
To run on the system bus you need to take some additional steps.
|
||||
It’s advisable to run textsecure-cli as a separate unix user, the following steps assume you created a user named *textsecure-cli*.
|
||||
It’s advisable to run signal-cli as a separate unix user, the following steps assume you created a user named *signal-cli*.
|
||||
These steps, executed as root, should work on all distributions using systemd.
|
||||
|
||||
```bash
|
||||
cp data/org.asamk.TextSecure.conf /etc/dbus-1/system.d/
|
||||
cp data/org.asamk.TextSecure.service /usr/share/dbus-1/system-services/
|
||||
cp data/textsecure.service /etc/systemd/system/
|
||||
sed -i -e "s|%dir%|<INSERT_INSTALL_PATH>|" -e "s|%number%|<INSERT_YOUR_NUMBER>|" /etc/systemd/system/textsecure.service
|
||||
cp data/org.asamk.Signal.conf /etc/dbus-1/system.d/
|
||||
cp data/org.asamk.Signal.service /usr/share/dbus-1/system-services/
|
||||
cp data/signal.service /etc/systemd/system/
|
||||
sed -i -e "s|%dir%|<INSERT_INSTALL_PATH>|" -e "s|%number%|<INSERT_YOUR_NUMBER>|" /etc/systemd/system/signal.service
|
||||
systemctl daemon-reload
|
||||
systemctl enable textsecure.service
|
||||
systemctl enable signal.service
|
||||
systemctl reload dbus.service
|
||||
```
|
||||
|
||||
|
@ -76,7 +76,7 @@ Then just execute the send command from above, the service will be autostarted b
|
|||
|
||||
The password and cryptographic keys are created when registering and stored in the current users home directory:
|
||||
|
||||
$HOME/.config/textsecure/data/
|
||||
$HOME/.config/signal/data/
|
||||
|
||||
## Building
|
||||
|
||||
|
@ -85,13 +85,13 @@ dependencies.
|
|||
|
||||
1. Checkout the source somewhere on your filesystem with
|
||||
|
||||
git clone https://github.com/AsamK/textsecure-cli.git
|
||||
git clone https://github.com/AsamK/signal-cli.git
|
||||
|
||||
2. Execute Gradle:
|
||||
|
||||
./gradlew build
|
||||
|
||||
3. Create shell wrapper in *build/install/textsecure-cli/bin*:
|
||||
3. Create shell wrapper in *build/install/signal-cli/bin*:
|
||||
|
||||
./gradlew installDist
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ apply plugin: 'application'
|
|||
sourceCompatibility = JavaVersion.VERSION_1_7
|
||||
targetCompatibility = JavaVersion.VERSION_1_7
|
||||
|
||||
mainClassName = 'org.asamk.textsecure.Main'
|
||||
mainClassName = 'org.asamk.signal.Main'
|
||||
|
||||
version = '0.2.1'
|
||||
|
||||
|
|
16
data/org.asamk.Signal.conf
Normal file
16
data/org.asamk.Signal.conf
Normal file
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0"?> <!--*-nxml-*-->
|
||||
<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
|
||||
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
|
||||
|
||||
<busconfig>
|
||||
<policy user="signal-cli">
|
||||
<allow own="org.asamk.Signal"/>
|
||||
<allow send_destination="org.asamk.Signal"/>
|
||||
<allow receive_sender="org.asamk.Signal"/>
|
||||
</policy>
|
||||
|
||||
<policy context="default">
|
||||
<allow send_destination="org.asamk.Signal"/>
|
||||
<allow receive_sender="org.asamk.Signal"/>
|
||||
</policy>
|
||||
</busconfig>
|
4
data/org.asamk.Signal.service
Normal file
4
data/org.asamk.Signal.service
Normal file
|
@ -0,0 +1,4 @@
|
|||
[D-BUS Service]
|
||||
Name=org.asamk.Signal
|
||||
Exec=/bin/false
|
||||
SystemdService=dbus-org.asamk.Signal.service
|
|
@ -1,16 +0,0 @@
|
|||
<?xml version="1.0"?> <!--*-nxml-*-->
|
||||
<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
|
||||
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
|
||||
|
||||
<busconfig>
|
||||
<policy user="textsecure-cli">
|
||||
<allow own="org.asamk.TextSecure"/>
|
||||
<allow send_destination="org.asamk.TextSecure"/>
|
||||
<allow receive_sender="org.asamk.TextSecure"/>
|
||||
</policy>
|
||||
|
||||
<policy context="default">
|
||||
<allow send_destination="org.asamk.TextSecure"/>
|
||||
<allow receive_sender="org.asamk.TextSecure"/>
|
||||
</policy>
|
||||
</busconfig>
|
|
@ -1,4 +0,0 @@
|
|||
[D-BUS Service]
|
||||
Name=org.asamk.TextSecure
|
||||
Exec=/bin/false
|
||||
SystemdService=dbus-org.asamk.TextSecure.service
|
16
data/signal-cli@.service
Normal file
16
data/signal-cli@.service
Normal file
|
@ -0,0 +1,16 @@
|
|||
[Unit]
|
||||
Description=Send secure messages to Signal clients
|
||||
Requires=dbus.socket
|
||||
After=dbus.socket
|
||||
Wants=network.target
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=dbus
|
||||
Environment=SIGNAL_CLI_OPTS="-Xms2m"
|
||||
ExecStart=%dir%/bin/signal-cli -u %I --config /var/lib/signal-cli daemon --system
|
||||
User=signal-cli
|
||||
BusName=org.asamk.Signal
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
12
data/signal.service
Normal file
12
data/signal.service
Normal file
|
@ -0,0 +1,12 @@
|
|||
[Unit]
|
||||
Description=Send secure messages to Signal clients
|
||||
|
||||
[Service]
|
||||
Type=dbus
|
||||
Environment=SIGNAL_CLI_OPTS="-Xms2m"
|
||||
ExecStart=%dir%/bin/signal-cli -u %number% --config /var/lib/signal-cli daemon --system
|
||||
User=signal-cli
|
||||
BusName=org.asamk.Signal
|
||||
|
||||
[Install]
|
||||
Alias=dbus-org.asamk.Signal.service
|
|
@ -1,16 +0,0 @@
|
|||
[Unit]
|
||||
Description=Send secure messages to TextSecure/Signal clients
|
||||
Requires=dbus.socket
|
||||
After=dbus.socket
|
||||
Wants=network.target
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=dbus
|
||||
Environment=TEXTSECURE_CLI_OPTS="-Xms2m"
|
||||
ExecStart=%dir%/bin/textsecure-cli -u %I --config /var/lib/textsecure-cli daemon --system
|
||||
User=textsecure-cli
|
||||
BusName=org.asamk.TextSecure
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
|
@ -1,12 +0,0 @@
|
|||
[Unit]
|
||||
Description=Send secure messages to TextSecure/Signal clients
|
||||
|
||||
[Service]
|
||||
Type=dbus
|
||||
Environment=TEXTSECURE_CLI_OPTS="-Xms2m"
|
||||
ExecStart=%dir%/bin/textsecure-cli -u %number% --config /var/lib/textsecure-cli daemon --system
|
||||
User=textsecure-cli
|
||||
BusName=org.asamk.TextSecure
|
||||
|
||||
[Install]
|
||||
Alias=dbus-org.asamk.TextSecure.service
|
|
@ -15,4 +15,4 @@ include 'api'
|
|||
include 'services:webservice'
|
||||
*/
|
||||
|
||||
rootProject.name = 'textsecure-cli'
|
||||
rootProject.name = 'signal-cli'
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.asamk;
|
||||
|
||||
import org.asamk.textsecure.AttachmentInvalidException;
|
||||
import org.asamk.textsecure.GroupNotFoundException;
|
||||
import org.asamk.signal.AttachmentInvalidException;
|
||||
import org.asamk.signal.GroupNotFoundException;
|
||||
import org.freedesktop.dbus.DBusInterface;
|
||||
import org.freedesktop.dbus.DBusSignal;
|
||||
import org.freedesktop.dbus.exceptions.DBusException;
|
||||
|
@ -10,7 +10,7 @@ import org.whispersystems.signalservice.api.push.exceptions.EncapsulatedExceptio
|
|||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
public interface TextSecure extends DBusInterface {
|
||||
public interface Signal extends DBusInterface {
|
||||
void sendMessage(String message, List<String> attachments, String recipient) throws EncapsulatedExceptions, AttachmentInvalidException, IOException;
|
||||
|
||||
void sendMessage(String message, List<String> attachments, List<String> recipients) throws EncapsulatedExceptions, AttachmentInvalidException, IOException;
|
|
@ -1,4 +1,4 @@
|
|||
package org.asamk.textsecure;
|
||||
package org.asamk.signal;
|
||||
|
||||
import org.freedesktop.dbus.exceptions.DBusExecutionException;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package org.asamk.textsecure;
|
||||
package org.asamk.signal;
|
||||
|
||||
/**
|
||||
* <p>Encodes and decodes to and from Base64 notation.</p>
|
|
@ -1,4 +1,4 @@
|
|||
package org.asamk.textsecure;
|
||||
package org.asamk.signal;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package org.asamk.textsecure;
|
||||
package org.asamk.signal;
|
||||
|
||||
import org.freedesktop.dbus.exceptions.DBusExecutionException;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package org.asamk.textsecure;
|
||||
package org.asamk.signal;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
|
@ -1,4 +1,4 @@
|
|||
package org.asamk.textsecure;
|
||||
package org.asamk.signal;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
|
@ -1,4 +1,4 @@
|
|||
package org.asamk.textsecure;
|
||||
package org.asamk.signal;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
|
@ -1,4 +1,4 @@
|
|||
package org.asamk.textsecure;
|
||||
package org.asamk.signal;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
|
@ -1,4 +1,4 @@
|
|||
package org.asamk.textsecure;
|
||||
package org.asamk.signal;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
|
@ -1,4 +1,4 @@
|
|||
package org.asamk.textsecure;
|
||||
package org.asamk.signal;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
|
@ -14,14 +14,14 @@
|
|||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.asamk.textsecure;
|
||||
package org.asamk.signal;
|
||||
|
||||
import net.sourceforge.argparse4j.ArgumentParsers;
|
||||
import net.sourceforge.argparse4j.impl.Arguments;
|
||||
import net.sourceforge.argparse4j.inf.*;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.http.util.TextUtils;
|
||||
import org.asamk.TextSecure;
|
||||
import org.asamk.Signal;
|
||||
import org.freedesktop.dbus.DBusConnection;
|
||||
import org.freedesktop.dbus.exceptions.DBusException;
|
||||
import org.freedesktop.dbus.exceptions.DBusExecutionException;
|
||||
|
@ -41,8 +41,8 @@ import java.util.List;
|
|||
|
||||
public class Main {
|
||||
|
||||
public static final String TEXTSECURE_BUSNAME = "org.asamk.TextSecure";
|
||||
public static final String TEXTSECURE_OBJECTPATH = "/org/asamk/TextSecure";
|
||||
public static final String SIGNAL_BUSNAME = "org.asamk.Signal";
|
||||
public static final String SIGNAL_OBJECTPATH = "/org/asamk/Signal";
|
||||
|
||||
public static void main(String[] args) {
|
||||
// Workaround for BKS truststore
|
||||
|
@ -55,7 +55,7 @@ public class Main {
|
|||
|
||||
final String username = ns.getString("username");
|
||||
Manager m;
|
||||
TextSecure ts;
|
||||
Signal ts;
|
||||
DBusConnection dBusConn = null;
|
||||
try {
|
||||
if (ns.getBoolean("dbus") || ns.getBoolean("dbus_system")) {
|
||||
|
@ -68,9 +68,9 @@ public class Main {
|
|||
busType = DBusConnection.SESSION;
|
||||
}
|
||||
dBusConn = DBusConnection.getConnection(busType);
|
||||
ts = (TextSecure) dBusConn.getRemoteObject(
|
||||
TEXTSECURE_BUSNAME, TEXTSECURE_OBJECTPATH,
|
||||
TextSecure.class);
|
||||
ts = (Signal) dBusConn.getRemoteObject(
|
||||
SIGNAL_BUSNAME, SIGNAL_OBJECTPATH,
|
||||
Signal.class);
|
||||
} catch (DBusException e) {
|
||||
e.printStackTrace();
|
||||
if (dBusConn != null) {
|
||||
|
@ -82,7 +82,7 @@ public class Main {
|
|||
} else {
|
||||
String settingsPath = ns.getString("config");
|
||||
if (TextUtils.isEmpty(settingsPath)) {
|
||||
settingsPath = System.getProperty("user.home") + "/.config/textsecure";
|
||||
settingsPath = System.getProperty("user.home") + "/.config/signal";
|
||||
}
|
||||
|
||||
m = new Manager(username, settingsPath);
|
||||
|
@ -299,8 +299,8 @@ public class Main {
|
|||
busType = DBusConnection.SESSION;
|
||||
}
|
||||
conn = DBusConnection.getConnection(busType);
|
||||
conn.exportObject(TEXTSECURE_OBJECTPATH, m);
|
||||
conn.requestBusName(TEXTSECURE_BUSNAME);
|
||||
conn.exportObject(SIGNAL_OBJECTPATH, m);
|
||||
conn.requestBusName(SIGNAL_BUSNAME);
|
||||
} catch (DBusException e) {
|
||||
e.printStackTrace();
|
||||
System.exit(3);
|
||||
|
@ -353,16 +353,16 @@ public class Main {
|
|||
}
|
||||
|
||||
private static Namespace parseArgs(String[] args) {
|
||||
ArgumentParser parser = ArgumentParsers.newArgumentParser("textsecure-cli")
|
||||
ArgumentParser parser = ArgumentParsers.newArgumentParser("signal-cli")
|
||||
.defaultHelp(true)
|
||||
.description("Commandline interface for TextSecure.")
|
||||
.description("Commandline interface for Signal.")
|
||||
.version(Manager.PROJECT_NAME + " " + Manager.PROJECT_VERSION);
|
||||
|
||||
parser.addArgument("-v", "--version")
|
||||
.help("Show package version.")
|
||||
.action(Arguments.version());
|
||||
parser.addArgument("--config")
|
||||
.help("Set the path, where to store the config (Default: $HOME/.config/textsecure-cli).");
|
||||
.help("Set the path, where to store the config (Default: $HOME/.config/signal-cli).");
|
||||
|
||||
MutuallyExclusiveGroup mut = parser.addMutuallyExclusiveGroup();
|
||||
mut.addArgument("-u", "--username")
|
||||
|
@ -630,8 +630,8 @@ public class Main {
|
|||
if (!message.isEndSession() &&
|
||||
!(message.getGroupInfo().isPresent() && message.getGroupInfo().get().getType() != SignalServiceGroup.Type.DELIVER)) {
|
||||
try {
|
||||
conn.sendSignal(new TextSecure.MessageReceived(
|
||||
TEXTSECURE_OBJECTPATH,
|
||||
conn.sendSignal(new Signal.MessageReceived(
|
||||
SIGNAL_OBJECTPATH,
|
||||
envelope.getSource(),
|
||||
message.getGroupInfo().isPresent() ? message.getGroupInfo().get().getGroupId() : new byte[0],
|
||||
message.getBody().isPresent() ? message.getBody().get() : "",
|
|
@ -14,7 +14,7 @@
|
|||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.asamk.textsecure;
|
||||
package org.asamk.signal;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||
import com.fasterxml.jackson.annotation.PropertyAccessor;
|
||||
|
@ -23,7 +23,7 @@ import com.fasterxml.jackson.databind.JsonNode;
|
|||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import org.asamk.TextSecure;
|
||||
import org.asamk.Signal;
|
||||
import org.whispersystems.libsignal.*;
|
||||
import org.whispersystems.libsignal.ecc.Curve;
|
||||
import org.whispersystems.libsignal.ecc.ECKeyPair;
|
||||
|
@ -52,8 +52,8 @@ import java.util.*;
|
|||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
class Manager implements TextSecure {
|
||||
private final static String URL = "https://SignalService-service.whispersystems.org";
|
||||
class Manager implements Signal {
|
||||
private final static String URL = "https://textsecure-service.whispersystems.org";
|
||||
private final static TrustStore TRUST_STORE = new WhisperTrustStore();
|
||||
|
||||
public final static String PROJECT_NAME = Manager.class.getPackage().getImplementationTitle();
|
|
@ -1,4 +1,4 @@
|
|||
package org.asamk.textsecure;
|
||||
package org.asamk.signal;
|
||||
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.SecureRandom;
|
|
@ -1,4 +1,4 @@
|
|||
package org.asamk.textsecure;
|
||||
package org.asamk.signal;
|
||||
|
||||
import org.whispersystems.signalservice.api.push.TrustStore;
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue