admin2.cgi 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583
  1. #!/usr/bin/haserl --shell=/bin/bash --upload-limit=32768 --upload-dir=/www/tmp
  2. <%# upload limit: 32Mb %>
  3. <%
  4. ## SuperGlue project | http://superglue.it | 2014 | GPLv3
  5. ## http://git.superglue.it/superglue/serverfiles
  6. ##
  7. ## admin2.cgi - control panel for Superglue personal server
  8. ##
  9. ## example POST request:
  10. ## curl --data-urlencode 'key=value' http://host/uri
  11. ##
  12. ## returns: 200 (+ output of operation) on success
  13. ## 406 (+ error message in debug mode) on error
  14. _WWW='/www'
  15. _PWDFILE="/opt/lib/htpasswd"
  16. _TMP="${_WWW}/tmp"
  17. _LOG="${_WWW}/log/admin.log"
  18. _DEBUG=1
  19. err() {
  20. _ERR="$?"
  21. [[ "$_ERR" -gt 0 ]] || return 0
  22. log "$1"
  23. head "${2:='400'}"
  24. exit "$_ERR"
  25. }
  26. logThis() {
  27. [[ "$_DEBUG" -gt 0 ]] || return 0
  28. local _TYPE='I:'
  29. [[ "$_ERR" -gt 0 ]] && _TYPE='E:'
  30. local _TIME; printf -v _TIME '%(%d.%m.%Y %H:%M:%S)T' -1
  31. printf '%b\n' "$_TIME $_TYPE ${@} " >> "$_LOG"
  32. [[ "$_DEBUG" -gt 1 ]] && printf '%b\n' "[verbose] $_TYPE ${1}"
  33. }
  34. headerPrint() {
  35. case "$1" in
  36. 200|'') printf '%b' 'HTTP/1.1 200 OK\r\n';;
  37. 301) printf '%b' "HTTP/1.1 301 Moved Permanently\r\nLocation: $HTTP_REFERER\r\n";;
  38. 403) printf '%b' 'HTTP/1.1 403 Forbidden\r\n';;
  39. 405) printf '%b' 'HTTP/1.1 405 Method Not Allowed\r\n';;
  40. 406) printf '%b' 'HTTP/1.1 406 Not Acceptable\r\n';;
  41. *) printf '%b' 'HTTP/1.1 400 Bad Request\r\n';;
  42. esac
  43. printf '%b' 'Content-Type: text/html\r\n\r\n';
  44. }
  45. ## faster echo
  46. _echo() {
  47. printf "%s" "${*}"
  48. }
  49. htDigest() {
  50. _USER='admin'
  51. _PWD=$1
  52. _REALM='superglue'
  53. _HASH=$(echo -n "$_USER:$_REALM:$_PWD" | md5sum | cut -b -32)
  54. printf "%s" "$_USER:$_REALM:$_HASH"
  55. }
  56. urlDec() {
  57. local value=${*//+/%20}
  58. for part in ${value//%/ \\x}; do
  59. printf "%b%s" "${part:0:4}" "${part:4}"
  60. done
  61. }
  62. setQueryVars() {
  63. _VARS=( ${!POST_*} )
  64. # local v
  65. # for v in ${_VARS[@]}; do
  66. # echo $v
  67. # v=$(urlDec "${v}")
  68. # eval "_${v//POST_/}=${!v}";
  69. # done
  70. local v
  71. for v in ${_VARS[@]}; do
  72. logThis "$v=${!v}"
  73. done
  74. #echo $POST_lanssid
  75. #env
  76. }
  77. runSuid() {
  78. local _SID=$(/usr/bin/ps -p $$ -o sid=) ## pass session id to the child
  79. local _CMD=$@
  80. sudo ./suid.sh $_CMD $_SID 2>/dev/null
  81. }
  82. getQueryFile() {
  83. local _UPLD="${HASERL_fwupload_path##*/}"
  84. logThis "'multipart': decoding stream"
  85. mv "$_TMP/$_UPLD" "$_TMP/fwupload.bin" 2>/dev/null || _ERR=$?
  86. if [[ $_ERR -gt 0 ]]; then
  87. showMesg 'Firmware upload has failed' 'Reboot your Superglue server and try again'
  88. fi
  89. }
  90. validIp() {
  91. local _IP=$1
  92. local _RET=1
  93. if [[ $_IP =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
  94. OIFS=$IFS
  95. IFS='.'
  96. _IP=($_IP)
  97. IFS=$OIFS
  98. [[ ${_IP[0]} -le 255 && ${_IP[1]} -le 255 && ${_IP[2]} -le 255 && ${_IP[3]} -le 255 ]]
  99. _RET=$?
  100. fi
  101. return $_RET
  102. }
  103. pwdChange() {
  104. if [[ ! -z "${POST_pwd##$POST_pwdd}" ]]; then
  105. _ERR=1
  106. showMesg 'Passwords did not match'
  107. fi
  108. if [[ ${#POST_pwd} -lt 6 ]]; then
  109. _ERR=1
  110. showMesg 'Password must be at least 6 characters long'
  111. fi
  112. runSuid "echo -e \"$POST_pwd\n$POST_pwd\" | passwd root"
  113. runSuid "echo $(htDigest $POST_pwd) > $_PWDFILE"
  114. _ERR=$?
  115. if [[ $_ERR -gt 0 ]]; then
  116. showMesg 'Password change failed'
  117. else
  118. showMesg 'Password is changed'
  119. fi
  120. }
  121. lanAddr() {
  122. logThis "new LAN addr is: $POST_laddr"
  123. validIp $POST_laddr || showMesg 'Not valid network address'
  124. doUci set laddr $POST_laddr
  125. _ERR=$?
  126. if [[ $_ERR -gt 0 ]]; then
  127. showMesg 'Setting network address failed'
  128. else
  129. (sleep 1; doUci commit network; doUci commit wireless;)&
  130. showMesg 'New network address is set' "Your server is now accessible under <a href='http://superglue.local/admin'>http://superglue.local/admin</a>"
  131. fi
  132. }
  133. wanSet() {
  134. if [[ ! -z $POST_wanifname ]]; then
  135. ## eth and wlan wan cases are different!
  136. ## eth wan requires:
  137. ## config interface 'wan'
  138. ## option ifname 'eth0'
  139. ##
  140. ## config wifi-iface
  141. ## option device 'radio0'
  142. ## option network 'wan'
  143. ## option disabled '1' (or no 'config wifi-iface' section at all)
  144. ##
  145. ## wlan wan requires:
  146. ## config interface 'wan'
  147. ## option proto 'dhcp'
  148. ## (without 'option ifname' specified!)
  149. ##
  150. ## config wifi-iface
  151. ## option device 'radio0'
  152. ## option network 'wan'
  153. logThis "wan.ifname=$POST_wanifname"
  154. if [[ $POST_wanifname == 'eth0' ]]; then
  155. doUci set wanifname $POST_wanifname
  156. doUci set wanwifacedis '1'
  157. elif [[ $POST_wanifname == 'wlan1' ]]; then
  158. doUci set wanifname ''
  159. doUci set wanwifacedis ''
  160. fi
  161. if [[ $POST_wanproto == 'dhcp' ]]; then
  162. doUci set wanproto dhcp
  163. elif [[ $POST_wanproto == 'static' ]]; then
  164. logThis "wan.ipaddr=$POST_wanipaddr"
  165. doUci set wanproto static
  166. doUci set wanipaddr $POST_wanipaddr
  167. doUci set wannetmask $POST_wannetmask
  168. fi
  169. if [[ $POST_wanifname == 'wlan1' ]]; then
  170. ssidChange || showMesg 'Wireless changes failed'
  171. fi
  172. ## background the following
  173. doUci commit network &&
  174. showMesg 'Internet connection is configured' 'Waiting for device to get ready' ||
  175. showMesg 'Configuring Internet connection failed'
  176. fi
  177. logThis "new WAN iface is: $POST_wanifname"
  178. }
  179. ssidChange() {
  180. ## check for iface
  181. [[ ! $POST_iface =~ ^('wan'|'lan')$ ]] && showMesg 'Error changing wireless settings' 'unknown/unconfigured interface'
  182. logThis "$POST_iface is being set"
  183. _p=$POST_iface
  184. ## default enc for now
  185. local _enc='psk2'
  186. if [[ $POST_iface == 'wan' ]]; then
  187. local _mode='sta'
  188. local _ssid="${POST_wanssid}"
  189. local _key="${POST_wankey}"
  190. else
  191. local _mode='ap'
  192. local _ssid="${POST_lanssid}"
  193. local _key="${POST_lankey}"
  194. fi
  195. logThis "ssid: $_ssid [$_mode], key: $_key [$_enc]"
  196. #logThis $POST_wanssid
  197. if [[ ${#_ssid} -lt 4 ]]; then
  198. _ERR=1
  199. showMesg 'SSID must be at least 4 characters long'
  200. fi
  201. doUci set $_p'ssid' "${_ssid}"
  202. _ERR=$?
  203. [[ $_ERR -gt 0 ]] && showMesg 'New SSID is not set'
  204. if [[ -z $_key ]]; then
  205. ## if key is empty set encryption to none and remove key
  206. doUci set $_p'key' && doUci set $_p'enc' 'none'
  207. _ERR=$?
  208. else
  209. if [[ ${#_key} -lt 8 ]]; then
  210. _ERR=1
  211. showMesg 'Passphrase must be at least 8 characters long'
  212. fi
  213. doUci set $_p'key' "${_key}" && doUci set $_p'enc' "${_enc}"
  214. _ERR=$?
  215. [[ $_ERR -gt 0 ]] && showMesg 'Passphrase is not set'
  216. fi
  217. [[ $_ERR -gt 0 ]] && return $_ERR ##showMesg 'Wireless changes failed'
  218. doUci commit wireless ##&& showMesg 'Wireless changes applied'
  219. }
  220. #showError() {
  221. # headerPrint 406
  222. # logThis "$@"
  223. # echo "ERROR: $@"
  224. # exit 1
  225. #}
  226. showMesg() {
  227. logThis "$@"
  228. local _MSG=$1
  229. local _SUBMSG=$2
  230. _MSG=${_MSG:='Not defined'}
  231. _SUBMSG=${_SUBMSG:='back to control panel in a second..'}
  232. if [[ $_ERR -gt 0 ]]; then
  233. local _TYPE='ERROR: '
  234. headerPrint 406
  235. else
  236. local _TYPE='OK: '
  237. headerPrint 200
  238. fi
  239. htmlHead "<meta http-equiv='refresh' content='3;url=${HTTP_REFERER}'>"
  240. _echo "<body>
  241. <h1>Superglue server control panel</h1>
  242. <img src='http://"${HTTP_HOST}"/resources/img/superglueLogo.png' class='logo'>"
  243. _echo "<hr>
  244. <h2 style='display:inline'>$_TYPE $_MSG</h2>
  245. <span style='display:inline; margin-left: 50px;'>$_SUBMSG</span>
  246. <hr>"
  247. footerBody
  248. exit 0
  249. # _echo "<body>
  250. #<h1>SG</h1>
  251. #<hr>
  252. #<h2 style='display:inline'>$_TYPE $_MSG</h2>
  253. #<span style='display:inline; margin-left: 50px;'>$_SUBMSG</span>
  254. #<hr>
  255. #</body></html>"
  256. # exit 0
  257. }
  258. updateFw() {
  259. logThis "updating fw"
  260. _FWFILE="${_TMP}/fwupload.bin"
  261. logThis "fwfile is: $(ls -lad $_FWFILE)"
  262. _OUT="$(/sbin/sysupgrade -T $_FWFILE 2>&1)"
  263. _ERR=$?
  264. [[ $_ERR -gt 0 ]] && showMesg "$_OUT"
  265. # _OUT="$(runSuid /sbin/mtd -e firmware -q write $_FWFILE firmware)"
  266. _ERR=$?
  267. [[ $_ERR -gt 0 ]] && showMesg "mtd failed, $_OUT"
  268. # runSuid reboot
  269. showMesg 'Firmware update is completed, rebooting..' 'this might take up to 60 seconds'
  270. }
  271. rebootNow() {
  272. logThis "reboot: now!"
  273. runSuid reboot
  274. showMesg 'Rebooting..' 'this might take up to 60 seconds'
  275. }
  276. upTime() {
  277. local _T="$(uptime)"
  278. _ERR=$?
  279. if [[ $_ERR -gt 0 ]]; then
  280. headerPrint 406
  281. exit 1
  282. else
  283. headerPrint 200
  284. printf '%b' "$_T\n"
  285. exit 0
  286. fi
  287. }
  288. iwScan() {
  289. . /opt/lib/scripts/iw-scan.sh
  290. headerPrint 200
  291. iwScanJ
  292. exit 0
  293. }
  294. doUci() {
  295. local _CMD=''
  296. local _ARG=''
  297. case $1 in
  298. get|set|commit) _CMD=$1;;
  299. *) logThis 'bad UCI command'; headerPrint 405; echo 'bad UCI command'; exit 1 ;;
  300. esac
  301. case $2 in
  302. lanssid) _ARG='wireless.@wifi-iface[0].ssid';;
  303. lanenc) _ARG='wireless.@wifi-iface[0].encryption';;
  304. lankey) _ARG='wireless.@wifi-iface[0].key';;
  305. lanipaddr) _ARG='network.lan.ipaddr';;
  306. wanifname) _ARG='network.wan.ifname';;
  307. wanproto) _ARG='network.wan.proto';;
  308. wanipaddr) _ARG='network.wan.ipaddr';;
  309. wannetmask) _ARG='network.wan.netmask';;
  310. wanwifacedis) _ARG='wireless.@wifi-iface[1].disabled';;
  311. wanssid) _ARG='wireless.@wifi-iface[1].ssid';;
  312. wanenc) _ARG='wireless.@wifi-iface[1].encryption';;
  313. wankey) _ARG='wireless.@wifi-iface[1].key';;
  314. *) if [[ $_CMD == 'commit' ]]; then
  315. _ARG=$2
  316. else
  317. logThis "bad UCI entry: $2"
  318. _ERR=1
  319. showMesg 'bad UCI entry'
  320. fi ;;
  321. esac
  322. if [[ $_CMD == 'get' ]]; then
  323. if [ ! -z $_ARG ]; then
  324. /sbin/uci -q get $_ARG || return $?
  325. fi
  326. fi
  327. if [[ $_CMD == 'set' ]]; then
  328. local _VAL=$3
  329. if [ -z $_VAL ]; then
  330. logThis "empty $_ARG value, removing record"
  331. runSuid /sbin/uci delete $_ARG || ( echo "uci delete $_ARG: error"; exit 1; )
  332. fi
  333. if [ ! -z $_ARG ]; then
  334. logThis "setting $_ARG value"
  335. runSuid /sbin/uci set $_ARG=$_VAL || ( echo "uci set $_ARG: error"; exit 1; )
  336. fi
  337. fi
  338. if [[ $_CMD == 'commit' ]]; then
  339. runSuid /sbin/uci commit $_ARG|| echo "uci commit $_ARG: error"
  340. if [[ "$_ARG" == 'wireless' ]]; then
  341. runSuid /sbin/wifi || echo 'wifi: error'
  342. fi
  343. if [[ "$_ARG" == 'network' ]]; then
  344. runSuid /etc/init.d/dnsmasq reload && runSuid /etc/init.d/network reload || echo 'network: error'
  345. fi
  346. fi
  347. }
  348. . /opt/lib/scripts/jshn-helper.sh
  349. ## call with argument to inject additional lines
  350. ## ie: htmlhead "<meta http-equiv='refresh' content='2;URL=http://${HTTP_REFERER}'>"
  351. htmlHead() {
  352. _echo "<!-- obnoxious code below, keep your ports tight -->
  353. <!doctype html>
  354. <html>
  355. <head>
  356. <link rel='icon' href='http://${HTTP_HOST}/resources/img/favicon.ico' type='image/x-icon'>
  357. <title>Superglue server | Control panel</title>
  358. <link rel='stylesheet' type='text/css' href='http://${HTTP_HOST}/resources/admin/admin.css'>
  359. $@
  360. </head>"
  361. }
  362. footerBody() {
  363. _echo "</body>
  364. <script type='text/javascript' src='http://${HTTP_HOST}/resources/admin/admin.js'></script>
  365. </html>"
  366. }
  367. if [[ "${REQUEST_METHOD^^}" == "POST" ]]; then
  368. [[ $CONTENT_LENGTH -gt 0 ]] || err 'content length is zero, 301 back to referer' '301'
  369. case "${CONTENT_TYPE^^}" in
  370. APPLICATION/X-WWW-FORM-URLENCODED*) setQueryVars;;
  371. MULTIPART/FORM-DATA*) getQueryFile;;
  372. *) _ERR=1; _OUT='this is not a post';;
  373. esac
  374. case $REQUEST_URI in
  375. *pwdchange) pwdChange;;
  376. *ssidchange) ssidChange;;
  377. *lanaddr) lanAddr;;
  378. *updatefw) updateFw;;
  379. *rebootnow) rebootNow;;
  380. *wan) wanSet;;
  381. *uptime) upTime;;
  382. *iwscan) iwScan;;
  383. *) logThis 'bad action'; headerPrint 405;
  384. echo 'no such thing'; exit 1;;
  385. esac
  386. fi
  387. headerPrint '200'
  388. ## html head
  389. htmlHead
  390. sgver=$(cat /etc/superglue_version)
  391. devmod=$(cat /etc/superglue_model)
  392. openwrt=$(cat /etc/openwrt_version)
  393. IFS=","
  394. wan=( $(ifaceStat wan) )
  395. IFS=$OFS
  396. #wanifname=$(doUci get wanifname || echo 'wlan0') ## TODO fix this
  397. wanifname=${wan[3]}
  398. wanproto=$(doUci get wanproto)
  399. #wanipaddr=$(doUci get wanipaddr)
  400. wanipaddr=${wan[0]}
  401. #wannetmask=$(doUci get wannetmask)
  402. wangw=${wan[2]}
  403. wandns=${wan[5]}
  404. wanuptime=${wan[4]}
  405. wanssid=$(doUci get wanssid)
  406. wankey=$(doUci get wankey)
  407. logThis $wanifname
  408. %>
  409. <body>
  410. <h1>Superglue server control panel</h1>
  411. <img src='http://<% _echo "${HTTP_HOST}" %>/resources/img/superglueLogo.png' class='logo'>
  412. <section class='inert'>
  413. <span style='display:block;'><% printf "System version: %s | Device: %s | OpenWRT: %s" "$sgver" "$devmod" "$openwrt" %></span>
  414. <span style='display:block;' id='uptime'><% uptime %></span>
  415. </section>
  416. <section>
  417. <h2>Internet connection: <% _echo "IP:$wanipaddr, Gateway:$wangw, DNS:$wandns, up for $wanuptime seconds" %></h3>
  418. <form method='post' action='/admin/wan' name='wan' id='wanconf'>
  419. <div style='display:inline-flex'>
  420. <div style='display:inline-block;'>
  421. <select name='wanifname' id='wanifname' style='display:block'>
  422. <option value='eth0' id='eth' <% ( [[ $wanifname =~ ('eth') ]] && _echo 'selected' ) %> >Wired (WAN port)</option>
  423. <option value='wlan1' id='wlan' <% ( [[ $wanifname =~ ('wlan') ]] && _echo 'selected' ) %> >Wireless (Wi-Fi)</option>
  424. </select>
  425. <fieldset id='wanwifi' <% ( [[ $wanifname =~ ('wlan') ]] && _echo "class='show'" || _echo "class='hide'" ) %>>
  426. <select name='wanssid' id='wanssid' style='display:block'>
  427. <% if [[ -z $wanssid ]]; then
  428. _echo '<option disabled>choose network..</option>'
  429. else
  430. _echo "<option id=$wanssid selected>$wanssid</option>"
  431. fi %>
  432. </select>
  433. <input type='password' name='wankey' value='<% _echo $wankey %>'>
  434. </fieldset>
  435. <span class='help'>help</span>
  436. </div>
  437. <div style='display:inline-block;'>
  438. <select name='wanproto' id='wanproto' style='display:block'>
  439. <option value='dhcp' name='dhcp' id='dhcp' <% ([[ $wanproto == 'dhcp' ]] && _echo 'selected') %>>Automatic (DHCP)</option>
  440. <option value='stat' name='dhcp' id='stat' <% ([[ $wanproto == 'static' ]] && _echo 'selected') %>>Manual (Static IP)</option>
  441. </select>
  442. <fieldset id='wanaddr' <% ( [[ $wanproto =~ ('static') ]] && _echo "class='show'" || _echo "class='hide'" ) %>>
  443. <input type='text' name='wanipaddr' id='wanipaddr' value='<% _echo $wanipaddr %>'>
  444. <input type='text' name='wangw' id='wannetmask' value='<% _echo $wannetmask %>'>
  445. </fieldset>
  446. </div>
  447. </div>
  448. <input type='hidden' name='iface' value='wan' class='inline'>
  449. <input type='submit' value='Apply'>
  450. </form>
  451. <span class='help'>help</span>
  452. </section>
  453. <section>
  454. <h2>Local wireless network:</h2>
  455. <form method='post' action='/admin/ssidchange'>
  456. <div style='display:inline-flex'>
  457. <div style='display:inline-block;'>
  458. <input type='text' name='lanssid' value='<% doUci get lanssid %>'>
  459. <input type='password' name='lankey' value='<% doUci get lankey %>'>
  460. </div>
  461. <div style='display:inline-block;'>
  462. <input type='text' name='lanipaddr' value='<% doUci get lanipaddr %>'>
  463. <input type='hidden' name='iface' value='lan' class='inline'>
  464. </div>
  465. </div>
  466. <input type='submit' value='Apply'>
  467. </form>
  468. <span class='help'>help</span>
  469. </section>
  470. <section>
  471. <h2>Change password:</h2>
  472. <form method='post' action='/admin/pwdchange'>
  473. <div style='display:inline-flex'>
  474. <div style='display:inline-block;'>
  475. <input type='text' name='usr' value='admin' readonly>
  476. </div>
  477. <div style='display:inline-block;'>
  478. <input type='password' name='pwd' value=''>
  479. <input type='password' name='pwdd' value=''>
  480. </div>
  481. </div>
  482. <input type='submit' value='Apply'>
  483. </form>
  484. <span class='help'>help</span>
  485. </section>
  486. <section>
  487. <h2>Update firmware:</h2>
  488. <form method='post' action='/admin/updatefw' enctype='multipart/form-data'>
  489. <div id='uploadbox'>
  490. <input id='uploadfile' placeholder='Choose file' disabled='disabled'>
  491. <input id='uploadbtn' name='fwupload' type='file'>
  492. </div>
  493. <input type='submit' value='Upload'>
  494. </form>
  495. <span class='help'>help</span>
  496. </section>
  497. <section>
  498. <h2></h2>
  499. <form action='/admin/rebootnow' method='post' class='inline'>
  500. <input type='hidden' name='reboot' value='now' class='inline'>
  501. <input type='submit' value='Reboot' class='inline'>
  502. </form>
  503. <form action='http://logout@<% _echo ${HTTP_HOST} %>/admin' method='get' class='inline'>
  504. <input type='submit' value='Logout' class='inline'>
  505. </form>
  506. </section>
  507. <div style='height:200px'></div>
  508. <hr>
  509. Memory:
  510. <pre><% free %></pre>
  511. <hr>
  512. Storage:
  513. <pre><% df -h %></pre>
  514. <hr>
  515. Environment:
  516. <pre><% env %></pre>
  517. <hr>
  518. <%
  519. footerBody
  520. exit 0
  521. %>