--- ipcheck-0.233.orig/ipcheck.8 +++ ipcheck-0.233/ipcheck.8 @@ -0,0 +1,116 @@ +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.33. +.TH IPCHECK "8" "November 2003" "Debian GNU/Linux" "System Administration Utilities" +.SH NAME +ipcheck \- dyndns.org client +.SH DESCRIPTION +Usage : ipcheck.py [options] Username Password Hostnames +or ipcheck.py [options] \fB\-\-acctfile\fR acct_info_file +.PP +Options: \fB\-a\fR address manually specify the address +.TP +\fB\-r\fR URL +NAT router, use web IP detection +.TP +\fB\-A\fR text +scan syslog for an IP after text (Unix only) +.TP +\fB\-F\fR filename +guess the WAN IP from a firewall log +.TP +\fB\-b\fR +backup mx option ON (default OFF) +.TP +\fB\-c\fR +custom dns option (default dynamic) +.TP +\fB\-d\fR dir +directory for data files (default current) +.TP +\fB\-e\fR script +execute script after a successful update +.TP +\fB\-f\fR +force update regardless of current state +.TP +\fB\-g\fR +NAT router, let dyndns guess your IP +(do not use this in a cronjob, try \fB\-r\fR) +.TP +\fB\-h\fR +print this help text +.TP +\fB\-\-help\fR +print all available help text +.TP +\fB\-i\fR interface +interface for local address (default ppp0) +.TP +\fB\-j\fR +disable https +.TP +\fB\-l\fR +log debugging text to ipcheck.log file +.TP +\fB\-\-syslog\fR +log debugging text to syslog (Unix only) +.TP +\fB\-m\fR mxhost +mx host (default NOCHG) +.TP +\fB\-o\fR +set dyndns offline mode +.TP +\fB\-p\fR +proxy bypass on port 8245 +.TP +\fB\-q\fR +quiet mode (unless there is an error) +.TP +\fB\-s\fR +static dns option (default dynamic) +.TP +\fB\-t\fR +test run, do not send the update +.TP +\fB\-v\fR +verbose mode +.TP +\fB\-w\fR +wildcard mode ON (default OFF) +.TP +\fB\-\-makedat\fR +create the ipcheck.dat file by dns lookup +.TP +\fB\-\-devices\fR +print router options (Linksys, Netgear, etc) +.TP +\fB\-n\fR ip +the router IP address on the internal lan +.PP +For help with different options: python ipcheck.py \fB\-h\fR +For supported devices listing : python ipcheck.py \fB\-\-devices\fR +For long detailed help text : python ipcheck.py \fB\-\-help\fR +.PP +Make sure you can write to the current directory for data +files and that you always run from the same directory. +The first time you run the script, you will be asked to run +with the \fB\-\-makedat\fR option in addition to any other options. +This will create the data files for the hostnames and options +your specify on the command line. You should only do this once. +Subsequent runs should be made without the \fB\-\-makedat\fR option. +.PP +For help with different options: python ipcheck.py \fB\-h\fR +For supported devices listing : python ipcheck.py \fB\-\-devices\fR +For long detailed help text : python ipcheck.py \fB\-\-help\fR +.PP +Example 1: the external IP is on eth0 of the current machine +python ipcheck.py \fB\-l\fR \fB\-i\fR eth0 username password hostnames +.PP +Example 2: you are using the Linksys routing device +python ipcheck.py \fB\-l\fR \fB\-L\fR linksyspassword username password hostnames +.PP +Example 3: you want to use web based ip detection +python ipcheck.py \fB\-l\fR \fB\-r\fR checkip.dyndns.org:8245 ... +.PP +where ... is your dyndns username password and hostnames. +Hostnames should be comma delimited if there are more than one. --- ipcheck-0.233.orig/ipcheck.py +++ ipcheck-0.233/ipcheck.py @@ -5187,15 +5187,15 @@ logger.logit(logline) # try to get the html text + fp = None try: fp = h2.getfile() httpdata = fp.read() - fp.close() except: httpdata = "No output from http request." - # explicitly close - fp.close() + if fp: + fp.close() logline = "fd closed" logger.logit(logline) --- ipcheck-0.233.orig/index.html +++ ipcheck-0.233/index.html @@ -113,6 +113,321 @@
+Make sure you can write to the current directory for data +files and that you always run from the same directory. +The first time you run the script, you will be asked to run +with the --makedat option. This will create the data files +and complete the update. You should only do this once. +Subsequent runs should be made without the --makedat option. + +For help with different options: python ipcheck.py -h +For supported devices listing : python ipcheck.py --devices +For long detailed help text : python ipcheck.py --help + +In the following examples, ... = username password hostnames +where hostnames is a comma separated list of hosts you wish +to be updated. The -l option creates an ipcheck.log file. + +Example 1: the external IP is on eth0 of the current machine +python ipcheck.py -l -i eth0 ... + +Example 2: you are using the Linksys routing device +python ipcheck.py -l -L linksyspassword ... + +Example 3: you want to use web based ip detection +python ipcheck.py -l -r checkip.dyndns.org:8245 ... + +Usage : ipcheck.py [options] Username Password Hostnames +or ipcheck.py [options] --acctfile acct_info_file + +Options: -a address manually specify the address + -b backup mx option ON (default OFF) + -c custom dns option (default dynamic) + -d dir directory for data files (default current) + -e script execute script after a successful update + -f force update regardless of current state + -g NAT router, let dyndns guess your IP + (do not use this in a cronjob, try -r) + -h print this help text + --help print all available help text + -i interface interface for local address (default ppp0) + -l log debugging text to ipcheck.log file + --syslog log debugging text to syslog (Unix only) + -m mxhost mx host to send if -b (default none) + -o set dyndns offline mode + -p proxy bypass on port 8245 + -q quiet mode (unless there is an error) + -r URL NAT router, use web IP detection + -s static dns option (default dynamic) + -t test run, do not send the update + -v verbose mode + -w wildcard mode ON (default OFF) + --makedat create the ipcheck.dat file by dns lookup + --devices print router options (Linksys, Netgear, etc) + +For help with different options: python ipcheck.py -h +For supported devices listing : python ipcheck.py --devices +For long detailed help text : python ipcheck.py --help + + +The script will locate the address of your router automatically by +looking at the default route of the machine you are running on. +Then it will read the status page for the external IP address +and use that for updates. You need to specify the admin password +with the appropriate option. + + -L password Linksys (BEFSR41) NAT router password + -N password Netgear (RT311) NAT router password + -D password Draytek (Vigor2000) NAT router password + -O password Netopia (R9100) NAT router password + -H password HawkingTech router password + -W password Watchguard SOHO NAT firewall password + -Y password Cayman DSL 3220H NAT router password + +You can change the default username for the above devices with: + + -U username override default NAT router username + leave this option out to use the default + +Devices that do not need a username: + + -X Nexland router (no password set) + -Z password ZyXEL prestige router password + -S SMC Barricade (no password needed) + -M password Compex NetPassage 15 + -G UgatePlus (no password needed) + -7 password DLink DI701 password + +Cisco devices: + + -C password Cisco (667i) DSL router password + -I password Cisco (700 series) ISDN router password + +For Cisco IOS devices and any others that understand SNMP, you +can also use --snmp to detect the external IP. + + --snmp snmp_agent,community,numeric_objectid + +You will need the pysnmp module from http://pysnmp.sourceforge.net/ +You also need to know the agent, community and numeric objectid: +python ipcheck.py --snmp 172.62.254.254,public,.1.3.5.2.1.2.10.2.5.4 ... +where ... = username password hostnames + + +Start ipcheck.py with no arguments to get some quick examples. + +The script creates data files in the current working directory. +Make sure you have write permission and that you run the script +from the same directory each time. You can use the -d option +to specify an alternate directory for data files. + +The first time you run the script, you will be asked to run +with the --makedat option. This will create the data files +and complete the update. You should only do this once. +Subsequent runs should be made without the --makedat option. + +If -f is set, all hosts will be updated regardless of the +current error, wait or IP state. You should never need this. + +You can place your username password and hostnames in a file +(all on the first line) and use the --acctfile option if you do +not wish your password to show up on a ps. + +The best way to run ipcheck is in the /etc/ppp/ip-up.local file +or the BSD ppp.linkup file (you will need to sleep 30 before +running the script since ppp.linkup runs before the link is up.) +The script will also run from a cronjob. Just make sure the +hostnames are the same in each execution. You should make sure +it is using the same directory each time for data files. The -d +option can be used to specify where data files go. + +The file ipcheck.dat contains the IP address and hostnames +used in the last update. If the ipcheck.dat file is older +than 25 days, an update will be made to touch +the hostnames. + +The file ipcheck.wait is created if dyndns requests a wait +before retrying. This file will be automatically removed when +the wait is no longer in effect. + +The file ipcheck.err is created if the response is an error. +It will not try to update again until this error is resolved. +You must remove the file yourself once the problem is fixed. + +If your ISP has a badly behaved transparent proxy on port 80 +traffic, you can try the -p option to use port 8245. + +If a http message is sent to dyndns.org, the response will be +saved in the ipcheck.html file. + +Custom domains can be specified with the -c option. You must +first complete the create database step on the Dyndns web page. +Suppose you have the domain ipcheck.org defined as an A record +and your nodes aliased to ipcheck.org with CNAME records. Use: +python ipcheck.py -c username password ipcheck.org + +Note that if you intended to maintain both a custom domain and +a dyndns domain (ie. ipcheck.dyndns.org) you should be using +the -d option to keep the data files in separate directories. +The custom domains are not compatible with the offline, mx, +backmx and wildcard options. Setup your database accordingly. + +The script can find your public IP address in one of several ways: + +1) interface IP detection is the default method and appropriate +if the machine you are running on has an interface with the public +IP addressed assigned. The script knows how to query various +operating systems for the address of an interface specified +with the -i option (default ppp0). Note on Win32 systems +specify the MAC address device after -i and on BeOS systems +specify the interface number after -i (eg. -i 1). + +2) router IP detection is used if you have a routing device +such as a Netgear RT311. Use the --devices option to get a +help on specific devices. This method is used by the script +if you specify one of the device-related options. + +3) web IP detection may be used if your device is not supported +python ipcheck.py -r checkip.dyndns.org:8245 ... +where ... = username password hostnames +This method is used if you specify the -r option. +IMPORTANT: Do not run web based IP detection more often +than once every 15 minutes. It is costing dyndns bandwidth. + +4) you can explicitly set the desired IP address with -a + +5) when -g is used, the script will not send any IP address +at all (even ones detected by the previous options). Only +the account information will be sent to the dyndns server. +The dyndns server will assign the hostnames to the source +IP address of the request. The assigned address is saved in +the ipcheck.dat file. IMPORTANT: Do not run this from a cronjob +unless you know the address saved in the ipcheck.dat file +matches locally detected public IP to prevent unnecessary updates. + +If your have an unsupported device and are willing to help with +some testing, email me. + +The ipcheck homepage can be found at: +http://ipcheck.sourceforge.net/ + +Client development information can be found at: +http://support.dyndns.org/dyndns/clients/devel/ + +Please include the ipcheck.log file if you email me with a problem. +kal@users.sourceforge.net + ++ + +