From 17684c98904bccefed94f0410d80e097a18cbf2a Mon Sep 17 00:00:00 2001 From: Eyn Date: Sat, 20 Jul 2024 17:45:19 +0300 Subject: [PATCH 1/3] Hexn: Claim and start farming --- bots/hexn/client.py | 45 ++++++++++++++++++++++++++++++++------------ bots/hexn/strings.py | 2 ++ 2 files changed, 35 insertions(+), 12 deletions(-) diff --git a/bots/hexn/client.py b/bots/hexn/client.py index 39f9588..792241b 100644 --- a/bots/hexn/client.py +++ b/bots/hexn/client.py @@ -4,7 +4,7 @@ from bots.base.base import BaseFarmer from bots.hexn.strings import HEADERS, URL_INIT, URL_LOGIN, URL_START_FARMING, MSG_REFRESH, URL_REFRESH_TOKEN, \ - MSG_FARMING_STARTED, MSG_FARMING_ALREADY_STARTED, MSG_FARMING_ERROR, MSG_UNKNOWN_RESPONSE + MSG_FARMING_STARTED, MSG_FARMING_ALREADY_STARTED, MSG_FARMING_ERROR, MSG_UNKNOWN_RESPONSE, URL_CLAIM, MSG_CLAIMED DEFAULT_EST_TIME = 60 * 10 @@ -16,8 +16,9 @@ class BotFarmer(BaseFarmer): auth_data = None balance = None end_time = None - - initialization_data = dict(peer=name, bot=name, url=URL_INIT) + farming_data = None + referral = 'tgWebAppStartParam=63b093b0-fcb8-41b5-8f50-bc61983ef4e3' + initialization_data = dict(peer=name, bot=name, url=URL_INIT, start_param=referral) def set_headers(self, *args, **kwargs): self.headers = HEADERS.copy() @@ -36,9 +37,9 @@ def authenticate(self, *args, **kwargs): result = self.post(URL_LOGIN, json=data) if result.status_code == 200: - jsonData = result.json() + json_data = result.json() - if jsonData['status'] == 'ERROR' and jsonData['error']['code'] == 'NOT_REGISTERED': + if json_data['status'] == 'ERROR' and json_data['error']['code'] == 'NOT_REGISTERED': self.is_alive = False return @@ -54,24 +55,29 @@ def set_start_time(self): est_time = DEFAULT_EST_TIME self.start_time = time() + est_time - def start_farming(self): + def check_farming_status(self): data = { 'platform': 'WEB', } result = self.post(URL_START_FARMING, json=data) - if result.status_code == 200: response_json = result.json() error = response_json.get('error') - data = response_json.get('data') if error: error_code = error.get('code') if error_code == 'PENDING_FARMING_EXISTS': - self.log(MSG_FARMING_ALREADY_STARTED) - farming_details = error.get('details', {}).get('farming', {}) - self.end_time = farming_details.get('end_at', 0) // 1000 + details = error.get('details', {}) + self.farming_data = details.get('farming', {}) + + if self.farming_data.get('end_at', 0) // 1000 > time(): + self.log(MSG_FARMING_ALREADY_STARTED) + self.start_time = self.farming_data.get('end_at', 0) // 1000 + + return + else: + self.claim() else: self.log(MSG_FARMING_ERROR) elif data: @@ -96,5 +102,20 @@ def generate_fingerprint(): return hex_string + def claim(self): + + data = { + 'platform': 'WEB', + 'farming_uuid': self.farming_data.get('uuid') + } + + result = self.post(URL_CLAIM, json=data) + response_json = result.json() + if response_json.get('status') == 'OK': + self.log(MSG_CLAIMED) + self.check_farming_status() + else: + self.log(MSG_FARMING_ERROR) + def farm(self): - self.start_farming() + self.check_farming_status() diff --git a/bots/hexn/strings.py b/bots/hexn/strings.py index 10acea8..a07d046 100644 --- a/bots/hexn/strings.py +++ b/bots/hexn/strings.py @@ -2,6 +2,7 @@ URL_LOGIN = 'https://api.hexn.cc/v1/kyc/auth/telegram/sign-in-mini-app' URL_REFRESH_TOKEN = 'https://api.hexn.cc/v1/kyc/auth/telegram/sign-in-mini-app' URL_START_FARMING = 'https://api.hexn.cc/v1/kyc/marketing/farming/start' +URL_CLAIM = 'https://api.hexn.cc/v1/kyc/marketing/farming/claim/' HEADERS = { 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36 Edg/126.0.0.0' @@ -13,3 +14,4 @@ MSG_FARMING_STARTED = "Фарминг успешно запущен" MSG_FARMING_ERROR = "Ошибка фарминга" MSG_UNKNOWN_RESPONSE = "Неизвестный ответ" +MSG_CLAIMED = 'Собрал монеты' From 1ff9ba8e7bef839961802e0420319a616c037ba9 Mon Sep 17 00:00:00 2001 From: Eyn Date: Sat, 20 Jul 2024 19:14:53 +0300 Subject: [PATCH 2/3] Fix end time --- bots/hexn/client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bots/hexn/client.py b/bots/hexn/client.py index 792241b..5258986 100644 --- a/bots/hexn/client.py +++ b/bots/hexn/client.py @@ -73,7 +73,7 @@ def check_farming_status(self): if self.farming_data.get('end_at', 0) // 1000 > time(): self.log(MSG_FARMING_ALREADY_STARTED) - self.start_time = self.farming_data.get('end_at', 0) // 1000 + self.end_time = self.farming_data.get('end_at', 0) // 1000 return else: From e869fb1fae09a751afeda1083e08fd73fd3dc87d Mon Sep 17 00:00:00 2001 From: Eyn Date: Sat, 20 Jul 2024 19:37:32 +0300 Subject: [PATCH 3/3] Add HEXN to Readme --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 5db1975..c41091d 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,7 @@ - [anon](https://t.me/AnonEarnBot) (Нужно сперва зарегистрироваться в боте, рефералки можно искать в чате проекта) - [hamster kombat](https://t.me/Hamster_kombat_bot/start?startapp=kentId102796269) - [TapCoinsBot](https://t.me/tapcoinsbot/app?startapp=ref_QjG2zG) +- [HEXN](https://t.me/hexn_bot/app?startapp=63b093b0-fcb8-41b5-8f50-bc61983ef4e3) Боты начнут последовательно фармить на каждом аккаунте