commit 26213446116ffef0ee8d528a1a58aab918b16aa7 Author: Arturo Filastò arturo@filasto.net Date: Fri Sep 28 23:17:22 2012 +0000
Add test to obtain the clients IP address via check.tpo --- nettests/myip.py | 18 ++++++++++++++++++ 1 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/nettests/myip.py b/nettests/myip.py new file mode 100644 index 0000000..e7e96f2 --- /dev/null +++ b/nettests/myip.py @@ -0,0 +1,18 @@ +# -*- encoding: utf-8 -*- +# +# :authors: Arturo Filastò +# :licence: see LICENSE + +from ooni.templates import httpt +class MyIP(httpt.HTTPTest): + inputs = ['https://check.torproject.org'] + def processResponseBody(self, body): + print "FOOOO" + import re + regexp = "Your IP address appears to be: <b>(.+?)</b>" + match = re.search(regexp, body) + try: + self.report['myip'] = match.group(1) + except: + self.report['myip'] = None +