Hurricane Electric's IPv6 Tunnel Broker Forums

Advanced search  

News:

Welcome to Hurricane Electric's Tunnelbroker.net forums!

Pages: [1] 2

Author Topic: regarding the updated web interface  (Read 23748 times)

crobertp

  • Newbie
  • *
  • Posts: 11
regarding the updated web interface
« on: July 28, 2008, 09:25:49 AM »

Quote
Couple of notes regarding the updated web interface:

1) To update your tunnel's IPv4 endpoint, click on the tunnel for the details page, then click on your listed IPv4 endpoint. This will open a new page where you enter your new IPv4 endpoint address, and click submit to make the change.

Its occuring (as always occurs by murphy law) that my IPv4 endpoint address, choose to
 changes IPv4 endpoint address, ONLY every time I'm away for some reason :lol: 
 example: I  go to asleep , or I go to  a meeting ... , etc. 

Well , the day after I get fully automatic on updating my endpoint address
that updated web interface (excelent update for human use :D 
 rendered my script not working anymore :cry:

imho: there is no need to any web interface update to break any script

*just left the old php web interface into the web server (umodifyed)
*that old interface is accessible only by typing its full url ...
so, despite  web page has been  changed for humans use and shows up in java script instead of in php
*scripts contine working

btw: I have this entry in crontab

*/7 * * * * root /root/dns

this is the dns script
Code: [Select]
#!/bin/bash
cd /root/dyndns
/sbin/ip link show up | grep ppp0 &> /dev/null
if [ $? -eq 0 ]; then
# ./ipcheck.py -s -w -ippp0 --acctfile dados -d roberto.dnsalias.com
  ./ipcheck.py -w -ippp0 --acctfile dados -d roberto.dnsalias.com
  ./ipcheck.py -w -ippp0 --acctfile dados2 -d konectrix.dnsalias.com
  ./updateipv4.sh
fi
#/sbin/ip link show up | grep eth1 &> /dev/null
#if [ $? -eq 0 ];then
#  ./ipcheck.py -s -w -ieth1 --acctfile dados -d roberto.dnsalias.com
#  ./ipcheck.py -w -ieth1 --acctfile dados2 -d konectrix.dnsalias.com
#fi
cd -

and this is the script that get broken cause the removal of the php code from he-ipv6 web server
Code: [Select]
[root@crobertp dyndns]# cat updateipv4.sh
#!/bin/sh
#############################
# Hurricane's TunnelBroker Endpoint ipv4 address updater
# ------------------------------------------------------
#
# Command line usage:
# % updateipv4 [ipv4 [ tunnel_id [ login password ] ] ]
#
# Defaults values are taken from below
#
#############################


##################
# DEFAULT VALUES
##################
LOGIN="your_userid"
PASSWORD="your_password"
TUNNELID="12345" # your_tunnelid
# When empty, IPv4 value is fetched from whatismyip

# Modificacao local to get ip from ppp0 /* crp * 22 jul 2008 */
IPV4=$(ip -4 addr show dev ppp0 | awk '/inet/ {print $2}' | cut -d/ -f1)
O_IPV4=$( cat "O_IPV4")
if [ ".$O_IPV4" == ".$IPV4" ]
  then exit
fi
echo $IPV4 > "O_IPV4"
exit # exit here cause php code on Hurricanes was removed
##########################################
# http headers templates
COOKIETEMPLATE="GET /index.php HTTP/1.1
Host: tunnelbroker.net

"
LOGINTEMPLATE="POST /index.php?COOKIE HTTP/1.1
Host: tunnelbroker.net
Referer: http://tunnelbroker.net/index.php
Content-Type: application/x-www-form-urlencoded
Content-Length: POSTSIZE

POSTDATA"

UPDATETEMPLATE="POST /ipv4_end.php?COOKIE&tunnelid=TUNNEL_ID HTTP/1.1
Host: tunnelbroker.net
Cookie: COOKIE
Content-Type: application/x-www-form-urlencoded
Content-Length: POSTSIZE

POSTDATA"
##########################################

# check if we're a host with busybox and need to strip some options
if [ -e '/bin/busybox' ]
then
        TIMEOUTOPTION=''
else
        TIMEOUTOPTION='20'
fi

# replace default parameters with command line ones
if [ ! -z $4 ]; then LOGIN=$4 ; fi
if [ ! -z $3 ]; then PASSWORD=$3 ; fi
if [ ! -z $2 ]; then TUNNELID=$2 ; fi
if [ ! -z $1 ]; then IPV4=$1 ; fi

# if we don't already know our new ip, let's find it by ourself
if [ -z "${IPV4}" ]
then
        IPV4=`wget http://whatismyip.com/automation/n09230945.asp -O - 2>/dev/null`
        if [ `expr length $IPV4` -gt 15 ]
        then
                echo "-IP Guess Failed."
                exit 1
        else
                echo  "+Guessed IP:"$IPV4
        fi
fi

        MD5PASSWORD=`echo -n $PASSWORD | md5sum | sed -e 's/  -//g'`
# sed command parsing hack, @ for &
        LOGINPOSTDATA='username='$LOGIN'@clearpass=@password='$MD5PASSWORD'@Login=Login'
        LOGINPOSTDATASIZE=`expr length "$LOGINPOSTDATA"`
        UPDATEPOSTDATA='ipv4b='$IPV4'@update=Submit'
        UPDATEPOSTDATASIZE=`expr length "$UPDATEPOSTDATA"`

        echo "+Set password hash: "$MD5PASSWORD

# Get session cookie
        echo "+Requesting cookie"
        MYCOOKIE=`echo "${COOKIETEMPLATE}" | nc tunnelbroker.net 80 $TIMEOUTOPTION | grep Cookie | tr -d '{\r\n}' | sed -e 's+Set-Cookie: ++' -e 's+; path=/++'`
        echo "+Got cookie value: "$MYCOOKIE

# log in with cookie and credentials
        echo "+Logging in"
        echo "${LOGINTEMPLATE}" | sed -e 's/POSTDATA/'$LOGINPOSTDATA'/' -e 's/POSTSIZE/'$LOGINPOSTDATASIZE'/' -e 's+COOKIE+'$MYCOOKIE'+' | tr '@' '&' \
                | nc tunnelbroker.net 80 $TIMEOUTOPTION > /dev/null
        echo "${LOGINTEMPLATE}" | sed -e 's/POSTDATA/'$LOGINPOSTDATA'/' -e 's/POSTSIZE/'$LOGINPOSTDATASIZE'/' -e 's+COOKIE+'$MYCOOKIE'+' | tr '@' '&' \
                | nc tunnelbroker.net 80 $TIMEOUTOPTION > /dev/null
        echo "+Switching tunnel" $TUNNELID "to: "$IPV4

# Update the tunnel ip endpoint
        SUCCESS=`echo "${UPDATETEMPLATE}" | sed -e 's/POSTDATA/'$UPDATEPOSTDATA'/' -e 's/POSTSIZE/'$UPDATEPOSTDATASIZE'/' -e 's+COOKIE+'$MYCOOKIE'+g' \
                -e 's+TUNNEL_ID+'$TUNNELID'+' | tr '@' '&' \
                | nc tunnelbroker.net 80 $TIMEOUTOPTION | grep "IPv4 endpoint has been updated\|That IPv4 endpoint is already in use"`

if [ -z "${SUCCESS}" ]
then
        echo "-Update FAILED"
        exit 1
else
        echo "+Updated Successfully"
#put  here your code to do ifdown / ifup on sit0 /  sit1 -and/or- he-ipv6
        exit 0
fi

########################################
# v 0.5 Francois Cartegnie
# e-mail: echo "spnegrtavr@serr.se" | tr A-Za-z N-ZA-Mn-za-m
#
[root@crobertp dyndns]#

TIA
« Last Edit: July 28, 2008, 09:29:03 AM by crobertp »
Logged

tufinhas

  • Newbie
  • *
  • Posts: 29
Re: regarding the updated web interface
« Reply #1 on: July 28, 2008, 06:05:34 PM »

same problem here

some changes in html code:

index.php -> login.php
username -> f_user
password -> f_pass

on Browser this works:
http://tunnelbroker.net/login.php?f_user=XXXXX&f_pass=YYYYY

edit: fixed, i think. [i forgot an '=' in my script  ::)]

just change this
index.php -> login.php
username -> f_user
password -> f_pass
« Last Edit: July 28, 2008, 06:22:37 PM by dragoon »
Logged

tufinhas

  • Newbie
  • *
  • Posts: 29
Re: regarding the updated web interface
« Reply #2 on: July 28, 2008, 06:39:32 PM »

i missed this  :)

ipv4_end.php?tunnelid -> ipv4_end.php?tunnel_id

Logged

crobertp

  • Newbie
  • *
  • Posts: 11
Re: regarding the updated web interface
« Reply #3 on: July 29, 2008, 01:39:00 PM »

i missed this  :)

ipv4_end.php?tunnelid -> ipv4_end.php?tunnel_id




just updated my script , but still not working

*appears that before calling ipv4_end.php , is need to call tunnel_detail.php?tunnelid=nnnn
*note that tunnel_detail.php  requires tunnelid  , while ipv4_end.php requires  tunnel_id

I wonder why ipv4_end.php didnt work direct after login , since tunnel_id=nnnnn is passed

so, im installing a network sniffer to try understanding whats happening

[edit] tbtw: is possible adding another param to ipv4_end.php ???

so, I will be able to call it direct , instead of having to type ip on that input field
example:
  ipv4_end.php?tunnel_id=12345&new_ipv4_ip="201.65.96.199"

*may be the problem is that root do *not* run java script , from any web pages it eventually visit
[/edit]


Thanks
« Last Edit: July 29, 2008, 02:06:17 PM by crobertp »
Logged

tufinhas

  • Newbie
  • *
  • Posts: 29
Re: regarding the updated web interface
« Reply #4 on: July 29, 2008, 02:01:49 PM »

i use this script

update.sh 1.2.3.4

Code: [Select]
#!/bin/sh
# IPv6 Update

hetunid=XXXX <- tunnel id
heusrnm=XXXXX <- username
heusrpw=XXXXXXXXX <- md5 password
hesiteu=http://ipv4.tunnelbroker.net
optcurl="-s -L -b /tmp/cookies.he -c /tmp/cookies.he -A Mozilla/4.0"
ipv4pub=$1
helog=/tmp/he-net.log

curl ${optcurl} ${hesiteu}/ > /dev/null
curl ${optcurl} -d "f_user=${heusrnm}&f_pass=${heusrpw}" ${hesiteu}/login.php > ${helog}
curl ${optcurl} -d "ipv4b=${ipv4pub}&update=Submit" ${hesiteu}/ipv4_end.php?tunnel_id=${hetunid} >> ${helog}
curl ${optcurl} ${hesiteu}/logout.php > /dev/null

# end
« Last Edit: July 29, 2008, 02:05:14 PM by dragoon »
Logged

tufinhas

  • Newbie
  • *
  • Posts: 29
Re: regarding the updated web interface
« Reply #5 on: July 29, 2008, 04:17:05 PM »

maybe curl do some emulation

i test directly on browser, and i get this error:

Update IPv4 Endpoint
SELECT username from auth_user_md5 where password = '' limit 1That password is not valid

edit: this error is funny :)
Code: [Select]
Please use the format http://www.tunnelbroker.net/ipv4_end.php
?ipv4b=ipv4b&pass=md5_hash_of_pass&user_id=user_id_from_main_page&tunnel_id=global_tunnel_id_from_tunnel_details
« Last Edit: July 29, 2008, 04:19:39 PM by dragoon »
Logged

samh

  • Newbie
  • *
  • Posts: 29
Re: regarding the updated web interface
« Reply #6 on: July 29, 2008, 04:25:49 PM »

Its almost like you were testing while I was pegging something in place to make it so you guys can automate without having to guess :)

The error code at :

http://www.tunnelbroker.net/ipv4_end.php should now have the proper code for calling that script.

basically in the change of platforms we ran up against a need to get rid of all the old session/authentication code from the old broker.  As such the ipv4_end script was not going to work right anymore.

The tunnelbroker itself now uses ipv4_update.php to do stuff inside itself and ipv4_end should never need to be updated again.

All you need to do is grab your variables once (The user_id is on the main page for your account, the tunnel_id is the global id on the tunnel details page, and the password can be generated by doing an md5 hash of your password) and then it should run forever.

We are also going to be able to now add support for other interesting update mechanisms like dynamic dns, etc...

Sam


maybe curl do some emulation

i test directly on browser, and i get this error:

Update IPv4 Endpoint
SELECT username from auth_user_md5 where password = '' limit 1That password is not valid

edit: this error is funny :)
Code: [Select]
Please use the format http://www.tunnelbroker.net/ipv4_end.php
?ipv4b=ipv4b&pass=md5_hash_of_pass&user_id=user_id_from_main_page&tunnel_id=global_tunnel_id_from_tunnel_details
Logged

tufinhas

  • Newbie
  • *
  • Posts: 29
Re: regarding the updated web interface
« Reply #7 on: July 29, 2008, 04:47:58 PM »

is better use https://ipv4.tunnelbroker.net/ipv4_end.php

tunnelbroker.net may cause problems when lost ipv6 connectivity
Logged

samh

  • Newbie
  • *
  • Posts: 29
Re: regarding the updated web interface
« Reply #8 on: July 29, 2008, 04:55:02 PM »

Not a bad point, message updated accordingly.

Sam

is better use https://ipv4.tunnelbroker.net/ipv4_end.php

tunnelbroker.net may cause problems when lost ipv6 connectivity
Logged

tufinhas

  • Newbie
  • *
  • Posts: 29
Re: regarding the updated web interface
« Reply #9 on: July 29, 2008, 05:06:39 PM »

if ipv4_end.php is to use with scripts only

you can remove unneeded html code

errors messages are enough :)
Logged

crobertp

  • Newbie
  • *
  • Posts: 11
Re: regarding the updated web interface
« Reply #10 on: July 30, 2008, 12:21:06 PM »

Not a bad point, message updated accordingly.

Sam

is better use https://ipv4.tunnelbroker.net/ipv4_end.php

tunnelbroker.net may cause problems when lost ipv6 connectivity

the problem here is that it says that my password i WRONG  ::)
disregard I had try
clear password
md5 password
with
http connecion
https connection
so , four trys , even un successful
Code: [Select]
+ wget 'https://ipv4.tunnelbroker.net/ipv4_update.php?ipv4b=201.51.92.101&pass=783eb4a07a51af015db6960418c5dc0b&user_id=crobertp&tunnel_id=11793'
--16:04:34--  https://ipv4.tunnelbroker.net/ipv4_update.php?ipv4b=201.51.92.101&pass=783eb4a07a51af015db6960418c5dc0b&user_id=crobertp&tunnel_id=11793
           => `ipv4_update.php?ipv4b=201.51.92.101&pass=783eb4a07a51af015db6960418c5dc0b&user_id=crobertp&tunnel_id=11793'
Resolving ipv4.tunnelbroker.net... done.
Connecting to ipv4.tunnelbroker.net[64.62.200.2]:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: error.php?e=2 [following]
--16:04:35--  https://ipv4.tunnelbroker.net/error.php?e=2
           => `error.php?e=2'
Connecting to ipv4.tunnelbroker.net[64.62.200.2]:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 5,757 [text/html]

100%[==================================================================================>] 5,757         24.66K/s    ETA 00:00

16:04:37 (24.66 KB/s) - `error.php?e=2' saved [5757/5757]

+ exit
[root@crobertp dyndns]#

So, please, fix your side 

btw: I run a p2p search engine on ipv6
http://yacy.hack-inter.net:8181/

and cause this problem, my search engine was un available for the world by about 12 hours   :'(

Thanks

 
Logged

broquea

  • Sr. Network Engineer, HE.NET AS6939
  • Administrator
  • Hero Member
  • *****
  • Posts: 1705
Re: regarding the updated web interface
« Reply #11 on: July 30, 2008, 12:30:33 PM »

Try using ipv4_end.php in your URL that you are fetching, like the other posts pointed out.

"ipv4_update.php" is not for the automated scripts, but rather the interactive website.
Logged

crobertp

  • Newbie
  • *
  • Posts: 11
Re: regarding the updated web interface
« Reply #12 on: July 30, 2008, 01:15:39 PM »

Try using ipv4_end.php in your URL that you are fetching, like the other posts pointed out.

"ipv4_update.php" is not for the automated scripts, but rather the interactive website.

ipv4_end.php  --> same error --> error.php?e=2  (in other words "wrong password")

ps: I have another script to do http://post

it succesfull login
then succeesfull select  detail.php?tunnelid=nnnn
then he net web server claims that my password is wrong :lol:

indeed the error is not on our scripts  :(

may be you can create an new xxxxx.php , test it (if working)
then post here its name as well  is usable parameters

That I will glady to write an new script , and post it here,  to everyone use (for free)

Thanks
 
Logged

tufinhas

  • Newbie
  • *
  • Posts: 29
Re: regarding the updated web interface
« Reply #13 on: July 30, 2008, 04:57:19 PM »

user_id isn't your username :)
you can find your user_id after login at tunnelbroker


Quote
Please use the format https://ipv4.tunnelbroker.net/ipv4_end.php?ipv4b=1&pass=2&user_id=3&tunnel_id=4
Where:

1 = The new IPv4 Endpoint
2 = The MD5 Hash of your password
3 = The User_id from the main page of the tunnelbroker
4 = The Global Tunnel ID from the tunnel_details page

it works here. :)

and... change your password. you writed your md5_pass in your post.
« Last Edit: July 30, 2008, 05:07:26 PM by dragoon »
Logged

normanr

  • Newbie
  • *
  • Posts: 35
Re: regarding the updated web interface
« Reply #14 on: July 31, 2008, 05:49:57 AM »

Thanks samh and broquea, the new ipv4_end script works great!

One thing I noted was that if I updated my endpoint too quickly it gave the following error:

Code: [Select]
<br />
<b>Warning</b>:  unlink(/tmp/tb.config.change.txt209.51.161.14) [<a href='function.unlink'>function.unlink</a>]: No such file or directory in <b>/home/tb/public_html/modules/tb.inc</b> on line <b>100</b><br />
Your Tunnel Endpoint has been updated.

The tunnel was correctly configured with the new ip address (according to the website), but the tunnel was non-functional (I assume the router never got updated correctly).  So perhaps there's a race condition somewhere if there's already a pending router change?

Cheers

Norman
« Last Edit: July 31, 2008, 05:56:12 AM by normanr »
Logged
Pages: [1] 2