|
1 | 1 | # pping
|
2 |
| -A port ping console for Windows. |
| 2 | + |
| 3 | +A multi-platform port ping. |
3 | 4 |
|
4 | 5 | ## Purpose
|
5 | 6 |
|
6 |
| -pping is designed to give you the easiest possible solution for discovering ports from a windows console. The design was heavily oriented towards the terminology and behavior of the classic ping tool under windows. |
| 7 | +pping is designed to give you the easiest possible solution for discovering ports from a shell. The design was heavily oriented towards the terminology and behavior of the classic ping tool. |
7 | 8 |
|
8 | 9 | ## Implementation
|
9 | 10 |
|
10 |
| -pping is developed using Microsoft .NET Core version 3.1. pping uses logic from our package [cfUtils](https://github.com/codingfreak/cfUtils). |
| 11 | +pping is developed using Microsoft .NET 6. pping uses logic from: |
| 12 | + |
| 13 | +- Our package [cfUtils](https://github.com/codingfreak/cfUtils). |
| 14 | +- McMaster CommandLineUtils [McMaster.Extensions.CommandLineUtils](https://www.nuget.org/packages/McMaster.Extensions.CommandLineUtils/) |
11 | 15 |
|
12 | 16 | ## Installation
|
13 | 17 |
|
14 |
| -The easiest way to get pping running on your machine is to use chocolatey and install it |
| 18 | +The easiest way to get pping running on your machine is to use [chocolatey](<[https.//](https://chocolatey.org/)>) and install it: |
| 19 | + |
| 20 | +```shell |
| 21 | +choco install pping |
| 22 | +``` |
15 | 23 |
|
16 |
| - choco install pping |
| 24 | +Alternatively you can simply download the 7z-package from [codingfreaks.de](https://codingfreaks.de/tools) and unzip the files in any directory. It will make sense to add this directory to your PATH variable. |
17 | 25 |
|
18 |
| -Alternativeley you can simply download the 7z-package from [codingfreaks.de](https://codingfreaks.de/tools) and unzip the files in any directory. It will make sense to add this directory to your PATH variable. |
| 26 | +**winget** We are NOT supporting the new Windows 11 package manager "winget" as long as this product requires complex installers like msi etc. We are providing an EXE and a json basically and thus think that an MSI for this would be overwhelming. |
19 | 27 |
|
20 | 28 | ## Basic usage
|
21 | 29 |
|
22 | 30 | The simplest possible call would be to check a single port on a DNS address or IP address. The following snippets checks, if port `80` is open on the address `google.com`:
|
23 | 31 |
|
24 |
| - pping google.com 80 |
| 32 | +```shell |
| 33 | +pping google.com 80 |
| 34 | +``` |
25 | 35 |
|
26 | 36 | The result will be something like this:
|
27 | 37 |
|
28 |
| - > pping google.com 80 |
29 |
| - Starting pinging host google.com on TCP port(s) 80 4 times: |
30 |
| - # 1 -> Pinging host google.com (IP:-) on TCP port 80 with timeout 1: OPEN |
31 |
| - # 2 -> Pinging host google.com (IP:-) on TCP port 80 with timeout 1: OPEN |
32 |
| - # 3 -> Pinging host google.com (IP:-) on TCP port 80 with timeout 1: OPEN |
33 |
| - # 4 -> Pinging host google.com (IP:-) on TCP port 80 with timeout 1: OPEN |
34 |
| - Finished pinging host google.com (IP:-). 4 pings sent (4 OPEN, 0 CLOSED) |
| 38 | +```shell |
| 39 | +> pping google.com 80 |
| 40 | +Starting pinging host google.com on TCP port(s) 80 4 times: |
| 41 | +# 1 -> Pinging host google.com (IP:-) on TCP port 80 with timeout 1: OPEN |
| 42 | +# 2 -> Pinging host google.com (IP:-) on TCP port 80 with timeout 1: OPEN |
| 43 | +# 3 -> Pinging host google.com (IP:-) on TCP port 80 with timeout 1: OPEN |
| 44 | +# 4 -> Pinging host google.com (IP:-) on TCP port 80 with timeout 1: OPEN |
| 45 | +Finished pinging host google.com (IP:-). 4 pings sent (4 OPEN, 0 CLOSED) |
| 46 | +``` |
35 | 47 |
|
36 | 48 | By default pping will try to reach a port 4 times.If you want pping to resolve the IP address behind a DNS entry just add the `-res` parameter:
|
37 | 49 |
|
38 |
| - pping google.com 80 -res |
39 |
| - |
40 |
| - Starting pinging host google.com on TCP port(s) 80 4 times: |
41 |
| - # 1 -> Pinging host google.com (IP:2a00:1450:4005:808::200e) on TCP port 80 with timeout 1: OPEN |
42 |
| - # 2 -> Pinging host google.com (IP:2a00:1450:4005:808::200e) on TCP port 80 with timeout 1: OPEN |
43 |
| - # 3 -> Pinging host google.com (IP:2a00:1450:4005:808::200e) on TCP port 80 with timeout 1: OPEN |
44 |
| - # 4 -> Pinging host google.com (IP:2a00:1450:4005:808::200e) on TCP port 80 with timeout 1: OPEN |
45 |
| - Finished pinging host google.com (IP:2a00:1450:4005:808::200e). 4 pings sent (4 OPEN, 0 CLOSED) |
| 50 | +```shell |
| 51 | +pping google.com 80 -res |
| 52 | + |
| 53 | +Starting pinging host google.com on TCP port(s) 80 4 times: |
| 54 | +# 1 -> Pinging host google.com (IP:2a00:1450:4005:808::200e) on TCP port 80 with timeout 1: OPEN |
| 55 | +# 2 -> Pinging host google.com (IP:2a00:1450:4005:808::200e) on TCP port 80 with timeout 1: OPEN |
| 56 | +# 3 -> Pinging host google.com (IP:2a00:1450:4005:808::200e) on TCP port 80 with timeout 1: OPEN |
| 57 | +# 4 -> Pinging host google.com (IP:2a00:1450:4005:808::200e) on TCP port 80 with timeout 1: OPEN |
| 58 | +Finished pinging host google.com (IP:2a00:1450:4005:808::200e). 4 pings sent (4 OPEN, 0 CLOSED) |
| 59 | +``` |
46 | 60 |
|
47 | 61 | You can perform constant pings too:
|
48 | 62 |
|
49 |
| - pping google.com 80 -t |
| 63 | +```shell |
| 64 | +pping google.com 80 -t |
| 65 | +``` |
50 | 66 |
|
51 |
| -This will perform and "endless" ping to the address. |
| 67 | +This will perform and "endless" ping to the address. |
52 | 68 |
|
53 | 69 | ## Special usage
|
54 | 70 |
|
55 | 71 | ### Waiting for a port to open
|
56 | 72 |
|
57 |
| -On of the common scenarios to use ping is to determine, if a certain service is already up. Consider a situation where you restart a server and want to know, when RDP connections are possible. A simple ping would'nt help you here because even if the machine is up, the RDP port (3389) might no be reachable yet. |
| 73 | +On of the common scenarios to use ping is to determine, if a certain service is already up. Consider a situation where you restart a server and want to know, when RDP connections are possible. A simple ping would'nt help you here because even if the machine is up, the RDP port (3389) might no be reachable yet. |
58 | 74 |
|
59 | 75 | pping can help you in this situation:
|
60 | 76 |
|
61 |
| - pping myserver.local 3389 -t -as |
| 77 | +```shell |
| 78 | +pping myserver.local 3389 -t -as |
| 79 | +``` |
62 | 80 |
|
63 | 81 | You perform a permanent pping (`-t`) but you tell pping to stop pinging when the port is reachable the first time (`-as`). "as" is the abbreviation for "autostop".
|
64 | 82 |
|
65 | 83 | ### Multiple ports
|
66 | 84 |
|
67 | 85 | If you want to check lets say 2 ports (http and https) on a certain address. Just delimit the ports by `,`:
|
68 | 86 |
|
69 |
| - pping google.com 80,443 -d |
70 |
| - |
71 |
| - Starting pinging host google.com on TCP port(s) 80,443 4 times: |
72 |
| - # 1 -> Pinging host google.com (IP:-) on TCP port 80 with timeout 1: CLOSED (TimedOut) |
73 |
| - # 2 -> Pinging host google.com (IP:-) on TCP port 443 with timeout 1: CLOSED (TimedOut) |
74 |
| - # 3 -> Pinging host google.com (IP:-) on TCP port 80 with timeout 1: OPEN |
75 |
| - # 4 -> Pinging host google.com (IP:-) on TCP port 443 with timeout 1: OPEN |
76 |
| - # 5 -> Pinging host google.com (IP:-) on TCP port 80 with timeout 1: OPEN |
77 |
| - # 6 -> Pinging host google.com (IP:-) on TCP port 443 with timeout 1: OPEN |
78 |
| - # 7 -> Pinging host google.com (IP:-) on TCP port 80 with timeout 1: OPEN |
79 |
| - # 8 -> Pinging host google.com (IP:-) on TCP port 443 with timeout 1: OPEN |
80 |
| - Finished pinging host google.com (IP:-). 8 pings sent (6 OPEN, 2 CLOSED) |
| 87 | +```shell |
| 88 | +pping google.com 80,443 -d |
| 89 | + |
| 90 | +Starting pinging host google.com on TCP port(s) 80,443 4 times: |
| 91 | +# 1 -> Pinging host google.com (IP:-) on TCP port 80 with timeout 1: CLOSED (TimedOut) |
| 92 | +# 2 -> Pinging host google.com (IP:-) on TCP port 443 with timeout 1: CLOSED (TimedOut) |
| 93 | +# 3 -> Pinging host google.com (IP:-) on TCP port 80 with timeout 1: OPEN |
| 94 | +# 4 -> Pinging host google.com (IP:-) on TCP port 443 with timeout 1: OPEN |
| 95 | +# 5 -> Pinging host google.com (IP:-) on TCP port 80 with timeout 1: OPEN |
| 96 | +# 6 -> Pinging host google.com (IP:-) on TCP port 443 with timeout 1: OPEN |
| 97 | +# 7 -> Pinging host google.com (IP:-) on TCP port 80 with timeout 1: OPEN |
| 98 | +# 8 -> Pinging host google.com (IP:-) on TCP port 443 with timeout 1: OPEN |
| 99 | +Finished pinging host google.com (IP:-). 8 pings sent (6 OPEN, 2 CLOSED) |
| 100 | +``` |
81 | 101 |
|
82 | 102 | It is also possible to define a range of ports by delimiting them with '-':
|
83 | 103 |
|
84 |
| - pping google.com 80-82 -d |
85 |
| - Starting pinging host google.com on TCP port(s) 80-82 4 times: |
86 |
| - # 1 -> Pinging host google.com (IP:-) on TCP port 80 with timeout 1: OPEN |
87 |
| - # 2 -> Pinging host google.com (IP:-) on TCP port 81 with timeout 1: CLOSED (TimedOut) |
88 |
| - # 3 -> Pinging host google.com (IP:-) on TCP port 82 with timeout 1: CLOSED (TimedOut) |
89 |
| - # 4 -> Pinging host google.com (IP:-) on TCP port 80 with timeout 1: OPEN |
90 |
| - # 5 -> Pinging host google.com (IP:-) on TCP port 81 with timeout 1: CLOSED (TimedOut) |
91 |
| - # 6 -> Pinging host google.com (IP:-) on TCP port 82 with timeout 1: CLOSED (TimedOut) |
92 |
| - # 7 -> Pinging host google.com (IP:-) on TCP port 80 with timeout 1: OPEN |
93 |
| - # 8 -> Pinging host google.com (IP:-) on TCP port 81 with timeout 1: CLOSED (TimedOut) |
94 |
| - # 9 -> Pinging host google.com (IP:-) on TCP port 82 with timeout 1: CLOSED (TimedOut) |
95 |
| - # 10 -> Pinging host google.com (IP:-) on TCP port 80 with timeout 1: OPEN |
96 |
| - # 11 -> Pinging host google.com (IP:-) on TCP port 81 with timeout 1: CLOSED (TimedOut) |
97 |
| - # 12 -> Pinging host google.com (IP:-) on TCP port 82 with timeout 1: CLOSED (TimedOut) |
98 |
| - Finished pinging host google.com (IP:-). 12 pings sent (4 OPEN, 8 CLOSED) |
| 104 | +```shell |
| 105 | +pping google.com 80-82 -d |
| 106 | +Starting pinging host google.com on TCP port(s) 80-82 4 times: |
| 107 | +# 1 -> Pinging host google.com (IP:-) on TCP port 80 with timeout 1: OPEN |
| 108 | +# 2 -> Pinging host google.com (IP:-) on TCP port 81 with timeout 1: CLOSED (TimedOut) |
| 109 | +# 3 -> Pinging host google.com (IP:-) on TCP port 82 with timeout 1: CLOSED (TimedOut) |
| 110 | +# 4 -> Pinging host google.com (IP:-) on TCP port 80 with timeout 1: OPEN |
| 111 | +# 5 -> Pinging host google.com (IP:-) on TCP port 81 with timeout 1: CLOSED (TimedOut) |
| 112 | +# 6 -> Pinging host google.com (IP:-) on TCP port 82 with timeout 1: CLOSED (TimedOut) |
| 113 | +# 7 -> Pinging host google.com (IP:-) on TCP port 80 with timeout 1: OPEN |
| 114 | +# 8 -> Pinging host google.com (IP:-) on TCP port 81 with timeout 1: CLOSED (TimedOut) |
| 115 | +# 9 -> Pinging host google.com (IP:-) on TCP port 82 with timeout 1: CLOSED (TimedOut) |
| 116 | +# 10 -> Pinging host google.com (IP:-) on TCP port 80 with timeout 1: OPEN |
| 117 | +# 11 -> Pinging host google.com (IP:-) on TCP port 81 with timeout 1: CLOSED (TimedOut) |
| 118 | +# 12 -> Pinging host google.com (IP:-) on TCP port 82 with timeout 1: CLOSED (TimedOut) |
| 119 | +Finished pinging host google.com (IP:-). 12 pings sent (4 OPEN, 8 CLOSED) |
| 120 | +``` |
99 | 121 |
|
100 | 122 | ## Option table
|
101 | 123 |
|
102 | 124 | The following table lists all available options:
|
103 | 125 |
|
104 |
| -| Abbreviation | Full name | Sample | Purpose |
105 |
| -|:--- |:--- |:--- |:--- |
106 |
| -| t | endless | -t | If set, the app will run infinitely. (see -a option). |
107 |
| -| r | repeats | -r 10 | Number of repeats in a non-endless pping (defaults to 4) |
108 |
| -| tim | timeout | -tim 2 | Defines the timeout in seconds the app will wait for each requests to return. |
109 |
| -| l | logo | -logo | If provided, pping will print detailed header informations. |
110 |
| -| res | resolve | -res | If provided, pping will resolve the IP address for each pping. |
111 |
| -| a | autostop | -a | If set, the app will stop working when it gets the first OPEN-result. |
112 |
| -| els | elsucc | -els | If set, the app will return the amount of successful port requests as the result code. |
113 |
| -| elf | elfail | -elf | If set, the app will return error level 0 on any open ping and error level 1 if all pings resulted in closed port. |
114 |
| -| w | waittime | -w 2000 | Defines a time in milliseconds to wait between calls. Defaults to 1000. |
115 |
| -| d | detailed | -d | If provided, pping will try to write reason details at closed ports to te console. |
116 |
| -| 4 | ipv4 | -4 | If provided, pping will use IPv4 for resolutions. |
117 |
| -| 6 | ipv6 | -6 | If provided, pping will use IPv6 for resolutions. |
| 126 | +| Abbreviation | Full name | Sample | Purpose | |
| 127 | +| :----------- | :-------- | :------ | :----------------------------------------------------------------------------------------------------------------- | |
| 128 | +| t | endless | -t | If set, the app will run infinitely. (see -a option). | |
| 129 | +| r | repeats | -r 10 | Number of repeats in a non-endless pping (defaults to 4) | |
| 130 | +| tim | timeout | -tim 2 | Defines the timeout in seconds the app will wait for each requests to return. | |
| 131 | +| l | logo | -logo | If provided, pping will print detailed header informations. | |
| 132 | +| res | resolve | -res | If provided, pping will resolve the IP address for each pping. | |
| 133 | +| a | autostop | -a | If set, the app will stop working when it gets the first OPEN-result. | |
| 134 | +| els | elsucc | -els | If set, the app will return the amount of successful port requests as the result code. | |
| 135 | +| elf | elfail | -elf | If set, the app will return error level 0 on any open ping and error level 1 if all pings resulted in closed port. | |
| 136 | +| w | waittime | -w 2000 | Defines a time in milliseconds to wait between calls. Defaults to 1000. | |
| 137 | +| d | detailed | -d | If provided, pping will try to write reason details at closed ports to te console. | |
| 138 | +| 4 | ipv4 | -4 | If provided, pping will use IPv4 for resolutions. | |
| 139 | +| 6 | ipv6 | -6 | If provided, pping will use IPv6 for resolutions. | |
0 commit comments