Other utils I've written


PPing


PPing is a TCP port pinger. Its output is similar to the ICMP ping command. It was developed and built on Linux/Solaris/FreeBSD/OpenBSD and BSD/OS. One of these days ill do a Windows version.. :)

Here is some example output:

This will connect to www.yahoo.com(-h) 5 times(-c) on port 80(-p). It will sleep 1 second(-s) between each connection. If the server doesnt respond within 3 seconds(-t) it will be considered a timeout, and the program will continue.

$ ./pping -h www.yahoo.com -s 1 -c 5 -t 3 -p 80
[1] www.yahoo.com(204.71.177.70):80 ... [time=12.979ms] accepting connections.
[2] www.yahoo.com(204.71.177.70):80 ... [time=9.193ms] accepting connections.
[3] www.yahoo.com(204.71.177.70):80 ... [time=11.856ms] accepting connections.
[4] www.yahoo.com(204.71.177.70):80 ... [time=16.474ms] accepting connections.
[5] www.yahoo.com(204.71.177.70):80 ... [time=16.204ms] accepting connections.
----------- www.yahoo.com:80 PPING Stats ----------
5 attempts, 5 connections, 0 failures, 0% failure rate
connect time (ms) min/avg/max 9.193/12.833/16.474
$
Do a check on www.microsoft.com, with recursive dns flag set(-r). Recursive DNS flag tells the program to lookup the IP on every connection attempt. This allows the user to see DNS load balancing/distributing metrics at work.
Note: In the case of check number 4, i guess the balancing isnt working very well.. heh! :)
$ ./pping -h www.microsoft.com -t 3 -s 1 -c 5 -p 80 -r
[1] www.microsoft.com(207.68.156.54):80 ... [time=86.437ms] accepting connections.
[2] www.microsoft.com(207.68.137.65):80 ... [time=142.289ms] accepting connections.
[3] www.microsoft.com(207.68.156.61):80 ... [time=58.505ms] accepting connections.
[4] www.microsoft.com(207.68.156.16):80 ... connection refused.
[5] www.microsoft.com(207.68.156.58):80 ... [time=57.501ms] accepting connections.
----------- www.microsoft.com:80 PPING Stats ----------
5 attempts, 4 connections, 1 failures, 20% failure rate
connect time (ms) min/avg/max 57.501/99.895/142.289
$
Do a quick check of www.blazen.com on port 80, and do not display the summary information at the end(-q).
$ ./pping www.blazen.com 80 -q 
[1] www.blazen.com(207.82.32.21):80 ... [time=14.378ms] accepting connections.
$

Do a quick check of www.go2net.com on port 77, and supress the display of summary information(-q).
$ ./pping www.go2net.com 77 -q 
[1] www.go2net.com(206.253.196.3):77 ... connection refused.
$

To check www.netscape.com, at the application level for http(-a), and fetch / (-f) with recursive DNS(-r). Note the 'rate' is in kbs and 'xtime' (xfer time) is in seconds, not ms like the connection time.
$ ./pping -h www.netscape.com -p 80 -t 3 -c 5 -s 1 -a http -r -f /
[1] www.netscape.com(204.152.167.20):80 ... [ctime=134.806ms] accepting connections.
HttpCode: 200(OK) 29743 bytes [rate=32.083kbs] [xtime=0.927s]
[2] www.netscape.com(204.152.167.20):80 ... [ctime=94.784ms] accepting connections.
HttpCode: 200(OK) 29743 bytes [rate=30.246kbs] [xtime=0.983s]
[3] www.netscape.com(204.152.167.20):80 ... [ctime=95.864ms] accepting connections.
HttpCode: 200(OK) 29743 bytes [rate=31.761kbs] [xtime=0.936s]
[4] www.netscape.com(204.152.167.20):80 ... [ctime=100.854ms] accepting connections.
HttpCode: 200(OK) 29743 bytes [rate=31.395kbs] [xtime=0.947s]
[5] www.netscape.com(204.152.167.20):80 ... [ctime=101.326ms] accepting connections.
HttpCode: 200(OK) 29743 bytes [rate=28.680kbs] [xtime=1.037s]
----------- www.netscape.com:80 PPING Stats ----------
5 attempts, 5 connections, 0 failures, 0% failure rate
connect time (ms) min/avg/max 94.784/114.795/134.806
$

Do a check of an NNTP daemon at Supernews. Use the raw protocol to issue an NNTP LIST command, and complete when we receive the ending '.'..
$ ./pping -h sekret.supernews.com -p 119 -s 1 -c 3 -t 10 -a raw -f LIST -m '.'
[1] sekret.supernews.com(0.0.0.0):119 ... [ctime=55.223ms] accepting connections. 1386957 bytes  [rate=205.890kBs] [xtime=6.736s]
[2] sekret.supernews.com(0.0.0.0):119 ... [ctime=4.864ms] accepting connections. 1386957 bytes  [rate=538.851kBs] [xtime=2.574s]
[3] sekret.supernews.com(0.0.0.0):119 ... [ctime=5.162ms] accepting connections. 1386957 bytes  [rate=519.331kBs] [xtime=2.671s]
----------- sekret.supernews.com:119 PPING Stats ----------
3 attempts, 3 connections, 0 failures, 0% failure rate
connect time (ms) min/avg/max 4.864/30.043/55.223
$

Do a check of the SMTP daemon on one of ebay's mail servers, specifying an invalid To: address(-T) to make sure relay'ing is disabled..
$ ./pping -h lore.ebay.com -s 1 -c 3 -t 25 -a smtp -f mike@weirdo.com -T bogusaddr@unresolvingdomain.com
[1] lore.ebay.com(66.135.195.181):25 ... [ctime=80.275ms] accepting connections. Error - SMTP RCPT To:  5.7.1 ... Relaying denied 396 bytes  [rate=1.715kBs] [xtime=0.231s]
[2] lore.ebay.com(66.135.195.181):25 ... [ctime=38.019ms] accepting connections. Error - SMTP RCPT To:  5.7.1 ... Relaying denied 396 bytes  [rate=1.778kBs] [xtime=0.223s]
[3] lore.ebay.com(66.135.195.181):25 ... [ctime=30.702ms] accepting connections. Error - SMTP RCPT To:  5.7.1 ... Relaying denied 396 bytes  [rate=1.961kBs] [xtime=0.202s]
----------- lore.ebay.com:25 PPING Stats ----------
3 attempts, 3 connections, 0 failures, 0% failure rate
connect time (ms) min/avg/max 30.702/55.489/80.275
$

Do another SMTP check against one of ebay's mail servers, this time specifying a ebay.com recipient(-T)..
$ ./pping -h lore.ebay.com -s 1 -c 3 -t 25 -a smtp -f mike@weirdo.com -T bogusaddr@ebay.com
[1] lore.ebay.com(66.135.195.181):25 ... [ctime=28.585ms] accepting connections. SMTP Email would be accepted. 380 bytes  [rate=1.617kBs] [xtime=0.235s]
[2] lore.ebay.com(66.135.195.181):25 ... [ctime=36.572ms] accepting connections. SMTP Email would be accepted. 380 bytes  [rate=2.037kBs] [xtime=0.187s]
[3] lore.ebay.com(66.135.195.181):25 ... [ctime=37.366ms] accepting connections. SMTP Email would be accepted. 380 bytes  [rate=1.744kBs] [xtime=0.218s]
----------- lore.ebay.com:25 PPING Stats ----------
3 attempts, 3 connections, 0 failures, 0% failure rate
connect time (ms) min/avg/max 28.585/32.975/37.366
$

NOTE: pping does not actually attempt to deliver email to the specified addresses. It simply checks if the server would accept email to and from the specified addresses and then resets SMTP session.

Check the HTTPS/SSL server for wellsfargo online banking with recursive dns(-r)..
$ ./pping -h online.wellsfargo.com -a https -s 1 -c 3 -t 25 -f /common/html/fatal_message.html -r
[1] online.wellsfargo.com(198.74.22.59):443 ... [ctime=98.295ms] accepting connections. HttpCode: 200(OK) 2005 bytes [rate=9.394kBs] [xtime=0.213s]
[2] online.wellsfargo.com(159.37.31.125):443 ... [ctime=48.025ms] accepting connections. HttpCode: 200(OK) 2005 bytes [rate=14.080kBs] [xtime=0.142s]
[3] online.wellsfargo.com(198.74.22.59):443 ... [ctime=80.357ms] accepting connections. HttpCode: 200(OK) 2005 bytes [rate=10.667kBs] [xtime=0.188s]
----------- online.wellsfargo.com:443 PPING Stats ----------
3 attempts, 3 connections, 0 failures, 0% failure rate
connect time (ms) min/avg/max 48.025/73.160/98.295
$

  • Download:
    09/19/03 Version 1.45 available
    Click here to download the source. It is small and very easy to build.
    What changed in 1.45:
    Adjusted the way SMTP checking works. If you do not specify a from address (-f) or To address (-T) it will consider the check successfull after it receives the SMTP greeting/banner from the smtp daemon.
    What changed in 1.44:
    Fixed some really stupid bug in the http request stuff. I dont believe its been there for 7 years and i never noticed and no one complained.... heh. :-)
    What changed in 1.43:
    Added https/ssl support using OpenSSL 0.9.7 or greated. Can compile it without https/ssl support by modifying the Makefile.
    What changed in 1.42:
    Added support for SMTP layer checking. It does not follow MX records, so that you may target specific SMTP daemons.
    What changed in 1.41:
    Added the -R flag. This allows you to set the HTTP Referer header.
    Fixed some typos.
    What changed in 1.40:
    Nothing really, just cleaned up some naming.
    What changed in 1.39:
    Added the -z flag, it will pass its argument as the hostname in the Host: http tag. For example, if you want to check virtual hosts, use -h ip.addr.or.hostname and -z virt.host to specify the virtual host. You can also use this to keep contacting the same machines behind a load balancer.
    Also made the default port 80 instead of 23 (if you dont specify it with -p), so you may have to update your scripts.
    What changed in 1.37:
    Extended the Raw protocol support. Now you dont have to specify a command to send. If you *dont* specify a command, it wont send anything and will try to match the -m parameter against whatever data it receives before the socket goes idle for longer then -t timeout.

  • Installation:
    After downloading 'gzip -d pping-v{version}.tar.gz', then 'tar xvf pping-v{version}.tar', and 'cd pping-v{version}'. View the README file for compiling/installation instructions.

    You can send questions or comments to me at mike@blazen.com.