'How do I open a port in Windows 10 for use?

I need to open port#42474 on my Windows 10 system for penetration testing purposes.

I added it to the inbound list of my Windows Defender Firewall (both TCP and UDP protocol), and it is enabled. However, whenever I am trying to ping this port on my machine using telnet it is throwing an error as

Connecting To localhost...Could not open connection to the host, on port 42474: Connect failed

I am able to use telnet to ping other sites such as google.com. But not this port on my machine. Below is the command I am running to test the port and the error:

Port Telnet error

telnet localhost 42474
  1. Do I need to do anything else to open port#42474?
  2. How do I verify if this port is available for use?


Solution 1:[1]

TCP ports are bi-directional, so check these tips:

  • Verify your service on this port is running: netstat -a
  • Be sure your firewall isn't blocking (try to deactivate it: if it works well, your rule isn't correct)
  • Search for your service log: maybe, it receive information, but it's not able to reply. I recommend you to use PuTTY or Kitty (which is my favorite, because it's portable without registry keys modification), and try to connect on this port.

If you need a tool that able to listen on the port, see this post: Utility to open TCP port to listen state and netcat.

Solution 2:[2]

You can use the Python programming language. More specifically, the socket library:

import socket

hote = "localhost"
port = 4444

socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
socket.connect((hote, port))
print "Connection on {}".format(port)

socket.send(u"Hey my name is Abdx!")

print "Close"
socket.close()

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Peter Mortensen
Solution 2 Peter Mortensen