mirror of
https://github.com/AsamK/signal-cli.git
synced 2026-09-01 06:28:11 +00:00
Add Bash syntax highlighting
parent
4f3da872be
commit
6533e08d33
@ -34,7 +34,7 @@ You should see a response like:
|
|||||||
|
|
||||||
If the response is empty, you must manually restart the DBus service and set the environment variable:
|
If the response is empty, you must manually restart the DBus service and set the environment variable:
|
||||||
|
|
||||||
```
|
```shell
|
||||||
brew services restart dbus
|
brew services restart dbus
|
||||||
export DBUS_LAUNCHD_SESSION_BUS_SOCKET=$(launchctl getenv DBUS_LAUNCHD_SESSION_BUS_SOCKET)
|
export DBUS_LAUNCHD_SESSION_BUS_SOCKET=$(launchctl getenv DBUS_LAUNCHD_SESSION_BUS_SOCKET)
|
||||||
```
|
```
|
||||||
@ -42,7 +42,7 @@ export DBUS_LAUNCHD_SESSION_BUS_SOCKET=$(launchctl getenv DBUS_LAUNCHD_SESSION_B
|
|||||||
Note that this will work only from a normal Macintosh desktop session.
|
Note that this will work only from a normal Macintosh desktop session.
|
||||||
|
|
||||||
To use the system bus:
|
To use the system bus:
|
||||||
```
|
```bash
|
||||||
export DBUS_SYSTEM_BUS_ADDRESS=unix:path=/usr/local/var/run/dbus/system_bus_socket
|
export DBUS_SYSTEM_BUS_ADDRESS=unix:path=/usr/local/var/run/dbus/system_bus_socket
|
||||||
```
|
```
|
||||||
This works either from a desktop session or an SSH session.
|
This works either from a desktop session or an SSH session.
|
||||||
@ -63,7 +63,7 @@ ps auxw|grep dbus|grep $(whoami)|grep session
|
|||||||
|
|
||||||
If it is running, you can rely on the notion that the most recent listener in /private/tmp is assigned to this version of dbus. (This might not be 100% reliable in the future, so proceed at your own risk.) Use the command:
|
If it is running, you can rely on the notion that the most recent listener in /private/tmp is assigned to this version of dbus. (This might not be 100% reliable in the future, so proceed at your own risk.) Use the command:
|
||||||
|
|
||||||
```
|
```bash
|
||||||
export DBUS_LAUNCHD_SESSION_BUS_SOCKET=$(find /private/tmp -user $(whoami) -type s -name unix_domain_listener -print0 | xargs -0 ls -rt|tail -n 1)
|
export DBUS_LAUNCHD_SESSION_BUS_SOCKET=$(find /private/tmp -user $(whoami) -type s -name unix_domain_listener -print0 | xargs -0 ls -rt|tail -n 1)
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ In order for `dbus-send` to work correctly, it needs to either be started from a
|
|||||||
|
|
||||||
The command to set the environment variable is:
|
The command to set the environment variable is:
|
||||||
|
|
||||||
```
|
```bash
|
||||||
export DBUS_SESSION_BUS_ADDRESS=unix:path=$DBUS_LAUNCHD_SESSION_BUS_SOCKET
|
export DBUS_SESSION_BUS_ADDRESS=unix:path=$DBUS_LAUNCHD_SESSION_BUS_SOCKET
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -133,21 +133,21 @@ The groupId is handled as an array of bytes rather than a Base64 string. (See [#
|
|||||||
|
|
||||||
The byte array can be obtained from a base64-encoded string (which looks like ixZI93QgqmjNpM8V+E0= and can be found in signal-cli's config file, by default in ~/.local/share/signal-cli/data/<PHONE_NUMBER>.d/group-cache/). Note that any underscore must be converted into a slash (/) character to provide a valid base64-encoded string. To decode it to byte array, you can use python:
|
The byte array can be obtained from a base64-encoded string (which looks like ixZI93QgqmjNpM8V+E0= and can be found in signal-cli's config file, by default in ~/.local/share/signal-cli/data/<PHONE_NUMBER>.d/group-cache/). Note that any underscore must be converted into a slash (/) character to provide a valid base64-encoded string. To decode it to byte array, you can use python:
|
||||||
|
|
||||||
```
|
```bash
|
||||||
python3 -c 'import base64; print(",".join(str(i) for i in base64.b64decode("ixZI93QgqmjNpM8V+E0=".replace("_","/"))))'
|
python3 -c 'import base64; print(",".join(str(i) for i in base64.b64decode("ixZI93QgqmjNpM8V+E0=".replace("_","/"))))'
|
||||||
```
|
```
|
||||||
or, using Bash shell syntax:
|
or, using Bash shell syntax:
|
||||||
```
|
```bash
|
||||||
echo "ixZI93QgqmjNpM8V+E0="|sed 's/_/\//g' | base64 -d |xxd -p -c1|while read i; do printf "%d " $((16#${i})); done|sed 's/ /,/g'|sed 's/,$/\n/g'
|
echo "ixZI93QgqmjNpM8V+E0="|sed 's/_/\//g' | base64 -d |xxd -p -c1|while read i; do printf "%d " $((16#${i})); done|sed 's/ /,/g'|sed 's/,$/\n/g'
|
||||||
```
|
```
|
||||||
|
|
||||||
To reverse the process:
|
To reverse the process:
|
||||||
|
|
||||||
```
|
```bash
|
||||||
python3 -c 'import base64; print(base64.b64encode(bytearray([139,22,72,247,116,32,170,104,205,164,207,21,248,77])))'
|
python3 -c 'import base64; print(base64.b64encode(bytearray([139,22,72,247,116,32,170,104,205,164,207,21,248,77])))'
|
||||||
```
|
```
|
||||||
... or using Bash ...
|
... or using Bash ...
|
||||||
```
|
```bash
|
||||||
echo "139,22,72,247,116,32,170,104,205,164,207,21,248,77"|sed 's/,/ /g'|while read i; do printf "%02x" ${i}; done|sed 's/^/00000000: /g'|xxd -r -c 256|base64
|
echo "139,22,72,247,116,32,170,104,205,164,207,21,248,77"|sed 's/,/ /g'|while read i; do printf "%02x" ${i}; done|sed 's/^/00000000: /g'|xxd -r -c 256|base64
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user