-
-
Notifications
You must be signed in to change notification settings - Fork 18
/
script.sh
executable file
·27 lines (18 loc) · 814 Bytes
/
script.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
#!/usr/bin/env bash
RUN_PATH=$PWD
SCRIPT_PATH=${SCRIPT_PATH:-$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)}
echo "===]> Info: RUN_PATH=$RUN_PATH"
echo "===]> Info: SCRIPT_PATH=$SCRIPT_PATH"
[ -x "$(command -v jq)" ] || echo "===]> Exit: Install jq!"
STOK="${STOK:-}"
ROUTER_IP="${ROUTER_IP:-192.168.31.1}"
echo "===]> Info: STOK=$STOK"
echo "===]> Info: ROUTER_IP=$ROUTER_IP"
echo "===]> Info: Printing device information..."
curl -sLk http://$ROUTER_IP/cgi-bin/luci/api/xqsystem/fac_info | jq
curl -sLk http://$ROUTER_IP/cgi-bin/luci/api/xqsystem/bdata | jq .
TELNET_PASSWORD=$(python3 password.py $(curl -sLk http://$ROUTER_IP/cgi-bin/luci/api/xqsystem/bdata | jq -r .SN))
echo
echo "===]> Info: telnet $ROUTER_IP"
echo "===]> Info: TELNET_USER=root"
echo "===]> Info: TELNET_PASSWORD=$TELNET_PASSWORD"