4 usage: %(progname)s hostname 7 import os, sys, string, time, getopt, re, urllib
10 print __doc__ % vars()
12 def main(argv, stdout, environ):
14 optlist, args = getopt.getopt(argv[1:],
"", [])
23 url =
"http://%s/" % host
24 fp = urllib.urlopen(url)
28 body = re.sub(
'<[-=+/"A-Za-z0-9 ]*>',
"", body)
29 body = re.sub(
" ",
" ", body)
31 pat = re.compile(
"WAN IP: ([0-9.]*)")
39 if __name__ ==
"__main__":
40 main(sys.argv, sys.stdout, os.environ)
def main(argv, stdout, environ)