Compare commits
4 Commits
19f72612cd
...
4c15418d6f
Author | SHA1 | Date | |
---|---|---|---|
4c15418d6f | |||
9e7424efe2 | |||
eca21bb3d0 | |||
ddbb77c59e |
28
alert/bark/ciphertxt.sh
Normal file
28
alert/bark/ciphertxt.sh
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Documentation: https://bark.day.app/#/encryption
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# bark key
|
||||||
|
deviceKey='PFEMc4eVAQutUrcAbXrVCb'
|
||||||
|
# push payload
|
||||||
|
# json='{"body": "test", "sound": "birdsong"}'
|
||||||
|
json=`cat /opt/scripts/alert/bark/option.json`
|
||||||
|
|
||||||
|
# 必须32位
|
||||||
|
key='sqCT9wE25eS2kMYu6BCGN4f9ymx2Fsmj'
|
||||||
|
# IV可以是随机生成的,但如果是随机的就需要放在 iv 参数里传递。
|
||||||
|
iv='QA475QXtg4YaGQzc'
|
||||||
|
|
||||||
|
# OpenSSL 要求输入的 Key 和 IV 需使用十六进制编码。
|
||||||
|
key=$(printf $key | xxd -ps -c 200)
|
||||||
|
iv=$(printf $iv | xxd -ps -c 200)
|
||||||
|
|
||||||
|
ciphertext=$(echo -n $json | openssl enc -aes-256-cbc -K $key -iv $iv | base64)
|
||||||
|
|
||||||
|
# 删除密文中的空格
|
||||||
|
ciphertext=`echo $ciphertext | tr -d ' '`
|
||||||
|
|
||||||
|
# 密文可能有特殊字符,所以记得 URL 编码一下。
|
||||||
|
curl --data-urlencode "ciphertext=$ciphertext" --data-urlencode "iv=QA475QXtg4YaGQzc" https://bark.erratic.eu.org/$deviceKey
|
51
alert/bark/msgsend.py
Normal file
51
alert/bark/msgsend.py
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
#!/usr/bin/python3
|
||||||
|
import sys
|
||||||
|
import json
|
||||||
|
import os
|
||||||
|
|
||||||
|
|
||||||
|
def usage():
|
||||||
|
pformat = "%-7s%-6s%-10s%-10s%-10s%-10s%-10s%-10s%-10s%-10s%-10s"
|
||||||
|
sformat = "%-23s%-18s%-16s%-14s%-14s%-12s%-12s"
|
||||||
|
print(pformat % ('must', 'must', 'optional', 'optional', 'optional', 'optional', 'optional', 'optional', 'optional', 'optional', 'optional'))
|
||||||
|
print(pformat % ('title', 'body', 'sound', 'icon', 'group', 'copy', 'autoCopy', 'badge', 'url', 'isArchive', 'level'))
|
||||||
|
print(pformat % ('-', '-', '2.0-alarm', '-', '-', '-', '1', '-', '-', '1', 'active'))
|
||||||
|
print(pformat % ('-', '-', '1.4-bell', '-', '-', '-', '1', '-', '-', '1', 'timeSensitive'))
|
||||||
|
print(pformat % ('-', '-', '1.6-bloom', '-', '-', '-', '1', '-', '-', '1', 'passive'))
|
||||||
|
print("\nThe 'sound' parameter also accepts the following as its value:")
|
||||||
|
print(sformat % ("1.8-healthnotification", "2.6-typewriters", "2.9-newsflash", "1.5-mailsent", "1.5-tiptoes", "4.5-update", "2.9-spell"))
|
||||||
|
print(sformat % ("2.2-multiwayinvitation", "4.5-anticipate", "1.2-telegraph", "0.9-calypso", "1.5-newmail", "1.7-glass", "2.2-choo"))
|
||||||
|
print(sformat % ("1.4-paymentsuccess", "1.5-electronic", "0.7-birdsong", "1.9-descent", "1.3-ladder", "4.5-chime", "1.5-horn"))
|
||||||
|
print(sformat % ("4.7-sherwoodforest", "3.0-gotosleep", "4.2-suspense", "1.5-fanfare", "7.0-minuet", "0.6-shake", "1.9-noir"))
|
||||||
|
exit(8)
|
||||||
|
|
||||||
|
|
||||||
|
def getParams(params):
|
||||||
|
if len(params) < 2 or len(params) > 11:
|
||||||
|
print('Need at least 2 parameters, and most can have 11 parameters, exiting...')
|
||||||
|
exit(99)
|
||||||
|
|
||||||
|
params_dict = {'title': '', 'body': '', 'sound': '', 'icon': '', 'group': 'alert', 'copy': '', 'autocopy': '', 'badge': '', 'url': '', 'isarchive': '1', 'level': 'active'}
|
||||||
|
elements = ['title', 'body', 'sound', 'icon', 'group', 'copy', 'autocopy', 'badge', 'url', 'isarchive', 'level', 'ciphertxt', 'device_key']
|
||||||
|
for i in range(len(params)):
|
||||||
|
params_dict[elements[i]] = params[i]
|
||||||
|
|
||||||
|
params_json = json.dumps(params_dict)
|
||||||
|
with open('/opt/scripts/alert/bark/option.json', 'w') as obj_option:
|
||||||
|
obj_option.write(params_json)
|
||||||
|
|
||||||
|
os.system('/usr/bin/bash /opt/scripts/alert/bark/ciphertxt.sh')
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
if len(sys.argv) == 1:
|
||||||
|
usage()
|
||||||
|
|
||||||
|
params = sys.argv[1:]
|
||||||
|
getParams(params)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
|
|
||||||
|
|
1
alert/bark/option.json
Normal file
1
alert/bark/option.json
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"title": "TODO TIPS", "body": "Today, you NEED to finish the following task:\n a. +life | Happy weekend~\n\n18 days left to finish the following task:\n a. +cici | Special day for Cici(last for 0821)\n\n49 days left to finish the following task:\n a. +microsoft | Azure 100\u7eed\u8ba2\n\n58 days left to finish the following task:\n a. +simcard | \u79fb\u52a8\u5361\u7eed\u7ea6\uff0c\u6c38\u4e459\u5143/\u6708\n\nSo, hurry up!! Go get things done!!", "sound": "", "icon": "", "group": "alert", "copy": "", "autocopy": "", "badge": "", "url": "", "isarchive": "1", "level": "active"}
|
@ -9,7 +9,7 @@ import sys
|
|||||||
# Mail basic information
|
# Mail basic information
|
||||||
mail_host = "smtp.163.com"
|
mail_host = "smtp.163.com"
|
||||||
from_mail = 'xgdfmf@163.com'
|
from_mail = 'xgdfmf@163.com'
|
||||||
from_mail_password = 'SATTGHVFIJEGZMFP'
|
from_mail_password = 'PSIKFDYLMGBPSEPJ'
|
||||||
receiver_to = ['mffan0922@163.com']
|
receiver_to = ['mffan0922@163.com']
|
||||||
receiver_cc = []
|
receiver_cc = []
|
||||||
to_mail = receiver_to + receiver_cc
|
to_mail = receiver_to + receiver_cc
|
||||||
|
@ -12,7 +12,7 @@ ip link set wlx90de80ca01ec promisc on
|
|||||||
sleep 20
|
sleep 20
|
||||||
/usr/bin/bash /opt/scripts/update/macvlan.sh
|
/usr/bin/bash /opt/scripts/update/macvlan.sh
|
||||||
#==============================================================================
|
#==============================================================================
|
||||||
/usr/bin/bash /opt/scripts/update/jekyll_update.sh
|
nohup /usr/bin/bash /opt/scripts/update/jekyll_update.sh > /dev/null 2>&1 &
|
||||||
# /usr/bin/mount -t ext4 -w UUID="b7c2c4b8-bfde-479b-80bb-655432a433b8" /opt/wd
|
# /usr/bin/mount -t ext4 -w UUID="b7c2c4b8-bfde-479b-80bb-655432a433b8" /opt/wd
|
||||||
|
|
||||||
|
|
||||||
|
@ -136,7 +136,8 @@ apt install lrzsz unzip vim gcc g++ make automake curl wget gnupg2 aria2 jq apt-
|
|||||||
python3-pip python3-dev golang net-tools ethtool tcpflow lshw rsync parallel rclone pigz pbzip2 \
|
python3-pip python3-dev golang net-tools ethtool tcpflow lshw rsync parallel rclone pigz pbzip2 \
|
||||||
pixz neofetch mlocate ncdu dstat fzf tldr nscd inotify-hookable inotify-tools vsftpd mtr bridge-utils \
|
pixz neofetch mlocate ncdu dstat fzf tldr nscd inotify-hookable inotify-tools vsftpd mtr bridge-utils \
|
||||||
socat dos2unix samba libldap2-dev libsasl2-dev smartmontools parted libpcre3 libpcre3-dev openssl \
|
socat dos2unix samba libldap2-dev libsasl2-dev smartmontools parted libpcre3 libpcre3-dev openssl \
|
||||||
libssl-dev zlib1g-dev libgeoip-dev libncurses-dev libpython3-dev fwupd virtualenv wpasupplicant -y
|
libssl-dev zlib1g-dev libgeoip-dev libncurses-dev libpython3-dev fwupd virtualenv wpasupplicant \
|
||||||
|
jpegoptim optipng -y
|
||||||
|
|
||||||
curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && apt-get install -y nodejs
|
curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && apt-get install -y nodejs
|
||||||
# fwupdmgr get-updates && fwupdmgr update
|
# fwupdmgr get-updates && fwupdmgr update
|
||||||
|
Reference in New Issue
Block a user