Skip to content

Commit 0fa43e4

Browse files
authored
Merge pull request #2 from codingfreak/net6_and_installer
Net6
2 parents a2618d4 + 1fb8dfc commit 0fa43e4

24 files changed

+102
-723
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ bld/
2525

2626
# Visual Studio 2015 cache/options directory
2727
.vs/
28+
.vscode/
2829
# Uncomment if you have tasks that create the project's static files in wwwroot
2930
#wwwroot/
3031

README.md

Lines changed: 89 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,117 +1,139 @@
11
# pping
2-
A port ping console for Windows.
2+
3+
A multi-platform port ping.
34

45
## Purpose
56

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.
78

89
## Implementation
910

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/)
1115

1216
## Installation
1317

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+
```
1523

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.
1725

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.
1927

2028
## Basic usage
2129

2230
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`:
2331

24-
pping google.com 80
32+
```shell
33+
pping google.com 80
34+
```
2535

2636
The result will be something like this:
2737

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+
```
3547

3648
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:
3749

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+
```
4660

4761
You can perform constant pings too:
4862

49-
pping google.com 80 -t
63+
```shell
64+
pping google.com 80 -t
65+
```
5066

51-
This will perform and "endless" ping to the address.
67+
This will perform and "endless" ping to the address.
5268

5369
## Special usage
5470

5571
### Waiting for a port to open
5672

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.
5874

5975
pping can help you in this situation:
6076

61-
pping myserver.local 3389 -t -as
77+
```shell
78+
pping myserver.local 3389 -t -as
79+
```
6280

6381
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".
6482

6583
### Multiple ports
6684

6785
If you want to check lets say 2 ports (http and https) on a certain address. Just delimit the ports by `,`:
6886

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+
```
81101

82102
It is also possible to define a range of ports by delimiting them with '-':
83103

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+
```
99121

100122
## Option table
101123

102124
The following table lists all available options:
103125

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. |

Ui/Ui.ConsoleApp/Ui.ConsoleApp.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<OutputType>Exe</OutputType>
4-
<TargetFramework>net5.0</TargetFramework>
4+
<TargetFramework>net6.0</TargetFramework>
55
<RootNamespace>codingfreaks.pping.Ui.ConsoleApp</RootNamespace>
66
<AssemblyName>pping</AssemblyName>
77
<Authors>codingfreaks</Authors>
8-
<Version>2.1.0</Version>
9-
<Copyright>codingfreaks 2013-2020</Copyright>
8+
<Version>3.0.0</Version>
9+
<Copyright>codingfreaks 2013-2021</Copyright>
1010
<LangVersion>latest</LangVersion>
1111
<DebugType>embedded</DebugType>
1212
</PropertyGroup>

Ui/Ui.ConsoleApp/pping.nuspec

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
33
<metadata>
44
<id>pping</id>
5-
<version>2.1.0</version>
5+
<version>3.0.0</version>
66
<title>pping</title>
77
<authors>Alexander Schmidt (codingfreaks)</authors>
88
<projectUrl>https://codingfreaks.de/pping/</projectUrl>
99
<iconUrl>https://codingfreaksarchive.de/files/codingfreaks.jpg</iconUrl>
10-
<copyright>2013-2020 codingfreaks</copyright>
10+
<copyright>2013-2022 codingfreaks</copyright>
1111
<projectSourceUrl>https://github.com/codingfreak/pping</projectSourceUrl>
1212
<docsUrl>https://github.com/codingfreak/pping</docsUrl>
1313
<tags>ping port dotnet codingfreaks</tags>
1414
<summary>Console application to scan for single or multiple open ports.</summary>
15-
<description>pping is a .NET Core console application which allowes you to scan any machine via TCP or UDP for single or multiple open ports. Its syntax is built with the ping-tool in mind.</description>
16-
<releaseNotes>Moved to .NET 5.0</releaseNotes>
15+
<description>pping is a .NET console application which allowes you to scan any machine via TCP or UDP for single or multiple open ports. Its syntax is built with the ping-tool in mind.</description>
16+
<releaseNotes>Moved to .NET 6.0</releaseNotes>
1717
<dependencies>
1818

1919
</dependencies>

Ui/Ui.ConsoleApp/publish-choco.ps1

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
1-
$folder = ".\bin\Release\net5.0\win-x64\publish\"
1+
$folder = ".\bin\Release\net6.0\win-x64\publish\"
22
# Execute the dotnet publish command for self-contained EXE and Windows
33
dotnet publish -c Release -r win-x64 --self-contained true /p:PublishSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true
44
# Calculate the new Hash:
55
$hashExe = Get-FileHash $folder\pping.exe | Select -ExpandProperty Hash
66
#$hashDll = Get-FileHash $folder\pping.dll | Select -ExpandProperty Hash
77
# Replace hash in verification.txt
88
(Get-Content verification.txt) -replace '- pping.exe \(SHA256: (.*)', "- pping.exe (SHA256: $hashExe)" | Out-File verification.txt
9-
#(Get-Content verification.txt) -replace '- pping.dll \(SHA256: (.*)', "- pping.dll (SHA256: $hashDll)" | Out-File verification.txt
109
# copy files to publish-folder for packing
1110
cp pping.nuspec $folder\pping.nuspec
1211
cp verification.txt $folder\verification.txt
1312
cp license.txt $folder\license.txt
1413
# pack choco package
1514
choco pack $folder\pping.nuspec --output-directory $folder\
1615
# read current version from nuspec
17-
$xmlFile = $folder + "\pping.nuspec"
16+
$xmlFile = $folder + "\pping.nuspec"
1817
[XML]$xml = Get-Content $xmlFile
1918
$version = $xml.package.metadata.version
2019
# push package to choco

Ui/Ui.ConsoleApp/verification.txt

-963 Bytes
Binary file not shown.

Ui/Ui.WindowsApp/App.config

Lines changed: 0 additions & 6 deletions
This file was deleted.

Ui/Ui.WindowsApp/App.xaml

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)