security changes
This commit is contained in:
parent
48fa6ca490
commit
5fd2477e2a
1 changed files with 7 additions and 2 deletions
|
|
@ -4,6 +4,7 @@ import requests
|
||||||
import datetime
|
import datetime
|
||||||
import math
|
import math
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import base64
|
||||||
|
|
||||||
logfiledir = '/home/hubobel/'
|
logfiledir = '/home/hubobel/'
|
||||||
logfilepath = logfiledir + 'rclone.log'
|
logfilepath = logfiledir + 'rclone.log'
|
||||||
|
|
@ -16,7 +17,7 @@ result_msg = []
|
||||||
start = datetime.datetime.now()
|
start = datetime.datetime.now()
|
||||||
|
|
||||||
telegram_chat_id = "322673713"
|
telegram_chat_id = "322673713"
|
||||||
telegram_token = "6828697809:AAHsdnom53SQGaYdgQBUrxrD2cMkwurupKI"
|
telegram_token ='NjgyODY5NzgwOTpBQUhzZG5vbTUzU1FHYVlkZ1FCVXJ4ckQyY01rd3VydXBLSQ=='
|
||||||
|
|
||||||
def parse_log(logfile, source, target):
|
def parse_log(logfile, source, target):
|
||||||
|
|
||||||
|
|
@ -80,8 +81,12 @@ def convert_size(size_bytes):
|
||||||
return "%s %s" % (s, size_name[i])
|
return "%s %s" % (s, size_name[i])
|
||||||
|
|
||||||
def notify_telegram(text):
|
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}
|
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)
|
requests.post(url, params=params)
|
||||||
|
|
||||||
basecmd = ('rclone ' + str('copy') + ' --log-file=' + str(logfilepath) +
|
basecmd = ('rclone ' + str('copy') + ' --log-file=' + str(logfilepath) +
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue