Search

A lazy port scanner written in c#

This is a legacy port scanner to scan all the open ports over an IP address written in c#
void Main()
{
string IpAddress = "127.0.0.1";
for (int CurrPort = 79; CurrPort <= 85; CurrPort++)
{
TcpClient TcpScan = new TcpClient();
try
{
TcpScan.Connect(IpAddress, CurrPort);
Console.WriteLine("Port " + CurrPort + " open");
}
catch
{
// An exception occured, thus the port is probably closed
//Console.Write("Port " + CurrPort + " closed");
}
}
}