Please take a moment to read http://bit.ly/demandglobalchange, to help share the message and support the initiative to tell our leaders to focus on addressing the global world problems, instead of complaining about the effects of their lack of leadership. Be a leader yourself, and share this with as many people as possible. #demandglobalchange // https://www.facebook.com/demandglobalchange



Please consider donating: https://www.corelan.be/index.php/donate/


5,812 views | This page as PDF

Free tool – PVE TCP Ping Utility – v1.0.0.1

I wanted to share a small utility that I wrote a while ago, allowing you to run a non-interactive ‘ping’ to a tcp port (e.g. from within a script).

This could for example allow you to bring up a VPN tunnel from a script (by generating traffic to a target host), to determine whether a tcp port is open or not and so on… I’m sure all of you are creative enough to see the wide range of possibilities and applications for this utility.

The tool is a command-line utility, should run on Windows 32bit and 64bit, and requires .Net framework 2.0.

Usage :

Unzip the file and place the file pvetcpping.exe somewhere on your harddrive, preferable in a folder that is part of your PATH variable (e.g. c:windowssystem32)

If you run the utility without parameters, this is what you’ll get :

---------------------------------
PVE TCP Ping Utility
Written by Peter Van Eeckhoutte
http://www.corelan.be:8800
Version 1.0.0.1
---------------------------------

Usage :
pvetcpping.exe   []

Both the  and  parameters are mandatory.
The  parameter is optional.
Set this parameter to 0 to launch a continuous ping.

As you can see, there are 3 possible parameters. The target host and target port number are mandatory, the number of pings is optional. If you don’t specify a number of pings, then 4 pings will be performed.

If you run the utility with correct parameters, this is what you should get :

c:> pvetcpping.exe www.google.com 80
---------------------------------
PVE TCP Ping Utility
Written by Peter Van Eeckhoutte
http://www.corelan.be:8800
Version 1.0.0.1
---------------------------------

[+] Connecting to tcp port 80 on host www.google.com...
[+] Number of pings : 4
[+] Started probing at 20:33:32
[+] Probing host www.google.com on port tcp/80 - Connect OK - 84ms.
[+] Probing host www.google.com on port tcp/80 - Connect OK - 17ms.
[+] Probing host www.google.com on port tcp/80 - Connect OK - 19ms.
[+] Probing host www.google.com on port tcp/80 - Connect OK - 18ms.

TCP Ping statistics for www.google.com port tcp/80
Connects : 4, Success : 4, Failed : 0 (0% loss)
Approximate round trip times in milli-seconds:
Minimum = 17ms, Maximum = 84ms, Average = 34ms

Starting from version 1.0.0.1, timestamps are added to the output of the utility

  • when the probes start
  • when the status changes
---------------------------------
 PVE TCP Ping Utility
 Written by Peter Van Eeckhoutte
 http://www.corelan.be:8800
 Version 1.0.0.1
---------------------------------

 [+] Connecting to tcp port 22 on host 192.168.0.116...
 [+] Number of pings : Unlimited
 [+] Started probing at 20:33:32
 [+] Probing host 192.168.0.116 on port tcp/22 - Connect OK - 30ms.
 [+] Probing host 192.168.0.116 on port tcp/22 - Connect OK - 0ms.
 [+] Probing host 192.168.0.116 on port tcp/22 - Connect OK - 0ms.
 [+] Probing host 192.168.0.116 on port tcp/22 - Connect OK - 0ms.
 [+] Probing host 192.168.0.116 on port tcp/22 - Connect OK - 0ms.
 [+] Probing host 192.168.0.116 on port tcp/22 - Connect OK - 0ms.
 [-] Probe status changed at 20:33:59
 [-] Probing host 192.168.0.116 on port tcp/22 - Connect failed
 [-] Probing host 192.168.0.116 on port tcp/22 - Connect failed
 [-] Probing host 192.168.0.116 on port tcp/22 - Connect failed
 [+] Probe status changed at 20:34:44
 [+] Probing host 192.168.0.116 on port tcp/22 - Connect OK - 0ms.
 [+] Probing host 192.168.0.116 on port tcp/22 - Connect OK - 0ms.
 [+] Probing host 192.168.0.116 on port tcp/22 - Connect OK - 0ms.
 [+] Probing host 192.168.0.116 on port tcp/22 - Connect OK - 0ms.

 TCP Ping statistics for 192.168.0.116 port tcp/22
     Connects : 13,  Success : 10, Failed : 3  (0% loss)
 Approximate round trip times in milli-seconds:
     Minimum = 30ms, Maximum = 30ms, Average = 2ms

Version history

1.0.0.1 : April 2009 : Added timestamps to output

1.0 : Initial release

Known issues

The statistics at the end of the probe sequence may report an incorrect loss percentage.

Download

Note : before downloading the utility, you must be logged on to this blog.

Registration is free, you can register here

You can download the utility from the link(s) below :

Please log in to download PVE TCP Ping (21.1 KiB)

2008 – 2010, Corelan Team (corelanc0d3r). All rights reserved.

Related Posts:

6 Responses to Free tool – PVE TCP Ping Utility – v1.0.0.1

  • werner says:

    Hello,
    the downloadlink isn’t aktive, only the message “download#11#image” displays.
    Please can you send me a link to the tool pvetcpping.
    Thank you.
    Greeting,
    Werner

  • Hello Werner,

    the download link problem should be fixed now – please try again

    Peter

  • good question. In the code that connects to the tcp port, I’m
    – getting the current time, in milliseconds (begintime)
    – connecting & reading the returning packets
    – getting the current time, in milliseconds (endtime)
    – calculating the delta (endtime – begintime)
    The only cases where the delta would be 0 is
    – if the begintime equals the endtime
    – if the endtime is less than begintime (so delta < 0). This could be an internal clock issue... In my code, I'm setting negative delta's to 0. Perhaps I should leave them as a negative value, but it would look bad, wouldn't it - if the delta value returned by the function could not be converted to an integer. (it's just a safety precaution in my code - it should never happen) Anyways - the code should return any values, including values below 16ms... unless the internal clock cannot handle it or unless it really is 0ms (starttime = endtime)... So I guess it's not a code limitation, but it may be a system limitation

  • brownj00 says:

    Hi, great tool – I really like it.

    One question – I am getting some results of “0 ms” mixed in with 30’s and 40’s. I doubt the “0” is accurate so I assume there is a minimal resonse threshold that is accurately reported. I’ve seen exactly that with other similar utilities as well… anything under 16ms for example is just reported as zero.

    do you know what is the lowest time in ms that will be accurately reported?

  • there’s got to be a different reason for the behaviour you are seeing

    Results of a tcpping to my webserver, also on gigabit network :

    ———————————
    PVE TCP Ping Utility
    Written by Peter Van Eeckhoutte
    http://www.corelan.be:8800
    Version 1.0
    ———————————

    [+] Connecting to tcp port 8800 on host http://www.corelan.be...
    [+] Number of pings : Unlimited
    [+] Probing host http://www.corelan.be on port tcp/8800 – Connect OK – 114ms.
    [+] Probing host http://www.corelan.be on port tcp/8800 – Connect OK – 2ms.
    [+] Probing host http://www.corelan.be on port tcp/8800 – Connect OK – 1ms.
    [+] Probing host http://www.corelan.be on port tcp/8800 – Connect OK – 1ms.
    [+] Probing host http://www.corelan.be on port tcp/8800 – Connect OK – 2ms.
    [+] Probing host http://www.corelan.be on port tcp/8800 – Connect OK – 1ms.
    [+] Probing host http://www.corelan.be on port tcp/8800 – Connect OK – 1ms.
    [+] Probing host http://www.corelan.be on port tcp/8800 – Connect OK – 2ms.
    [+] Probing host http://www.corelan.be on port tcp/8800 – Connect OK – 1ms.
    [+] Probing host http://www.corelan.be on port tcp/8800 – Connect OK – 1ms.
    [+] Probing host http://www.corelan.be on port tcp/8800 – Connect OK – 1ms.
    [+] Probing host http://www.corelan.be on port tcp/8800 – Connect OK – 1ms.
    [+] Probing host http://www.corelan.be on port tcp/8800 – Connect OK – 4ms.
    [+] Probing host http://www.corelan.be on port tcp/8800 – Connect OK – 1ms.

    TCP Ping statistics for http://www.corelan.be port tcp/8800
    Connects : 14, Success : 14, Failed : 0 (0% loss)
    Approximate round trip times in milli-seconds:
    Minimum = 1ms, Maximum = 114ms, Average = 9ms

    As you can see, the tcpping does report latency of less than 16 ms…

  • brownj00 says:

    Right, thanks.

    I doubted it was a limitation in your code itself, but maybe there is an underlying limitation with the .Net stuff – how often it can get the cpu time or execution. I will be the first to tell you I don’t know enough to do more than ask silly questions so I will defer to you as the guru.

    I’ve tried it on several systems (PC’s and servers, XP, 2003, 32 & 64bit etc.) and get the same thing- never a result between 1-15 ms. Even when on the same Gb segment, 0 or 17+ and over the router where I expect 5-10 ms is the exact same results.

    Just curious, because what I really need to do immediately is quantify the latency through the firewall on 1433 is between 1-15ms. I can’t find anything that will do it. I like the tool and will keep it for use in other situations however!!!

    Cheers!

Corelan Live training

Since 2011, Corelan GCV has been teaching live win32 exploit dev classes at various security cons and private companies & organizations.

You can read more about the training and schedules here

Demand Global Change

The world needs your help !

Please take a few moments to read the "Demand Global Change Call For Action" document at
http://bit.ly/demandglobalchange
Read the full document at
http://bit.ly/demandglobalchange_full and share the message with as many people as possible.

Like the Facebook page, and SHARE it with everyone you know.



Donate

Want to support the Corelan Team community ? Click here to go to our donations page.

Want to donate BTC to Corelan Team?



Your donation will help funding server hosting.

Protected by Copyscape Web Plagiarism Tool

Corelan Team Merchandise

You can support Corelan Team by donating or purchasing items from the official Corelan Team merchandising store.

Corelan on IRC

You can chat with us and our friends on #corelan (freenode IRC)

Categories