manipulate your DNS files:
xdns v.0.05


Analog users need always to deal with DNS files.
Every time Analog perform a DNS read it appends the result to a text file, called DNS file (but it's just a common text file).
The standard DNS file for Analog has the form:
time ip name

After some queries this file become fat, because old queries aren't automatically removed.
Moreover, sometimes a DNS server is unavailable, so the query for an IP gives a null result, while the same IP was correctly resolved during the previous query.
If you make regular backups of your DNS file (just in case an IP is redirected to another domain) this script can be a lot helpful. With it you can:
  1. merge two DNS files
  2. remove double entries
  3. recover resolved IPs now unresolved
  4. sort lines by IP in the right order (if you make a simple sort the IP goes after!)
  5. be warned if the same IP has different names (even static IPs aren't very static)
  6. modify the format of the DNS file if you need to manipulate it with other programs
  7. remove WINS names (GOOFY rather than modem01.foo.com: Analog hate this!)
  8. count how much group A IPs (123.*.*.*) you have and sort them by entries (new in 0.05)
  9. strip unresolved IPs to trade DNS files with friends just like Pokemon cards

Here are some easy instructions for this script:
  • download Analog at http://www.analog.cx
  • RTFM and subscribe the Analog-help mailing list (but don't ask there about this program!)
  • download xdns-pl.txt - 11.5 Kb (and rename it to xdns.pl in order to launch it!)
  • download xdns-cfg.txt - 3.5 Kb (and rename it to xdns.cfg in order to use it!)
  • put xdns.pl and xdns.cfg into the directory where your DNS files are placed (not mandatory, but easier for the configuration)
  • edit xdns.cfg with your preferred text editor, read carefully comments contained into it and:
    • assign to DNS_ONE the name of the main DNS file
    • assign to DNS_TWO the name of the other DNS file
    • assign to DNS_OUT the name of the output file
    • assign to DNS_ERR the name of the file where to store warnings
    • assign to DNS_CNT the name of the file where to store group A count (if you ask for it)
    • set WINS file to remove WINS names and save them to WINSFILE - on just remove them - off leave them unchanged (default: file)
    • set WARNING on to see warnings on video - off don't show them (default: on)
    • set SPINCOUNT on to see spinning counter - off don't show it (default: on)
    • set COUNTA on to count A groups - off don't count them (default: off)
    • set CNT_SORT ip to group A entries by IP - value sort them by number of entries (default: ip)
    • set JUSTCOUNT on to perform just the count of A groups contained into DNS_OUT and exit without other performances (default: off)
    • set STRIPUNR on to removes unresolved IPs from DNS_ONE, save resolved ones into DNS_OUT and exit without other performances (default: off)
Be careful with file names, or you can overwrite your DNS file (or, worst, your win.com file!)
Always better to do a backup copy of it.

Just in case you need the spinning counter (SPINCOUNT on) and your computer don't use chr(8) as backspace (the key "eating" text on the screen from right to left) you must modify BS and assign the correct value.

If you need to modify the output there is a variable called DNS_FORMAT: its default value is fanalog, to write output good for Analog.
You can write into DNS_FORMAT some of these parameters:
  • FANALOG - pre-built Analog format (default value)
  • FTIME - time
  • FIP - ip
  • FNAME - default name (choosen by the script)
  • FDATE - time (human date format)
  • FDEC - decimal IP (for sorting)
  • FNAME1 - name from last DNS file
  • FNAME2 - name from previous DNS file
  • FTIME1 - time from last DNS file
  • FTIME2 - old time from previous DNS file
  • FDATE1 - time (human date format) from last DNS file
  • FDATE2 - time (human date format) from previous DNS file
To separate fields you can use one or more of these:
  • FSPACE - space
  • FTAB - tab
  • FCOMMA - ,
  • FCOLON - :
  • FSEMI - ;
  • FCRLF - new line

So, if you need to have a file showing a readable date, a tab, the IP, a tab, the name from last DNS file, a tab, the name from previous DNS file you must use:

Launch this script and wait for a "beep" or whatever sound is doing your machine (if you are analyzing a huge DNS file on a 486 you can have a coffee-break, I suppose - and a pizza if you ask to count A groups).

Here is the result table: I see there was a visitor using LYNX, so I use a <PRE> table rather than a <TABLE> ;-)

 newer entry        older entry       name used
--------------   -----------------   -------------
unresolved (*)     unresolved (*)     newer name
                     or NULL

resolved           unresolved (*)     newer name
                     or NULL

unresolved (*)       resolved         older name

resolved             resolved         newer name
                                  (with a WARNING
                                  if names aren't equal)

If you need to have some resolved European IPs (mainly Italian) you can download my gzipped DNS file (15396 entries - 170 kb gzipped, 741770 bytes when expanded) and use xdns to merge it with your file.
There are:
151.*.*.* 3710 results
 62.*.*.* 2681 results
212.*.*.* 1806 results
195.*.*.* 1023 results
194.*.*.* 618 results
209.*.*.* 555 results
and more...

  • To count A groups is slow (memory problems?). Better to run this option separately setting JUSTCOUNT ON.
    You need to have a space or a tab before and after the IP: comma, colon, semicolon and newline aren't accepted.
  • You can remove unresolved IPs only if the asterisk is after a space or a tab: comma, colon, semicolon and newline aren't accepted.
I tell you they are unknown! Send them to me (webmaster@taggiasca.com).

You can use this utility freely, and you can modify and improve it (let me know, if you do this!): it is under Perl Artistic License.
It may be used for commercial use only by prior arrangement with the author (Marco Bernardini, webmaster of taggiasca.com).

If you buy some excellent olive oil from our producers this makes me a lot happy. Alas, overseas expeditions are very expensive, so I'm not hurted if you don't buy it it because you're too far.

Analog is (c) by Stephen Turner - see http://www.analog.cx for more infos and for the latest version.

No warranty of any sort, expressed or implied, is provided in connection with the program(s), including, but not limited to, implied warranties of merchantibility or fitness for a particular purpose.
Any cost, loss or damage of any sort incurred owing to the malfunction or misuse of the program(s) or the inaccuracy of the documentation or connected with the program(s) in any other way whatsoever is the responsibility of the person who incurred the cost, loss or damage.
By using this/these program(s) you give up any right to seek any damages against me in connection with this/these program(s).

In other words: before to press a key sit on your hands and think; if you mess up your computer because you overwrite your Windows configuration assigning wrong names to output files it's yours, not mine; if you're fired because your boss don't like your reports it's your job, not mine; if your wife leave you because you waste too many time with your computer she's your wife, not mine (mine usually is sleeping while I'm typing these oddities).
Backup often your hard disk, work hard and be kind with your wife (not necessarily in this order) and life smiles you.


*Previous page   *Upper level   *Main page

*shop   *Site Map

copyright © 1999 - 2000 by It-Web Information Technology - all rights reserved