security changes

This commit is contained in:
hubobel 2025-04-20 16:15:43 +02:00
parent 48fa6ca490
commit 5fd2477e2a

View file

@ -4,6 +4,7 @@ import requests
import datetime
import math
import subprocess
import base64
logfiledir = '/home/hubobel/'
logfilepath = logfiledir + 'rclone.log'
@ -16,7 +17,7 @@ result_msg = []
start = datetime.datetime.now()
telegram_chat_id = "322673713"
telegram_token = "6828697809:AAHsdnom53SQGaYdgQBUrxrD2cMkwurupKI"
telegram_token ='NjgyODY5NzgwOTpBQUhzZG5vbTUzU1FHYVlkZ1FCVXJ4ckQyY01rd3VydXBLSQ=='
def parse_log(logfile, source, target):
@ -80,8 +81,12 @@ def convert_size(size_bytes):
return "%s %s" % (s, size_name[i])
def notify_telegram(text):
base64_string = telegram_token
base64_bytes = base64_string.encode("ascii")
sample_string_bytes = base64.b64decode(base64_bytes)
sample_string = sample_string_bytes.decode("ascii")
params = {"parse_mode": "HTML", "chat_id": telegram_chat_id, "text": text}
url = f"https://api.telegram.org/bot{telegram_token}/sendMessage"
url = f"https://api.telegram.org/bot{sample_string}/sendMessage"
requests.post(url, params=params)
basecmd = ('rclone ' + str('copy') + ' --log-file=' + str(logfilepath) +