-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbayuM.sh
executable file
·62 lines (55 loc) · 2.19 KB
/
bayuM.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/bash
g='\e[1;32m'
r="tput sgr0"
echo -e "${g} _ "; $r
echo -e "${g}|_) _. ._ _ o ._ _ ._ |_ _ _|_ "; $r
echo -e "${g}|_) (_| \/ |_| | | | | | | (/_ | __ |_) (_) |_ "; $r
echo -e "${g} / "; $r
MSG_FILE="bayuM.msg"
JSON_FILE="bayuM.json"
echo -e "Wallet Monitoring~ \nCurrency\t: XMR" > $MSG_FILE
WEB="http://api.zergpool.com:8080/api/walletEx?address={s3cretToken}"
#json init
echo -e "${g}Json initialization"; $r
json_init=$(curl -s "$WEB" | jq -r '.')
echo -e "$json_init" > $JSON_FILE
echo -e "${g}===================="; $r
#wrapp
unsold=$(cat "$JSON_FILE" | awk -F, 'NR>1{print $1}' RS='"unsold": ')
balance=$(cat "$JSON_FILE" | awk -F, 'NR>1{print $1}' RS='"balance": ')
unpaid=$(cat "$JSON_FILE" | awk -F, 'NR>1{print $1}' RS='"unpaid": ')
paid24h=$(cat "$JSON_FILE" | awk -F, 'NR>1{print $1}' RS='"paid24h": ')
minpay=$(cat "$JSON_FILE" | awk -F, 'NR>1{print $1}' RS='"minpay": ')
minpay_sunday=$(cat "$JSON_FILE" | awk -F, 'NR>1{print $1}' RS='"minpay_sunday": ')
total=$(cat "$JSON_FILE" | awk -F, 'NR>1{print $1}' RS='"total": ')
eimi=$(cat "$JSON_FILE" | jq -r ' .miners[] | "ID: " + (.ID + " | Hashrate: " + .hashrate)')
#print
echo -e "${g}Generate report.."; $r
echo -e "Immature\t: "$unsold " XMR" >> $MSG_FILE
echo -e "Balance\t: "$balance " XMR" >> $MSG_FILE
echo -e "Unpaid\t\t: "$unpaid " XMR" >> $MSG_FILE
echo -e "Paid 24 Hours\t: "$paid24h " XMR" >> $MSG_FILE
echo -e "Paid/4jam\t: "$minpay >> $MSG_FILE
echo -e "Sunday\t\t: "$minpay_sunday >> $MSG_FILE
echo -e "Total\t\t: "$total " XMR" >> $MSG_FILE
echo -e "Accepted\t: "$eimi >> $MSG_FILE
sed -i "s/ID: /\n\t\tID: /g" $MSG_FILE
echo -e "${g}===================="; $r
if [ -z "$total" ]
then
#fail
echo -e "${g}FAIL.. try again."; $r
else
#send tele
echo -e "${g}Sending report.."; $r
TOKEN={s3cret_token}
CHAT_ID=({s3cret_id})
MESSAGE=`cat $MSG_FILE`
URL="https://api.telegram.org/bot$TOKEN/sendMessage"
for ID in "${CHAT_ID[@]}"
do
curl -X POST -so /dev/null $URL -d chat_id=$ID -d text="$MESSAGE";
echo -e "${g}===================="; $r
echo -e "${g}SUCCESS.. DONE."; $r
done
fi