diff options
author | wrtbuild <wrtbuild@localhost.(none)> | 2011-10-16 07:34:24 (GMT) |
---|---|---|
committer | wrtbuild <wrtbuild@localhost.(none)> | 2011-10-16 07:34:24 (GMT) |
commit | 64ca2d1ca4e6f9ae279fc17d84b2abd453140d28 (patch) | |
tree | 84a28cd644955e52bd6b91f2c474e9f338841119 /files/common/www/cgi-bin | |
parent | 0850ac21d153d490ddc2b02f29b74b4b5ed88181 (diff) |
add makefile to generate images
Diffstat (limited to 'files/common/www/cgi-bin')
-rwxr-xr-x | files/common/www/cgi-bin/debug | 26 | ||||
-rwxr-xr-x | files/common/www/cgi-bin/redirect | 8 | ||||
-rwxr-xr-x | files/common/www/cgi-bin/splash | 8 | ||||
-rwxr-xr-x | files/common/www/cgi-bin/splash_click | 38 | ||||
-rwxr-xr-x | files/common/www/cgi-bin/status.xml | 3 | ||||
-rw-r--r-- | files/common/www/cgi-bin/template.status.xml | 31 |
6 files changed, 114 insertions, 0 deletions
diff --git a/files/common/www/cgi-bin/debug b/files/common/www/cgi-bin/debug new file mode 100755 index 0000000..14d8447 --- /dev/null +++ b/files/common/www/cgi-bin/debug @@ -0,0 +1,26 @@ +#!/bin/sh +echo -en "Status: 200 OK\r\n" +echo -en "Content-Type: text/html\r\n" +echo -en "\r\n" + +echo "<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head></head><body>" +echo "<h1>Router Status</h1>" +echo "<h2>Batman-ADV</h2>" +echo "<pre>" +batctl tg | cat +batctl tl |cat +echo "</pre>" +echo "<h2>Netzwerk</h2>" +echo "<pre>" +ifconfig | cat +echo "</pre>" +echo "<h2>Prozesse</h2>" +echo "<pre>" +ps aux | cat +echo "</pre>" +echo "<h2>UCI</h2>" +echo "<pre>" +uci show | cat +echo "</pre>" +echo "</body></html>" + diff --git a/files/common/www/cgi-bin/redirect b/files/common/www/cgi-bin/redirect new file mode 100755 index 0000000..9b417db --- /dev/null +++ b/files/common/www/cgi-bin/redirect @@ -0,0 +1,8 @@ +#!/bin/sh +echo -en "Cache-Control: no-cache, max-age=0, no-store, must-revalidate\r\n" +echo -en "Pragma: no-cache\r\n" +echo -en "Expires: -1\r\n" +echo -en "Status: 302 Temporary Redirect\r\n" +echo -en "Location: http://"`uci get network.mesh.ipaddr`"/cgi-bin/splash?"`/bin/urlencode "$HTTP_HOST$REQUEST_URI"`"\r\n" +echo -en "\r\n" +exit 0 diff --git a/files/common/www/cgi-bin/splash b/files/common/www/cgi-bin/splash new file mode 100755 index 0000000..ee907d6 --- /dev/null +++ b/files/common/www/cgi-bin/splash @@ -0,0 +1,8 @@ +#!/bin/sh +echo -en "Status: 200 OK\r\n" +echo -en "Content-Type: text/html\r\n" +echo -en "\r\n" +#targeturl=$(echo $QUERY_STRING) +#targeturl=$(echo $QUERY_STRING | sed -f /etc/urlencode.sed) +targeturl=`echo $QUERY_STRING` +sed "s/targeturl/"$targeturl"/g" /www/splash.html diff --git a/files/common/www/cgi-bin/splash_click b/files/common/www/cgi-bin/splash_click new file mode 100755 index 0000000..d08af6a --- /dev/null +++ b/files/common/www/cgi-bin/splash_click @@ -0,0 +1,38 @@ +#!/bin/sh +echo -en "Status: 200 OK\r\n" +echo -en "Content-Type: text/html\r\n" +echo -en "\r\n" +TEST=`cat ` +TEST=`echo $TEST | sed 's/'target_url='/''/g'` +TEST=`/bin/urldecode "$TEST"` +TEST=`echo $TEST | sed 's/%2F/\//g'` +USER_MAC=`cat /proc/net/arp | grep $REMOTE_HOST | awk 'BEGIN { FS = " " } ; { print $4 }'` + +. $IPKG_INSTROOT/etc/functions.sh +ISSPLASHED=0 +config_load splash_users +is_mac() { + config_get mac "$1" mac + if [ "$mac" == "$USER_MAC" ]; then + ISSPLASHED=1 + fi +} +#check if user is alredy splashed +config_foreach is_mac user +sed 's/targeturl/'"$(echo $TEST| sed 's#/#\\/#g')"'/g' /www/iframe.html + +if [ $ISSPLASHED -eq 1 ]; then + exit +fi +#User is now free to go +iptables -t nat -I ffj_splash 1 -m --mac-source $USER_MAC -j ACCEPT + +uci -q add splash_users user +uci -q set splash_users.@user[-1].mac=$USER_MAC +uci -q set splash_users.@user[-1].time=`date +%s` + +exit 0 + + + + diff --git a/files/common/www/cgi-bin/status.xml b/files/common/www/cgi-bin/status.xml new file mode 100755 index 0000000..8d45a90 --- /dev/null +++ b/files/common/www/cgi-bin/status.xml @@ -0,0 +1,3 @@ +#/bin/bash! +hostname=`hostname` +eval "echo \"$(cat template.status.xml)\"" diff --git a/files/common/www/cgi-bin/template.status.xml b/files/common/www/cgi-bin/template.status.xml new file mode 100644 index 0000000..7df4e9f --- /dev/null +++ b/files/common/www/cgi-bin/template.status.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<node> + <hostname>$hostname</hostname> + <is_hna>0</is_hna> + <network> + <ip_4></ip_4> + <ip_6></ip_6> + </network> + <owner>Max Mustermann</owner> + <godfather>Susi Mustermann</godfather> + <position> + <lat></lat> + <long></long> + <text></text> + </position> + <statistics> + <uptime></uptime> + <dhcp_leases></dhcp_leases> + <load></load> + + </statistics> + + <batman-adv> + <route> + <hostname></hostname> + <mac></mac> + </route> + </batman-adv> +</node> + + |