Skip to content

Instantly share code, notes, and snippets.

@anguschiu1
Last active October 3, 2019 02:54
Show Gist options
  • Save anguschiu1/f923710675e35d35fa60e0a05f2a2107 to your computer and use it in GitHub Desktop.
Save anguschiu1/f923710675e35d35fa60e0a05f2a2107 to your computer and use it in GitHub Desktop.
[PowerShell useful command]#powershell#CLI

Test network connection (Test-NetworkConnection)

tnc google.com -port 80

PS C:\WINDOWS\System32> tnc google.com -port 80


ComputerName     : google.com
RemoteAddress    : 172.217.26.142
RemotePort       : 80
InterfaceAlias   : Wi-Fi
SourceAddress    : 10.20.81.249
TcpTestSucceeded : True

Check curves

Method 1 get-tlsecccurve

PS C:\WINDOWS\System32> get-tlsecccurve
curve25519
NistP256
NistP384

Method 2 CertUtil.exe -DisplayEccCurve

PS C:\Users\itangusc> CertUtil.exe -DisplayEccCurve
Microsoft SSL Protocol Provider:
--------------------------------
Curve Name          Curve OID                     Public Key Length   CurveType           EccCurveFlags
-----------------------------------------------------------------------------------------------
curve25519                                        255                 29                  0xa
nistP256            1.2.840.10045.3.1.7           256                 23                  0x7
nistP384            1.3.132.0.34                  384                 24                  0x7
brainpoolP256r1     1.3.36.3.3.2.8.1.1.7          256                 26                  0x7
brainpoolP384r1     1.3.36.3.3.2.8.1.1.11         384                 27                  0x7
brainpoolP512r1     1.3.36.3.3.2.8.1.1.13         512                 28                  0x7
nistP192            1.2.840.10045.3.1.1           192                 19                  0x7
nistP224            1.3.132.0.33                  224                 21                  0x7
nistP521            1.3.132.0.35                  521                 25                  0x7
secP160k1           1.3.132.0.9                   160                 15                  0x7
secP160r1           1.3.132.0.8                   160                 16                  0x7
secP160r2           1.3.132.0.30                  160                 17                  0x7
secP192k1           1.3.132.0.31                  192                 18                  0x7
secP192r1           1.2.840.10045.3.1.1           192                 19                  0x7
secP224k1           1.3.132.0.32                  224                 20                  0x7
secP224r1           1.3.132.0.33                  224                 21                  0x7
secP256k1           1.3.132.0.10                  256                 22                  0x7
secP256r1           1.2.840.10045.3.1.7           256                 23                  0x7
secP384r1           1.3.132.0.34                  384                 24                  0x7
secP521r1           1.3.132.0.35                  521                 25                  0x7


CNG Curves:
-----------
Curve Name          Curve OID                     Public Key Length
-------------------------------------------------------------------
brainpoolP160r1     1.3.36.3.3.2.8.1.1.1          160
brainpoolP160t1     1.3.36.3.3.2.8.1.1.2          160
brainpoolP192r1     1.3.36.3.3.2.8.1.1.3          192
brainpoolP192t1     1.3.36.3.3.2.8.1.1.4          192
brainpoolP224r1     1.3.36.3.3.2.8.1.1.5          224
brainpoolP224t1     1.3.36.3.3.2.8.1.1.6          224
brainpoolP256r1     1.3.36.3.3.2.8.1.1.7          256
brainpoolP256t1     1.3.36.3.3.2.8.1.1.8          256
brainpoolP320r1     1.3.36.3.3.2.8.1.1.9          320
brainpoolP320t1     1.3.36.3.3.2.8.1.1.10         320
brainpoolP384r1     1.3.36.3.3.2.8.1.1.11         384
brainpoolP384t1     1.3.36.3.3.2.8.1.1.12         384
brainpoolP512r1     1.3.36.3.3.2.8.1.1.13         512
brainpoolP512t1     1.3.36.3.3.2.8.1.1.14         512
curve25519                                        255
ec192wapi           1.2.156.11235.1.1.2.1         192
nistP192            1.2.840.10045.3.1.1           192
nistP224            1.3.132.0.33                  224
nistP256            1.2.840.10045.3.1.7           256
nistP384            1.3.132.0.34                  384
nistP521            1.3.132.0.35                  521
numsP256t1                                        256
numsP384t1                                        384
numsP512t1                                        512
secP160k1           1.3.132.0.9                   160
secP160r1           1.3.132.0.8                   160
secP160r2           1.3.132.0.30                  160
secP192k1           1.3.132.0.31                  192
secP192r1           1.2.840.10045.3.1.1           192
secP224k1           1.3.132.0.32                  224
secP224r1           1.3.132.0.33                  224
secP256k1           1.3.132.0.10                  256
secP256r1           1.2.840.10045.3.1.7           256
secP384r1           1.3.132.0.34                  384
secP521r1           1.3.132.0.35                  521
wtls7               1.3.132.0.30                  160
wtls9               2.23.43.1.4.9                 160
wtls12              1.3.132.0.33                  224
x962P192v1          1.2.840.10045.3.1.1           192
x962P192v2          1.2.840.10045.3.1.2           192
x962P192v3          1.2.840.10045.3.1.3           192
x962P239v1          1.2.840.10045.3.1.4           239
x962P239v2          1.2.840.10045.3.1.5           239
x962P239v3          1.2.840.10045.3.1.6           239
x962P256v1          1.2.840.10045.3.1.7           256

CertUtil: -displayEccCurve command completed successfully.

Find running process and their port number

netstat -ano

PS C:\WINDOWS\System32> netstat -ano

Active Connections

  Proto  Local Address          Foreign Address        State           PID
  TCP    0.0.0.0:135            0.0.0.0:0              LISTENING       1196
  TCP    0.0.0.0:445            0.0.0.0:0              LISTENING       4
  TCP    0.0.0.0:2179           0.0.0.0:0              LISTENING       5460
  TCP    0.0.0.0:2701           0.0.0.0:0              LISTENING       17116
  TCP    0.0.0.0:3389           0.0.0.0:0              LISTENING       1572
  TCP    0.0.0.0:5040           0.0.0.0:0              LISTENING       10840
  (etc)

Check certificate status

certutil

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment