1 | curl -s http://172.16.0.1 > /dev/null
|
---|
2 | salt=`curl -c /tmp/cookies.txt -s http://172.16.0.1/tmp/status.json | tail -n 1 | cut -d "\"" -f 4`
|
---|
3 | pw=`echo -n admin${salt} | md5sum | cut -d ' ' -f 1`
|
---|
4 | curl -c /tmp/cookies.txt -X POST -H "Content-Type: application/x-www-form-urlencoded" -d "un=admin&pw=${pw}&csrftok=${salt}" -s http://172.16.0.1/login_act.cgi > /dev/null
|
---|
5 | login=`curl -b /tmp/cookies.text -s http://172.16.0.1/tmp/status.json | head -n 1 | cut -d "\"" -f 2`
|
---|
6 |
|
---|
7 | if [ $login == "initpwd" ]; then
|
---|
8 | initpwd=`curl -b /tmp/cookies.text -s http://172.16.0.1/tmp/status.json | tail -n 1 | cut -d "\"" -f 4`
|
---|
9 | curl -X POST -H "Content-Type: application/x-www-form-urlencoded" -d "newpw=admin&confirmpw=admin&csrftok1=${initpwd}¤t_page=initpwd" -s http://172.16.0.1/chgpwd_act.cgi > /dev/null
|
---|
10 | chgpwd=`curl -b /tmp/cookies.text -s http://172.16.0.1/tmp/status.json | head -n 1 | cut -d "\"" -f 2`
|
---|
11 | if [ $chgpwd == "chgpwd" ]; then
|
---|
12 | curl -s http://172.16.0.1 > /dev/null
|
---|
13 | salt=`curl -c /tmp/cookies.txt -s http://172.16.0.1/tmp/status.json | tail -n 1 | cut -d "\"" -f 4`
|
---|
14 | pw=`echo -n admin${salt} | md5sum | cut -d ' ' -f 1`
|
---|
15 | curl -c /tmp/cookies.txt -X POST -H "Content-Type: application/x-www-form-urlencoded" -d "un=admin&pw=${pw}&csrftok=${salt}" -s http://172.16.0.1/login_act.cgi > /dev/null
|
---|
16 | fi;
|
---|
17 | fi;
|
---|
18 |
|
---|
19 | # Set to Modem Mode
|
---|
20 | curl -b /tmp/cookies.txt -s http://172.16.0.1/set_devicemode.cgi > /dev/null
|
---|
21 | modem_token=`curl -b /tmp/cookies.txt -s http://172.16.0.1/tmp/status.json | tail -n 3 | head -n 1 | cut -d "\"" -f 4`
|
---|
22 | modem_flag=`curl -b /tmp/cookies.txt -s http://172.16.0.1/tmp/status.json | tail -n 1 | cut -d "\"" -f 6`
|
---|
23 | curl -b /tmp/cookies.txt -X POST -H "Content-Type: application/x-www-form-urlencoded" -d "csrftok=${modem_token}¤t_page=set_devicemode&${modem_flag}=1" -s http://172.16.0.1/post_action.cgi > /dev/null
|
---|
24 |
|
---|
25 | # Set to External SIM
|
---|
26 | curl -b /tmp/cookies.txt -s http://172.16.0.1/set_cellular.cgi > /dev/null
|
---|
27 | sim_token=`curl -b /tmp/cookies.txt -s http://172.16.0.1/tmp/status.json | head -n 2 | tail -n 1 | cut -d "\"" -f 4`
|
---|
28 | sim_flag=`curl -b /tmp/cookies.txt -s http://172.16.0.1/tmp/status.json | grep SIM_SELECT | cut -d "\"" -f 24`
|
---|
29 | curl -b /tmp/cookies.txt -X POST -H "Content-Type: application/x-www-form-urlencoded" -d "csrftok=${sim_token}¤t_page=set_cellular&${sim_flag}=1" -s http://172.16.0.1/post_action.cgi > /dev/null
|
---|
30 |
|
---|
31 | # Set AT_NMEA Mode on and reboot
|
---|
32 | curl -b /tmp/cookies.txt -s http://172.16.0.1/at_nmea.cgi > /dev/null
|
---|
33 | nmea_token=`curl -b /tmp/cookies.txt -s http://172.16.0.1/tmp/status.json | tail -n 2 | head -n 1 | cut -d "\"" -f 4`
|
---|
34 | nmea_flag=`curl -b /tmp/cookies.txt -s http://172.16.0.1/tmp/status.json | tail -n 1 | cut -d "\"" -f 6`
|
---|
35 | curl -b /tmp/cookies.txt -X POST -H "Content-Type: application/x-www-form-urlencoded" -d "csrftok=${nmea_token}¤t_page=at_nmea&${nmea_flag}=1&reboot=1" -s http://172.16.0.1/post_action.cgi > /dev/null
|
---|