Skip to content

Commit

Permalink
Get Signal uuid and password from db directly
Browse files Browse the repository at this point in the history
  • Loading branch information
laggykiller committed Feb 25, 2024
1 parent e6e5ab1 commit 34656c9
Show file tree
Hide file tree
Showing 10 changed files with 133 additions and 384 deletions.
2 changes: 0 additions & 2 deletions AppImageBuilder-arm64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ AppDir:
- python3.11
- python3.11-tk
- python3.11-distutils
- binutils
- psmisc
exclude: []

runtime:
Expand Down
2 changes: 0 additions & 2 deletions AppImageBuilder-x86_64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ AppDir:
- python3.11
- python3.11-tk
- python3.11-distutils
- binutils
- psmisc
exclude: []

after_bundle: |
Expand Down
8 changes: 3 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -67,20 +67,18 @@ RUN apt purge -y curl wget gpg git && \
rm -rf /var/lib/{apt,dpkg,cache,log}/

FROM base-gui AS full
# Install signal-desktop-beta
# Install signal-desktop
RUN wget -O- https://updates.signal.org/desktop/apt/keys.asc | gpg --dearmor > signal-desktop-keyring.gpg && \
cat signal-desktop-keyring.gpg | tee -a /usr/share/keyrings/signal-desktop-keyring.gpg > /dev/null && \
echo 'deb [arch=amd64 signed-by=/usr/share/keyrings/signal-desktop-keyring.gpg] https://updates.signal.org/desktop/apt xenial main' |\
tee -a /etc/apt/sources.list.d/signal-xenial.list && \
apt update -y && \
apt install --no-install-recommends -y signal-desktop-beta
apt install --no-install-recommends -y signal-desktop

RUN apt purge -y curl wget gpg git && \
apt clean autoclean && \
apt autoremove --yes && \
rm -rf /var/lib/{apt,dpkg,cache,log}/

RUN mkdir -p '/root/.config/Signal' && \
mkdir -p '/root/.config/Signal Beta' && \
chmod 777 '/root/.config/Signal' && \
chmod 777 '/root/.config/Signal Beta'
chmod 777 '/root/.config/Signal'
2 changes: 1 addition & 1 deletion compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from pathlib import Path

sys.path.append("./src")
from sticker_convert.version import __version__
from sticker_convert import __version__

conan_archs = {
"x86_64": ["amd64", "x86_64", "x64"],
Expand Down
2 changes: 2 additions & 0 deletions docs/guide_signal.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

You can get them easily with `Generate` button (In GUI) or `--signal-get-auth` (In CLI)

Since v2.7.0, you can get Signal uuid and password from non-beta version of Signal.

Alternatively, follow instructions below to get them manually:

![../imgs/signal-uuid-password.png](../imgs/signal-uuid-password.png)
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ pyoxipng~=9.0.0
python-telegram-bot~=20.5
requests~=2.31.0
rlottie_python~=1.2.1
selenium~=4.17.2
signalstickers-client~=3.3.0
sqlcipher3-wheels~=0.5.2.post0
tqdm~=4.66.2
ttkbootstrap-fork-laggykiller~=1.5.1
webp~=0.3.0
19 changes: 6 additions & 13 deletions src/sticker_convert/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,22 +435,15 @@ def get_opt_cred(self, args: Namespace) -> CredOption:
self.cb.msg(f"Got auth_token successfully: {auth_token}")

if args.signal_get_auth:
m = GetSignalAuth(cb_msg=self.cb.msg, cb_ask_str=self.cb.ask_str)
m.launch_signal_desktop()
m = GetSignalAuth()

uuid, password = None, None
while True:
uuid, password = m.get_cred()
uuid, password, msg = m.get_cred()

if uuid and password:
opt_cred.signal_uuid = uuid
opt_cred.signal_password = password
if uuid and password:
opt_cred.signal_uuid = uuid
opt_cred.signal_password = password

self.cb.msg(
f"Got uuid and password successfully: {uuid}, {password}"
)
m.close()
break
self.cb.msg(msg)

if args.line_get_auth:
m = GetLineAuth()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/usr/bin/env python3
from functools import partial
from threading import Thread
from subprocess import Popen
from typing import Any

from ttkbootstrap import Button, Frame, Label, Toplevel # type: ignore
from ttkbootstrap import Button, Frame, Label # type: ignore

from sticker_convert.gui_components.gui_utils import GUIUtils
from sticker_convert.gui_components.windows.base_window import BaseWindow
Expand All @@ -20,75 +20,64 @@ def __init__(self, *args: Any, **kwargs: Any):
self.cb_ask_str_signal = partial(self.gui.cb_ask_str, parent=self)

self.frame_info = Frame(self.scrollable_frame)
self.frame_start_btn = Frame(self.scrollable_frame)
self.frame_btns = Frame(self.scrollable_frame)

self.frame_info.grid(column=0, row=0, sticky="news", padx=3, pady=3)
self.frame_start_btn.grid(column=0, row=1, sticky="news", padx=3, pady=3)
self.frame_btns.grid(column=0, row=1, sticky="news", padx=3, pady=3)

# Info frame
self.explanation1_lbl = Label(
self.explanation_lbl = Label(
self.frame_info,
text="Please install Signal Desktop BETA VERSION",
justify="left",
anchor="w",
)
self.explanation2_lbl = Label(
self.frame_info,
text="After installation, you need to login to Signal Desktop",
justify="left",
anchor="w",
)
self.explanation3_lbl = Label(
self.frame_info,
text="uuid and password will be automatically fetched",
text="Please install Signal Desktop and login first.",
justify="left",
anchor="w",
)

self.explanation1_lbl.grid(
self.explanation_lbl.grid(
column=0, row=0, columnspan=3, sticky="w", padx=3, pady=3
)
self.explanation2_lbl.grid(
column=0, row=1, columnspan=3, sticky="w", padx=3, pady=3
)
self.explanation3_lbl.grid(
column=0, row=2, columnspan=3, sticky="w", padx=3, pady=3
)

# Start button frame
self.launch_btn = Button(
self.frame_btns, text="Launch Signal Desktop", command=self.cb_launch_signal
)

self.login_btn = Button(
self.frame_start_btn, text="Get uuid and password", command=self.cb_login
self.frame_btns, text="Get uuid and password", command=self.cb_login
)

self.launch_btn.pack()
self.login_btn.pack()

GUIUtils.finalize_window(self)

def cb_login(self):
Thread(target=self.cb_login_thread, daemon=True).start()

def cb_login_thread(self, *args: Any):
m = GetSignalAuth(cb_msg=self.gui.cb_msg, cb_ask_str=self.cb_ask_str_signal)
m.launch_signal_desktop()

uuid, password = None, None
while Toplevel.winfo_exists(self):
uuid, password = m.get_cred()

if uuid and password:
if not self.gui.creds.get("signal"):
self.gui.creds["signal"] = {}
self.gui.creds["signal"]["uuid"] = uuid
self.gui.creds["signal"]["password"] = password
self.gui.signal_uuid_var.set(uuid)
self.gui.signal_password_var.set(password)
m.close()

self.cb_msg_block_signal(
f"Got uuid and password successfully:\nuuid={uuid}\npassword={password}"
)
self.gui.save_creds()
self.gui.highlight_fields()
return

self.cb_msg_block_signal("Failed to get uuid and password")
m = GetSignalAuth()
uuid, password, msg = m.get_cred()

if uuid and password:
if not self.gui.creds.get("signal"):
self.gui.creds["signal"] = {}
self.gui.creds["signal"]["uuid"] = uuid
self.gui.creds["signal"]["password"] = password
self.gui.signal_uuid_var.set(uuid)
self.gui.signal_password_var.set(password)

self.gui.save_creds()
self.gui.highlight_fields()

self.cb_msg_block_signal(msg)

def cb_launch_signal(self):
m = GetSignalAuth()
signal_bin_path, signal_user_data_dir = m.get_signal_desktop()
if signal_bin_path:
Popen(
[
signal_bin_path,
"--no-sandbox",
f"--user-data-dir={signal_user_data_dir}",
]
)
else:
self.cb_msg_block_signal("Error: Signal Desktop not installed.")
Loading

0 comments on commit 34656c9

Please sign in to comment.