From cec230796cbb5908d2b3fbd0e9de0d76fe723064 Mon Sep 17 00:00:00 2001 From: SovereigntyIsNotFreedom Date: Mon, 3 Mar 2025 18:40:15 +0000 Subject: [PATCH] added readme --- simpleP/README.md | 12 +++++++ simpleP/README.md~ | 12 +++++++ simpleP/main.py | 83 ---------------------------------------------- 3 files changed, 24 insertions(+), 83 deletions(-) create mode 100644 simpleP/README.md create mode 100644 simpleP/README.md~ diff --git a/simpleP/README.md b/simpleP/README.md new file mode 100644 index 0000000..4a65444 --- /dev/null +++ b/simpleP/README.md @@ -0,0 +1,12 @@ +This is the code to check if a simplex link is valid and joinable. +Steps to make the script work: +1) Download the simplex-chat cli client. You can follow this guide https://simplex.chat/docs/cli.html#download-chat-client. +2) Create an account for the bot -> simplex-chat-ubuntu-22_04-x86-64 -d $HOME/.simplex/simplep-bot -x + Use -x flag to use tor. +3) Create a virtual environment and install websockets module \ + python3 -m venv my_venv + source my_venv/bin/activate + pip install websockets +4) Start a websocket(chat server) -> simplex-chat-ubuntu-22_04-x86-64 -x -p 3030 -d simplep-bot + You can use any port number. Make sure to change the port number in the script as well. Here we are using port 3030. +5) Call the is_simplex_link_valid(`link`) function. diff --git a/simpleP/README.md~ b/simpleP/README.md~ new file mode 100644 index 0000000..94b3b5c --- /dev/null +++ b/simpleP/README.md~ @@ -0,0 +1,12 @@ +This is the code to check if a simplex link is valid and joinable. +Steps to make the script work: +1) Download the simplex-chat cli client. You can follow this guide https://simplex.chat/docs/cli.html#download-chat-client. +2) Create an account for the bot -> simplex-chat-ubuntu-22_04-x86-64 -d $HOME/.simplex/simplep-bot -x + Use -x flag to use tor. +3) Create a virtual environment and install websockets module \ + python3 -m venv my_venv + source my_venv/bin/activate + pip install websockets +4) Start a websocket(chat server) -> simplex-chat-ubuntu-22_04-x86-64 -x -p 3030 -d simplep-bot + You can use any port number. Make sure to change the port number in the script as well. Here we are using port 3030. +5) Call the is_simplex_link_valid(link) function. diff --git a/simpleP/main.py b/simpleP/main.py index 7e7a24d..2614475 100644 --- a/simpleP/main.py +++ b/simpleP/main.py @@ -3,51 +3,6 @@ import json import random -# 'groupProfile' -# displayName - - -# send_message = "#tesr SimpleX is really great." -# send_message = "/c " -# send_message = "/gp tesr" - -chat = "https://simplex.chat/contact#/?v=2-7&smp=smp%3A%2F%2Fu2dS9sG8nMNURyZwqASV4yROM28Er0luVTx5X1CsMrU%3D%40smp4.simplex.im%2FFZScXyGUCmbSINL837cLOlEdpTGusx4d%23%2F%3Fv%3D1-3%26dh%3DMCowBQYDK2VuAyEA2VHcAyxrlxX9eWXIU-VkkXHzsfLGd9KrAPOZ7U36qAs%253D%26srv%3Do5vmywmrnaxalvz6wi3zicyftgio6psuvyniis6gco6bp6ekl4cqj4id.onion" -group = r"https://simplex.chat/contact#/?v=2-7&smp=smp%3A%2F%2Fhpq7_4gGJiilmz5Rf-CswuU5kZGkm_zOIooSw6yALRg%3D%40smp5.simplex.im%2F8SfErsx9mxKxDf43tG28e3d3AY53ExYg%23%2F%3Fv%3D1-3%26dh%3DMCowBQYDK2VuAyEAY0E79e_79XZn-nWhzjTjubWsKbUTR2DPqyjXGOSkY1k%253D%26srv%3Djjbyvoemxysm7qxap7m5d5m35jzv5qq6gnlv7s4rsn7tdwwmuqciwpid.onion&data=%7B%22groupLinkId%22%3A%22kEFv_MuLHSiq6teQ87hqYg%3D%3D%22%7D" -error_group = r"https://simplex.chat/contact#/?v=2-7&smp=smp%3A%2F%2Fhpq7_4gGJiilmz5Rf-CswuU5kZGkm_z=%7B%22groupLinkId%22%3A%22kEFv_MuLHSiq6teQ87hqYg%3D%3D%2%7D" -deleted_group = r"https://simplex.chat/contact#/?v=2-7&smp=smp%3A%2F%2Fhpq7_4gGJiilmz5Rf-CswuU5kZGkm_zOIooSw6yALRg%3D%40smp5.simplex.im%2F13jrHyHfGDSROmVb3a54C6fsF7rfYpkX%23%2F%3Fv%3D1-3%26dh%3DMCowBQYDK2VuAyEAd5Zap4vAhLICUvUJo-mSY-6lgYX_-EqTI7saDuypsQ8%253D%26srv%3Djjbyvoemxysm7qxap7m5d5m35jzv5qq6gnlv7s4rsn7tdwwmuqciwpid.onion&data=%7B%22groupLinkId%22%3A%22m1HwUMtTE-cOLcz9x9fGSw%3D%3D%22%7D" -deleted_link = r"https://simplex.chat/contact#/?v=2-7&smp=smp%3A%2F%2Fhpq7_4gGJiilmz5Rf-CswuU5kZGkm_zOIooSw6yALRg%3D%40smp5.simplex.im%2FJxdzGApxYi_v9nH_f1PBuqxJX8fMlPDi%23%2F%3Fv%3D1-3%26dh%3DMCowBQYDK2VuAyEAZnaMzINXoeqcUFOm8RGLMCvFdur3Ec5KypmDuE0JWwA%253D%26srv%3Djjbyvoemxysm7qxap7m5d5m35jzv5qq6gnlv7s4rsn7tdwwmuqciwpid.onion&data=%7B%22groupLinkId%22%3A%22Te5H_jv1djyx4DflJlstjQ%3D%3D%22%7D" - -# group_name = response['resp']['groups'][2][0]['groupProfile']['displayName'] - - -# def is_simplex_url_valid(simplex_link: str): -# with connect("ws://localhost:3030") as websocket: -# query = f"/groups" -# command = { -# 'corrId': f"id{random.randint(0,999999)}", -# 'cmd': query, -# } -# websocket.send(json.dumps(command)) -# message = websocket.recv() -# response = json.loads(message) -# number_of_groups = len(response['resp']['groups']) -# try: -# with open("dave.txt",'r+') as f: -# for i in range(0,number_of_groups): -# f.seek(0) -# group_name = response['resp']['groups'][i][0]['groupProfile']['displayName'] -# file_values = f.read().splitlines() -# if group_name in file_values: -# continue -# else: -# f.write(f"{group_name}\n") -# except Exception as e: -# print(f"end {e}") - - - -# is_simplex_url_valid(group) - def is_simplex_link_valid(simplex_link: str) -> bool: """ @@ -69,41 +24,3 @@ def is_simplex_link_valid(simplex_link: str) -> bool: elif 'deleted' in repsonse_type.lower(): return False return True - -result = is_simplex_link_valid(deleted_group) -print(result) - - - - -# def check_simplex_url_and_join(simplex_link: str): -# with connect("ws://localhost:3030") as websocket: -# query = f"/c {simplex_link}" -# desc_query = f"/gp {simplex_link}" -# command = { -# 'corrId': f"id{random.randint(0,999999)}", -# 'cmd': query, -# } -# websocket.send(json.dumps(command)) -# message = websocket.recv() -# response = json.loads(message) -# link_type = response['resp']['type'] -# # group_name = response['resp']['groupInfo']['groupProfile']['displayName'] -# command = { -# 'corrId': f"id{random.randint(0,999999)}", -# 'cmd': desc_query, -# } -# websocket.send(json.dumps(command)) -# message = websocket.recv() -# response = json.loads(message) -# print(response) -# # group_desc = response['resp']['groupInfo']['groupProfile']['displayName']['description'] - - - -# print(response['resp']) -# # print(f"{response['resp']['groupInfo']['groupProfile']['displayName']}") - - - -# check_simplex_url_and_join(group) \ No newline at end of file