wireless/modem/AMITMDG: init_mdg200.txt

File init_mdg200.txt, 2.9 KB (added by Ryan Erbstoesser, 14 months ago)
Line 
1curl -s http://172.16.0.1 > /dev/null
2salt=`curl -c /tmp/cookies.txt -s http://172.16.0.1/tmp/status.json | tail -n 1 | cut -d "\"" -f 4`
3pw=`echo -n admin${salt} | md5sum | cut -d ' ' -f 1`
4curl -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
5login=`curl -b /tmp/cookies.text -s http://172.16.0.1/tmp/status.json | head -n 1 | cut -d "\"" -f 2`
6
7if [ $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}&current_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;
17fi;
18
19# Set to Modem Mode
20curl -b /tmp/cookies.txt -s http://172.16.0.1/set_devicemode.cgi > /dev/null
21modem_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`
22modem_flag=`curl -b /tmp/cookies.txt -s http://172.16.0.1/tmp/status.json | tail -n 1 | cut -d "\"" -f 6`
23curl -b /tmp/cookies.txt -X POST -H "Content-Type: application/x-www-form-urlencoded" -d "csrftok=${modem_token}&current_page=set_devicemode&${modem_flag}=1" -s http://172.16.0.1/post_action.cgi > /dev/null
24
25# Set to External SIM
26curl -b /tmp/cookies.txt -s http://172.16.0.1/set_cellular.cgi > /dev/null
27sim_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`
28sim_flag=`curl -b /tmp/cookies.txt -s http://172.16.0.1/tmp/status.json | grep SIM_SELECT | cut -d "\"" -f 24`
29curl -b /tmp/cookies.txt -X POST -H "Content-Type: application/x-www-form-urlencoded" -d "csrftok=${sim_token}&current_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
32curl -b /tmp/cookies.txt -s http://172.16.0.1/at_nmea.cgi > /dev/null
33nmea_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`
34nmea_flag=`curl -b /tmp/cookies.txt -s http://172.16.0.1/tmp/status.json | tail -n 1 | cut -d "\"" -f 6`
35curl -b /tmp/cookies.txt -X POST -H "Content-Type: application/x-www-form-urlencoded" -d "csrftok=${nmea_token}&current_page=at_nmea&${nmea_flag}=1&reboot=1" -s http://172.16.0.1/post_action.cgi > /dev/null