• Welcome to Hurricane Electric's IPv6 Tunnel Broker Forums.

Script for Certification tests

Started by edmundwatson, May 23, 2011, 03:07:07 AM

Previous topic - Next topic

edmundwatson

to johnpoz

does sound like you had a ipv6 failure.
I have noticed that sixy.ch is slow over ipv4, and often timesout. (You can change the timeout somewhere in the code. I think it is set to 30 seconds) but yeah  if you ipv6 is not working better check that :-P

You can see what was submitted to HE by looking at tracertraw.txt (or named something simliar) also check fail.html. If you have look at that it may explain your errors.

"Fail - unknown error"  is just when the error isn't one I haven't come across before. But then it extracts the reason from the returned page on HE and display it. Hence the "Can't find any IPv6 hops or this is an invalid IPv6 traceroute!" I will add it to the list of know errors...


Have fun

Ed

johnpoz

well that */1445 is not working its running every hour on the hour with that.

Which is kind of hammering he.net if you ask me -- I would be kind of pissed if everyone was doing that.  So turning it off.

So still need a way to run the script 24 hours and few minutes later every day to get around the 24 hour clock on he.net  they really should make it like a 23:55 clock.

But got my 5 points today from the script running.

yakatz

#17
Quote from: johnpoz on May 30, 2011, 08:11:19 AM
well that */1445 is not working its running every hour on the hour with that.
Mine too. I looked at having the script use a scheduled job (AT) instead of CRON.

yakatz

(I moved this to a new post so that the email notifications will activate.)


#!/bin/bash
php he.php
echo "$0" | at tomorrow + 5minutes

I named this he.sh and put it in the same directory as everything else.
chmod +x he.sh
Execute it once to set it up/

I also added it to my user crontab so it will run if the server is restarted:
Quote from: crontab -e# m h dom mon dow user  command
@reboot cd /home/yehuda/he; ./he.sh

johnpoz

yeah that looks like a great idea, will give it a go tmrw after my current 24 hour clock has expired.

yakatz

I would like to report that this script along with my AT job addition has been working well for over a week.

I did run in to a minor issue with my jobs not being run, but that was a Ubuntu bug

juhoostman

Security fix:
diff --git a/getips.php b/getips.php
index 5256ca0..74d1b0a 100644
--- a/getips.php
+++ b/getips.php
@@ -22,7 +22,7 @@ if ($xml && !empty($xml))
foreach($xml->entry as $entry) {
$title = base64_encode($entry->title);
//getting ip from dig
- $arip = preg_split("/((?<!\\\|\r)\n)|((?<!\\\)\r\n)/",trim(shell_exec("dig $entry->title AAAA +short")));
+ $arip = preg_split("/((?<!\\\|\r)\n)|((?<!\\\)\r\n)/",trim(shell_exec("dig ".escapeshellcmd($entry->title)." AAAA +short")));
//may have multiply ips so adds them a different entries.
foreach($arip as $ipraw)
{

That is because I would hate if an RSS feeded commands to my shell.

yakatz

Quote from: juhoostman on June 19, 2011, 05:09:41 AM
Security fix:

- $arip = preg_split("/((?<!\\\|\r)\n)|((?<!\\\)\r\n)/",trim(shell_exec("dig $entry->title AAAA +short")));
+ $arip = preg_split("/((?<!\\\|\r)\n)|((?<!\\\)\r\n)/",trim(shell_exec("dig ".escapeshellcmd($entry->title)." AAAA +short")));

That is because I would hate if an RSS feeded commands to my shell.
I put in a pull request for this change to edmundwatson on GitHub.

https://github.com/tactmaster/HECT/pull/1

edmundwatson

Sorry for not poking at this for a while, Tallinn is a very nice city I would recommend it for a short trip :-P

Cool. Thanks very much for this. That should now be in the code.
Also line 23
$title = base64_encode($entry->title)
has the same problem as that is used later when the real test are used. That has been fixed also.

I have tided up the code a bit.
The settings have been moved in to a setting.json file.
Which gets created on first run.
This means that in future update you can just update from the git repo and you won't have to reset you settings.

(It also means I don't accidently commit my username and password  ;))

The at solution looks good.

I am writing another php script at the moment which needs to be daemonised. So I may add this to code in the near future.

klank

Just wanted to poke my head in and say "Thank You" for making this script!

;D

juhoostman

Quote from: edmundwatson on June 20, 2011, 08:03:38 AM
Also line 23
$title = base64_encode($entry->title)
has the same problem as that is used later when the real test are used. That has been fixed also.
Was that not taken care of in getAddress:

    $address = array('host' => escapeshellcmd(base64_decode($ipdata[0])), 'ip' => escapeshellcmd(base64_decode($ipdata[1])));

It seems that the hostname would be escaped twice, not that it matters for any valid input.
As for me, I would escape the strings just before they are used to form a command line.

edmundwatson

Yeap fair enough! I forgot about that.

chandro

i only get errors, why?

root@orev [~/HE]# php he.php
Current Dir: HECT/
Start:Thu, 23 Jun 11 09:50:15 -0600
RSS Check adding:pokeritieto.fi 2a01:4f8:110:3162:0:a:bad:beaf cG9rZXJpdGlldG8uZ
adding:iki.fi 2a00:1c30:1c1::51 aWtpLmZp  MmEwMDoxYzMwOjFjMTo6NTE=
Count:54
IP:2001:8c0:3202:1::3 Host:ventelo.no
Whois
Not Done
Performing again : 0
Performing Test..
whois 2001:8c0:3202:1::3
Fail - invalid submission
IP:2001:5c0:1000:b::57e9 Host:galactic.no
Performing again : 1
Performing Test..
whois 2001:5c0:1000:b::57e9
Fail - invalid submission
IP:2a01:4f8:110:3162:0:a:bad:beaf Host:pokeritieto.fi
Performing again : 2
Performing Test..
whois 2a01:4f8:110:3162:0:a:bad:beaf
Fail - invalid submission
IP:2a00:1c30:1c1::51 Host:iki.fi
Performing again : 3
Performing Test..
whois 2a00:1c30:1c1::51
Fail - invalid submission
Ran Out
RSS Check Count:54
IP:2001:638:804:a082::1:225 Host:wwwiuk.informatik.uni-rostock.de
Performing again : 4
Performing Test..
whois 2001:638:804:a082::1:225
2001:0:0:7::B0ND

edmundwatson

In ~/HE/HECT you should have a file called whoisraw.txt
Can you let me know what is in that file. That should display your error.

Thanks.
Ed