35 lines
922 B
C#
35 lines
922 B
C#
namespace IP_port_checker.SubnetScanner
|
|
{
|
|
public class SubnetScanner
|
|
{
|
|
public static void ScanSubnet()
|
|
{
|
|
while (true)
|
|
{
|
|
string ip = "";
|
|
int mask = 0;
|
|
|
|
string cidr = SubnetValid.SubValid("Введите подсеть: ", ref ip, ref mask);
|
|
|
|
string[] parts = ip.Split('.');
|
|
string network = $"{parts[0]}.{parts[1]}.{parts[2]}";
|
|
|
|
IsHostAlive.ParralelScan(network);
|
|
|
|
Console.WriteLine("Готово! Повторить еще раз? Y/N");
|
|
|
|
string? input = Console.ReadLine()?.ToLower() ?? "n";
|
|
bool exit = input?.ToLower() switch
|
|
{
|
|
"y" => false,
|
|
"n" => true,
|
|
_ => true
|
|
};
|
|
|
|
if (exit) break;
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|